Skip to content

Commit

Permalink
dev: more "should ==" to "should eq"
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Jul 9, 2011
1 parent a44c83b commit ddbe258
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions spec/autotest/rspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@
let(:spec_file) { "spec/autotest/some_spec.rb" }

it "returns no failures if no failures were given in the output" do
rspec_autotest.consolidate_failures([[]]).should == {}
rspec_autotest.consolidate_failures([[]]).should eq({})
end

it "returns a hash with the spec filename => spec name for each failure or error" do
failures = [ [ "false should be false", spec_file ] ]
rspec_autotest.consolidate_failures(failures).should == {
rspec_autotest.consolidate_failures(failures).should eq({
spec_file => ["false should be false"]
}
})
end

context "when subject file appears before the spec file in the backtrace" do
Expand Down
12 changes: 6 additions & 6 deletions spec/rspec/core/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,31 +245,31 @@ module RSpec::Core

it "assigns the file and line number as a location filter" do
config.files_or_directories_to_run = "path/to/a_spec.rb:37"
config.filter.should == {:locations => {File.expand_path("path/to/a_spec.rb") => [37]}}
config.filter.should eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
end

it "assigns multiple files with line numbers as location filters" do
config.files_or_directories_to_run = "path/to/a_spec.rb:37", "other_spec.rb:44"
config.filter.should == {:locations => {File.expand_path("path/to/a_spec.rb") => [37],
File.expand_path("other_spec.rb") => [44]}}
config.filter.should eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37],
File.expand_path("other_spec.rb") => [44]}})
end

it "assigns files with multiple line numbers as location filters" do
config.files_or_directories_to_run = "path/to/a_spec.rb:37", "path/to/a_spec.rb:44"
config.filter.should == {:locations => {File.expand_path("path/to/a_spec.rb") => [37, 44]}}
config.filter.should eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37, 44]}})
end
end

context "with multiple line numbers" do
it "assigns the file and line numbers as a location filter" do
config.files_or_directories_to_run = "path/to/a_spec.rb:1:3:5:7"
config.filter.should == {:locations => {File.expand_path("path/to/a_spec.rb") => [1,3,5,7]}}
config.filter.should eq({:locations => {File.expand_path("path/to/a_spec.rb") => [1,3,5,7]}})
end
end

it "assigns the example name as the filter on description" do
config.full_description = "foo"
config.filter.should == {:full_description => /foo/}
config.filter.should eq({:full_description => /foo/})
end

describe "#default_path" do
Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/core/deprecations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

it "returns RSpec" do
RSpec.stub(:warn_deprecation)
Spec.should == RSpec
Spec.should eq RSpec
end

it "doesn't include backward compatibility in const_missing backtrace" do
Expand All @@ -32,7 +32,7 @@

it "delegates to example" do
RSpec.stub(:warn_deprecation)
running_example.should == example
running_example.should eq example
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def assert(val)

describe '#described_class' do
it "returns the class (if any) of the outermost example group" do
described_class.should == RSpec::Core::Example
described_class.should eq RSpec::Core::Example
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/formatters/base_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
end

it "removes lines from rspec and lines that come before the invocation of the at_exit autorun hook" do
formatter.format_backtrace(backtrace, stub.as_null_object).should == ["./my_spec.rb:5"]
formatter.format_backtrace(backtrace, stub.as_null_object).should eq ["./my_spec.rb:5"]
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/formatters/snippet_extractor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Core
module Formatters
describe SnippetExtractor do
it "falls back on a default message when it doesn't understand a line" do
RSpec::Core::Formatters::SnippetExtractor.new.snippet_for("blech").should == ["# Couldn't get snippet for blech", 1]
RSpec::Core::Formatters::SnippetExtractor.new.snippet_for("blech").should eq(["# Couldn't get snippet for blech", 1])
end

it "falls back on a default message when it doesn't find the file" do
Expand Down
18 changes: 9 additions & 9 deletions spec/rspec/core/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ module Core
it "passes the metadata hash as the second argument if a given proc expects 2 args" do
passed_metadata = nil
example_metadata.apply_filter(:if, lambda { |v, m| passed_metadata = m })
passed_metadata.should == example_metadata
passed_metadata.should eq example_metadata
end
end

Expand All @@ -148,15 +148,15 @@ module Core
end

it "creates an empty execution result" do
mfe[:execution_result].should == {}
mfe[:execution_result].should eq({})
end

it "extracts file path from caller" do
mfe[:file_path].should == __FILE__
mfe[:file_path].should eq __FILE__
end

it "extracts line number from caller" do
mfe[:line_number].should == line_number
mfe[:line_number].should eq line_number
end

it "extracts location from caller" do
Expand Down Expand Up @@ -311,27 +311,27 @@ module Core
"./lib/rspec/core/foo.rb",
"#{__FILE__}:#{__LINE__}"
])
m[:example_group][:file_path].should == __FILE__
m[:example_group][:file_path].should eq __FILE__
end
end

describe ":line_number" do
it "finds the line number with the first non-rspec lib file in the backtrace" do
m = Metadata.new
m.process({})
m[:example_group][:line_number].should == __LINE__ - 1
m[:example_group][:line_number].should eq(__LINE__ - 1)
end

it "finds the line number with the first spec file with drive letter" do
m = Metadata.new
m.process(:caller => [ "C:/path/to/file_spec.rb:#{__LINE__}" ])
m[:example_group][:line_number].should == __LINE__ - 1
m[:example_group][:line_number].should eq(__LINE__ - 1)
end

it "uses the number after the first : for ruby 1.9" do
m = Metadata.new
m.process(:caller => [ "#{__FILE__}:#{__LINE__}:999" ])
m[:example_group][:line_number].should == __LINE__ - 1
m[:example_group][:line_number].should eq(__LINE__ - 1)
end
end

Expand All @@ -343,7 +343,7 @@ module Core
child = Metadata.new(parent)
child.process()

child[:example_group][:example_group].should == parent[:example_group]
child[:example_group][:example_group].should eq parent[:example_group]
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/reporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module RSpec::Core

group.run(Reporter.new(formatter))

order.should == [
order.should eq [
"Started: root",
"Started: context 1",
"Finished: context 1",
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/shared_example_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def self.foo; end
end
group.run

passed_params.should == { :param1 => :value1, :param2 => :value2 }
passed_params.should eq({ :param1 => :value1, :param2 => :value2 })
end

it "adds shared instance methods to nested group" do
Expand Down
10 changes: 5 additions & 5 deletions spec/rspec/core/subject_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ module RSpec::Core
describe "implicit subject" do
describe "with a class" do
it "returns an instance of the class" do
ExampleGroup.describe(Array).subject.call.should == []
ExampleGroup.describe(Array).subject.call.should eq []
end
end

describe "with a Module" do
it "returns the Module" do
ExampleGroup.describe(Enumerable).subject.call.should == Enumerable
ExampleGroup.describe(Enumerable).subject.call.should eq Enumerable
end
end

Expand Down Expand Up @@ -56,7 +56,7 @@ module RSpec::Core
it "replaces the implicit subject in that group" do
group = ExampleGroup.describe(Array)
group.subject { [1,2,3] }
group.subject.call.should == [1,2,3]
group.subject.call.should eq [1,2,3]
end
end

Expand All @@ -69,13 +69,13 @@ module RSpec::Core

it "is available in a nested group (subclass)" do
nested_group = group.describe("I'm nested!") { }
nested_group.subject.call.should == [4,5,6]
nested_group.subject.call.should eq [4,5,6]
end

it "is available in a doubly nested group (subclass)" do
nested_group = group.describe("Nesting level 1") { }
doubly_nested_group = nested_group.describe("Nesting level 2") { }
doubly_nested_group.subject.call.should == [4,5,6]
doubly_nested_group.subject.call.should eq [4,5,6]
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

it "yields the current configuration" do
RSpec.configure do |config|
config.should == RSpec::configuration
config.should eq RSpec::configuration
end
end

Expand Down

0 comments on commit ddbe258

Please sign in to comment.