Skip to content

Commit

Permalink
Specs update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Kopiński committed Apr 17, 2015
1 parent b21b1d6 commit da06eef
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
1 change: 1 addition & 0 deletions hipbot.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency "em-http-request", ["~> 1.1"]
gem.add_development_dependency "rake"
gem.add_development_dependency "rspec"
gem.add_development_dependency "rspec-its"
gem.add_development_dependency "guard-rspec"
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'rspec/its'

require_relative '../lib/hipbot'

begin
Expand Down
14 changes: 7 additions & 7 deletions spec/unit/match_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

describe "#matches?" do
its(:matches?) { should be_true }
its(:matches?) { should be_truthy }

describe "specific regexp" do
describe "matching the message body" do
Expand All @@ -33,7 +33,7 @@
reaction.stub(regexps: [/\Atest/])
end

its(:matches?) { should be_true }
its(:matches?) { should be_truthy }
end

describe "not matching message body" do
Expand All @@ -42,7 +42,7 @@
reaction.stub(regexps: [/\Arandom/])
end

its(:matches?) { should be_false }
its(:matches?) { should be_falsy }
end
end

Expand All @@ -53,7 +53,7 @@
reaction.stub(regexps: [/\Awat/, /\Atest/])
end

its(:matches?) { should be_true }
its(:matches?) { should be_truthy }
end

describe "not matching message body" do
Expand All @@ -62,7 +62,7 @@
reaction.stub(regexps: [/\Awat/, /\Arandom/])
end

its(:matches?) { should be_false }
its(:matches?) { should be_falsy }
end
end

Expand All @@ -72,15 +72,15 @@
reaction.stub(condition: proc { true })
end

its(:matches?) { should be_true }
its(:matches?) { should be_truthy }
end

describe "returning false" do
before do
reaction.stub(condition: proc { false })
end

its(:matches?) { should be_false }
its(:matches?) { should be_falsy }
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
it "should be for bot" do
user = double(mention: 'robot')
message = subject.new('hello @robot!', room, sender)
message.for?(user).should be_true
message.for?(user).should be_truthy
end

it "should not be for bot" do
user = double(mention: 'robot')
message = subject.new('hello @tom!', room, sender)
message.for?(user).should be_false
message.for?(user).should be_falsy
end

it 'knows its recipients' do
Expand Down
28 changes: 14 additions & 14 deletions spec/unit/reaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@
let(:reaction){ subject.new(@plugin, options, @block) }

it '#in_any_room?' do
reaction.in_any_room?.should be_false
reaction.in_any_room?.should be_falsy
options[:room] = true
reaction.in_any_room?.should be_true
reaction.in_any_room?.should be_truthy
end

it '#to_anything?' do
reaction.to_anything?.should be_true
reaction.to_anything?.should be_truthy
reaction.options[:regexps] = nil
reaction.to_anything?.should be_true
reaction.to_anything?.should be_truthy
end

it '#from_anywhere?' do
reaction.from_anywhere?.should be_true
reaction.from_anywhere?.should be_truthy
reaction.options[:room] = nil
reaction.from_anywhere?.should be_true
reaction.from_anywhere?.should be_truthy
end

it '#condition' do
reaction.condition.call.should be_true
reaction.condition.call.should be_truthy
reaction.options[:if] = proc{ false }
reaction.condition.call.should be_false
reaction.condition.call.should be_falsy
end

it '#delete' do
Expand All @@ -45,15 +45,15 @@
end

it '#from_all?' do
reaction.from_all?.should be_true
reaction.from_all?.should be_truthy
reaction.options[:room] = nil
reaction.from_all?.should be_true
reaction.from_all?.should be_truthy
end

it '#global?' do
reaction.global?.should be_false
reaction.global?.should be_falsy
reaction.options = { global: true }
reaction.global?.should be_true
reaction.global?.should be_truthy
end

it '#plugin_name' do
Expand All @@ -67,9 +67,9 @@
end

it '#to_private_message?' do
reaction.to_private_message?.should be_false
reaction.to_private_message?.should be_falsy
reaction.options[:room] = false
reaction.to_private_message?.should be_true
reaction.to_private_message?.should be_truthy
end

it '#regexps' do
Expand Down

0 comments on commit da06eef

Please sign in to comment.