Skip to content

Commit

Permalink
dev: reduce warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Jul 2, 2011
1 parent 153d051 commit aca59bc
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 116 deletions.
2 changes: 1 addition & 1 deletion lib/rspec/mocks.rb
Expand Up @@ -152,7 +152,7 @@ module RSpec
#
# double.should_receive(:msg) do |arg|
# arg.should be_an_istance_of(Array)
# arg.length.should == 7
# arg.length.should eq 7
# end
#
# == Combining Expectation Details
Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/mocks/any_number_of_times_spec.rb
Expand Up @@ -24,7 +24,7 @@
it "returns the mocked value when called after a similar stub" do
@mock.stub(:message).and_return :stub_value
@mock.should_receive(:message).any_number_of_times.and_return(:mock_value)
@mock.message.should == :mock_value
@mock.message.should == :mock_value
@mock.message.should eq :mock_value
@mock.message.should eq :mock_value
end
end
2 changes: 1 addition & 1 deletion spec/rspec/mocks/at_least_spec.rb
Expand Up @@ -95,7 +95,7 @@ module Mocks

it "returns the value given by a block when the at least once method is called" do
@mock.should_receive(:to_s).at_least(:once) { "testing" }
@mock.to_s.should == "testing"
@mock.to_s.should eq "testing"
@mock.rspec_verify
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/mocks/at_most_spec.rb
Expand Up @@ -91,7 +91,7 @@ module Mocks

it "returns the value given by a block when the at most once method is called" do
@mock.should_receive(:to_s).at_most(:once) { "testing" }
@mock.to_s.should == "testing"
@mock.to_s.should eq "testing"
@mock.rspec_verify
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/mocks/bug_report_10263_spec.rb
Expand Up @@ -18,7 +18,7 @@
begin
test_double.foobar
rescue Exception => e
e.message.should == "Double received unexpected message :foobar with (no args)"
e.message.should eq "Double received unexpected message :foobar with (no args)"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/mocks/bug_report_7611_spec.rb
Expand Up @@ -10,7 +10,7 @@ class Bar < Foo; end
end

it "should" do
Bar.new.class.should == Bar
Bar.new.class.should eq Bar
end
end
end
4 changes: 2 additions & 2 deletions spec/rspec/mocks/bug_report_8165_spec.rb
Expand Up @@ -17,15 +17,15 @@
obj.should_receive(:respond_to?).with(:foobar).and_return(true)
obj.should_receive(:foobar).and_return(:baz)
obj.respond_to?(:foobar).should be_true
obj.foobar.should == :baz
obj.foobar.should eq :baz
end

it "does not raise an exception for mock" do
obj = double("obj")
obj.should_receive(:respond_to?).with(:foobar).and_return(true)
obj.should_receive(:foobar).and_return(:baz)
obj.respond_to?(:foobar).should be_true
obj.foobar.should == :baz
obj.foobar.should eq :baz
end

end
4 changes: 2 additions & 2 deletions spec/rspec/mocks/bug_report_957_spec.rb
Expand Up @@ -11,11 +11,11 @@ module Mocks
end

it "returns the value for the stub on the base class" do
@base_class.find.should == "stubbed_value"
@base_class.find.should eq "stubbed_value"
end

it "returns the value for the descendent class" do
@concrete_class.find.should == "stubbed_value"
@concrete_class.find.should eq "stubbed_value"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/mocks/failing_argument_matchers_spec.rb
Expand Up @@ -85,9 +85,9 @@ module Mocks

it "fails with block matchers" do
expect do
@double.should_receive(:msg).with {|arg| arg.should == :received }
@double.should_receive(:msg).with {|arg| arg.should eq :received }
@double.msg :no_msg_for_you
end.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected: :received.*\s*.*got: :no_msg_for_you/)
end.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected :received.*\s*.*got :no_msg_for_you/)
end

end
Expand Down
22 changes: 11 additions & 11 deletions spec/rspec/mocks/hash_including_matcher_spec.rb
Expand Up @@ -6,51 +6,51 @@ module ArgumentMatchers
describe HashIncludingMatcher do

it "describes itself properly" do
HashIncludingMatcher.new(:a => 1).description.should == "hash_including(:a=>1)"
HashIncludingMatcher.new(:a => 1).description.should eq "hash_including(:a=>1)"
end

describe "passing" do
it "matches the same hash" do
hash_including(:a => 1).should == {:a => 1}
hash_including(:a => 1).should eq({:a => 1})
end

it "matches a hash with extra stuff" do
hash_including(:a => 1).should == {:a => 1, :b => 2}
hash_including(:a => 1).should eq({:a => 1, :b => 2})
end

describe "when matching against other matchers" do
it "matches an int against anything()" do
hash_including(:a => anything, :b => 2).should == {:a => 1, :b => 2}
hash_including(:a => anything, :b => 2).should eq({:a => 1, :b => 2})
end

it "matches a string against anything()" do
hash_including(:a => anything, :b => 2).should == {:a => "1", :b => 2}
hash_including(:a => anything, :b => 2).should eq({:a => "1", :b => 2})
end
end

describe "when passed only keys or keys mixed with key/value pairs" do
it "matches if the key is present" do
hash_including(:a).should == {:a => 1, :b => 2}
hash_including(:a).should eq({:a => 1, :b => 2})
end

it "matches if more keys are present" do
hash_including(:a, :b).should == {:a => 1, :b => 2, :c => 3}
hash_including(:a, :b).should eq({:a => 1, :b => 2, :c => 3})
end

it "matches a string against a given key" do
hash_including(:a).should == {:a => "1", :b => 2}
hash_including(:a).should eq({:a => "1", :b => 2})
end

it "matches if passed one key and one key/value pair" do
hash_including(:a, :b => 2).should == {:a => 1, :b => 2}
hash_including(:a, :b => 2).should eq({:a => 1, :b => 2})
end

it "matches if passed many keys and one key/value pair" do
hash_including(:a, :b, :c => 3).should == {:a => 1, :b => 2, :c => 3, :d => 4}
hash_including(:a, :b, :c => 3).should eq({:a => 1, :b => 2, :c => 3, :d => 4})
end

it "matches if passed many keys and many key/value pairs" do
hash_including(:a, :b, :c => 3, :e => 5).should == {:a => 1, :b => 2, :c => 3, :d => 4, :e => 5}
hash_including(:a, :b, :c => 3, :e => 5).should eq({:a => 1, :b => 2, :c => 3, :d => 4, :e => 5})
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions spec/rspec/mocks/hash_not_including_matcher_spec.rb
Expand Up @@ -6,28 +6,28 @@ module ArgumentMatchers
describe HashNotIncludingMatcher do

it "describes itself properly" do
HashNotIncludingMatcher.new(:a => 5).description.should == "hash_not_including(:a=>5)"
HashNotIncludingMatcher.new(:a => 5).description.should eq "hash_not_including(:a=>5)"
end

describe "passing" do
it "matches a hash without the specified key" do
hash_not_including(:c).should == {:a => 1, :b => 2}
hash_not_including(:c).should eq({:a => 1, :b => 2})
end

it "matches a hash with the specified key, but different value" do
hash_not_including(:b => 3).should == {:a => 1, :b => 2}
hash_not_including(:b => 3).should eq({:a => 1, :b => 2})
end

it "matches a hash without the specified key, given as anything()" do
hash_not_including(:c => anything).should == {:a => 1, :b => 2}
hash_not_including(:c => anything).should eq({:a => 1, :b => 2})
end

it "matches an empty hash" do
hash_not_including(:a).should == {}
hash_not_including(:a).should eq({})
end

it "matches a hash without any of the specified keys" do
hash_not_including(:a, :b, :c).should == { :d => 7}
hash_not_including(:a, :b, :c).should eq({ :d => 7})
end

end
Expand Down

0 comments on commit aca59bc

Please sign in to comment.