Skip to content

Commit

Permalink
Fix mash spec
Browse files Browse the repository at this point in the history
  • Loading branch information
CoralineAda committed Feb 12, 2017
1 parent eeda244 commit 7c8828c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
6 changes: 3 additions & 3 deletions alice/grammar/language_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ module LanguageHelper
"delete",
"describe",
"did",
# "do",
# "does",
"examine",
"had",
"has",
Expand All @@ -27,7 +25,9 @@ module LanguageHelper
"tell",
"think",
"was",
"wrote"
"wrote",
"do",
"does"
]

RELATION_VERBS = [
Expand Down
40 changes: 28 additions & 12 deletions spec/parsers/mash_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,26 @@
describe "Parser::Mash" do

before do
User.destroy_all
Item.destroy_all
Factoid.destroy_all
@robyn = ::User.create!(primary_nick: "robyn")
@syd = ::User.create!(primary_nick: "syd")
@tomato = Item.create!(name: "tomato")
@command = Message::Command.create!(name: "get_fact", indicators: ["know", "fact", "factoid", "tell"], handler_class: "Handlers::Factoid", handler_method: "get")
@command = Message::Command.find_or_create_by(
name: "get_fact",
indicators: ["know", "fact", "factoid", "tell"],
handler_class: "Handlers::Factoid",
handler_method: "get"
)
Message::Command.find_or_create_by(
name: "properties",
verbs: ["can_brew?", "can_forge?", "last_seen", "can_play_game?", "current_nick", "dazed?", "disoriented?", "drunk?", "is_online?", "is_op?", "bio", "proper_name", "twitter_handle", "twitter_url", "points", "check_points", "check_score"],
stop_words: [],
indicators: ["can_brew?", "can_forge?", "last_seen", "can_play_game?", "current_nick", "dazed?", "disoriented?", "drunk?", "is_online?", "is_op?", "bio", "proper_name", "twitter_handle", "twitter_url"],
handler_class: "Handlers::Properties",
handler_method: "get_property"
)
@factoid = Factoid.create!(user: @robyn, text: "Briggs features in the Robyn Hitchcock song 'A Man\'s Gotta Know'")
end

Expand All @@ -16,7 +32,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes Syd" do
Expand All @@ -31,7 +47,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes Robyn" do
Expand All @@ -50,7 +66,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes the tomato object" do
Expand All @@ -69,7 +85,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes the tomato object" do
Expand All @@ -88,7 +104,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes the Syd user" do
Expand All @@ -101,11 +117,11 @@

context "happy path" do

let(:command_string) { Message::CommandString.new("Alice, what is Syd twitter handle?") }
let(:command_string) { Message::CommandString.new("Alice, what is Syd's twitter handle?") }
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes the Syd user" do
Expand All @@ -124,7 +140,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "does not map to a non-whitelisted instance method" do
Expand All @@ -141,7 +157,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes the tomato object" do
Expand All @@ -160,7 +176,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes the Robyn user" do
Expand All @@ -179,7 +195,7 @@
let(:parser) { Parser::Mash.new(command_string) }

before do
parser.parse!
parser.parse
end

it "recognizes the tomato object" do
Expand Down

0 comments on commit 7c8828c

Please sign in to comment.