Skip to content

Commit

Permalink
Make the use of canary more idiomatic, use times instead of at_least …
Browse files Browse the repository at this point in the history
…for an exact number of matches
  • Loading branch information
wjessop committed Sep 20, 2011
1 parent bce931f commit fcd8d74
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spec/lib/scamp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@

it "should not match without prefix when required_prefix is true" do
canary = mock
canary.expects(:lives).never
canary.expects(:bang).never

bot = a Scamp, :required_prefix => 'Bot: '
bot.behaviour do
match("a string") {canary.lives}
match("a string") {canary.bang}
end

bot.send(:process_message, {:body => "a string"})
Expand Down Expand Up @@ -264,11 +264,11 @@

it "should not match without prefix when required_prefix is present" do
canary = mock
canary.expects(:lives).never
canary.expects(:bang).never

bot = a Scamp, :required_prefix => /^Bot[\:,\s]+/i
bot.behaviour do
match(/a string/) {canary.lives}
match(/a string/) {canary.bang}
end

bot.send(:process_message, {:body => "a string"})
Expand All @@ -278,7 +278,7 @@

it "should match with regex prefix when required_prefix is present" do
canary = mock
canary.expects(:lives).at_least(4)
canary.expects(:lives).times(4)

bot = a Scamp, :required_prefix => /^Bot\W{1,2}/i
bot.behaviour do
Expand Down

0 comments on commit fcd8d74

Please sign in to comment.