Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 9189a22

Browse files
committed
more warning reduction
1 parent 0f55f0f commit 9189a22

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed

spec/rspec/core/example_spec.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,15 @@ def assert(val)
200200
after(:each) { @after_each = :after_each }
201201
after(:all) { @after_all = :after_all }
202202
end
203-
example = group.example("does something") do
204-
@in_example = :in_example
203+
group.example("does something") do
204+
@before_all.should eq :before_all
205+
@before_each.should eq :before_each
205206
end
206-
example_group_instance = group.new
207-
example.run(example_group_instance, double('reporter').as_null_object)
208-
209-
%w[@before_all @before_each @after_each @after_all].each do |ivar|
210-
example_group_instance.instance_variable_get(ivar).should be_nil
207+
group.run(double.as_null_object).should be_true
208+
group.new do |example|
209+
%w[@before_all @before_each @after_each @after_all].each do |ivar|
210+
example.instance_variable_get(ivar).should be_nil
211+
end
211212
end
212213
end
213214

spec/rspec/core/formatters/html_formatter_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Formatters
2222
err, out = StringIO.new, StringIO.new
2323
command_line = RSpec::Core::CommandLine.new(options)
2424
command_line.run(err, out)
25-
out.string.gsub /\d+\.\d+ seconds/, 'x seconds'
25+
out.string.gsub(/\d+\.\d+ seconds/, 'x seconds')
2626
end
2727

2828
let(:expected_html) do
@@ -65,13 +65,13 @@ def extract_backtrace_from(doc)
6565
expected_backtraces = extract_backtrace_from(expected_doc)
6666
expected_doc.search("div.backtrace").remove
6767

68-
actual_doc.inner_html.should == expected_doc.inner_html
68+
actual_doc.inner_html.should eq(expected_doc.inner_html)
6969

7070
expected_backtraces.each_with_index do |expected_line, i|
7171
expected_path, expected_line_number, expected_suffix = expected_line.split(':')
7272
actual_path, actual_line_number, actual_suffix = actual_backtraces[i].split(':')
73-
File.expand_path(actual_path).should == File.expand_path(expected_path)
74-
actual_line_number.should == expected_line_number
73+
File.expand_path(actual_path).should eq(File.expand_path(expected_path))
74+
actual_line_number.should eq(expected_line_number)
7575
end
7676
end
7777
end

spec/rspec/core/formatters/text_mate_formatter_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Formatters
2222
err, out = StringIO.new, StringIO.new
2323
command_line = RSpec::Core::CommandLine.new(options)
2424
command_line.run(err, out)
25-
out.string.gsub /\d+\.\d+ seconds/, 'x seconds'
25+
out.string.gsub(/\d+\.\d+ seconds/, 'x seconds')
2626

2727
end
2828

@@ -58,7 +58,7 @@ module Formatters
5858
expected_doc = Nokogiri::HTML(expected_html)
5959
expected_doc.search("div.backtrace").remove
6060

61-
actual_doc.inner_html.should == expected_doc.inner_html
61+
actual_doc.inner_html.should eq(expected_doc.inner_html)
6262

6363
backtrace_lines.each do |backtrace_line|
6464
backtrace_line['href'].should include("txmt://open?url=")

spec/rspec/core/hooks_filtering_spec.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ module RSpec::Core
1515
group = ExampleGroup.describe
1616
group.example("example") {}
1717
group.run
18-
filters.should == [
18+
filters.should eq([
1919
"before all in config",
2020
"around each in config",
2121
"before each in config",
2222
"after each in config",
2323
"after all in config"
24-
]
24+
])
2525
end
2626
end
2727

@@ -38,11 +38,11 @@ module RSpec::Core
3838
group = ExampleGroup.describe(:match => true)
3939
group.example("example") {}
4040
group.run
41-
filters.should == [
41+
filters.should eq([
4242
"around each in config",
4343
"before each in config",
4444
"after each in config"
45-
]
45+
])
4646
end
4747
end
4848

@@ -58,13 +58,13 @@ module RSpec::Core
5858
group = ExampleGroup.describe(:match => true)
5959
group.example("example") {}
6060
group.run
61-
filters.should == [
61+
filters.should eq([
6262
"before all in config",
6363
"around each in config",
6464
"before each in config",
6565
"after each in config",
6666
"after all in config"
67-
]
67+
])
6868
end
6969

7070
it "runs before|after :all hooks on matching nested example groups" do
@@ -85,8 +85,8 @@ module RSpec::Core
8585
group.run
8686

8787
example_1_filters.should be_empty
88-
example_2_filters.should == [:before_all]
89-
filters.should == [:before_all, :after_all]
88+
example_2_filters.should eq([:before_all])
89+
filters.should eq([:before_all, :after_all])
9090
end
9191

9292
it "runs before|after :all hooks only on the highest level group that matches the filter" do
@@ -109,11 +109,11 @@ module RSpec::Core
109109
end
110110
group.run
111111

112-
example_1_filters.should == [:before_all]
113-
example_2_filters.should == [:before_all]
114-
example_3_filters.should == [:before_all]
112+
example_1_filters.should eq [:before_all]
113+
example_2_filters.should eq [:before_all]
114+
example_3_filters.should eq [:before_all]
115115

116-
filters.should == [:before_all, :after_all]
116+
filters.should eq [:before_all, :after_all]
117117
end
118118

119119
it "should not be ran if the filter doesn't match the example group's filter" do
@@ -128,7 +128,7 @@ module RSpec::Core
128128
group = ExampleGroup.describe(:match => true)
129129
group.example("example") {}
130130
group.run
131-
filters.should == []
131+
filters.should eq []
132132
end
133133

134134
context "when the hook filters apply to individual examples instead of example groups" do
@@ -164,7 +164,7 @@ def filters
164164
let(:example_metadata) { { :foo => :bar } }
165165

166166
it "runs the `:each` hooks" do
167-
each_filters.should == [
167+
each_filters.should eq [
168168
'around each in config',
169169
'before each in config',
170170
'after each in config'
@@ -199,7 +199,7 @@ def filters
199199
group = ExampleGroup.describe(:one => 1, :two => 2, :three => 3)
200200
group.example("example") {}
201201
group.run
202-
filters.should == [
202+
filters.should eq [
203203
"before all in config",
204204
"around each in config",
205205
"before each in config",
@@ -220,7 +220,7 @@ def filters
220220
group = ExampleGroup.describe(:one => 1, :two => 2, :three => 3)
221221
group.example("example") {}
222222
group.run
223-
filters.should == []
223+
filters.should eq []
224224
end
225225
end
226226
end

0 commit comments

Comments
 (0)