Skip to content

Commit

Permalink
Fix RSpec deprecations in self-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shepmaster committed Jun 8, 2014
1 parent 4c8f1bc commit 555574d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion acceptance/cucumber/step_definitions/development_steps.rb
Expand Up @@ -23,7 +23,7 @@
end

Given /^I don't bother writing cucumber features$/ do
false.should be_true
false.should be true
end

Then /^I should be fired$/ do
Expand Down
6 changes: 3 additions & 3 deletions acceptance/rspec_example_spec.rb
Expand Up @@ -6,19 +6,19 @@

describe "RSpec example" do
it "should succeed" do
true.should be_true
true.should be true
nil.should be_nil
end

it "should fail" do
true.should be_false
true.should be false
end

it "should be pending"

describe "nested" do
it "should succeed" do
true.should be_true
true.should be true
end
end
end
Expand Up @@ -16,7 +16,7 @@ class Spinach::Features::ExampleSpinachFeature < Spinach::FeatureSteps
end

step 'I don\'t bother writing cucumber features' do
false.should be_true
false.should be true
end

step 'I should be fired' do
Expand Down
12 changes: 6 additions & 6 deletions spec/ci/reporter/report_manager_spec.rb
Expand Up @@ -17,14 +17,14 @@

it "should create the report directory according to the given prefix" do
CI::Reporter::ReportManager.new("spec")
File.directory?(@reports_dir).should be_true
File.directory?(@reports_dir).should be true
end

it "should create the report directory based on CI_REPORTS environment variable if set" do
@reports_dir = "#{Dir.getwd}/dummy"
ENV["CI_REPORTS"] = @reports_dir
CI::Reporter::ReportManager.new("spec")
File.directory?(@reports_dir).should be_true
File.directory?(@reports_dir).should be true
end

it "should write reports based on name and xml content of a test suite" do
Expand All @@ -34,7 +34,7 @@
suite.should_receive(:to_xml).and_return("<xml></xml>")
reporter.write_report(suite)
filename = "#{REPORTS_DIR}/SPEC-some-test-suite-name.xml"
File.exist?(filename).should be_true
File.exist?(filename).should be true
File.open(filename) {|f| f.read.should == "<xml></xml>"}
end

Expand All @@ -47,7 +47,7 @@
reporter.write_report(suite)
filename = "#{REPORTS_DIR}/SPEC-#{very_long_name}"[0..CI::Reporter::ReportManager::MAX_FILENAME_SIZE].gsub(/\s/, '-') + ".xml"
filename.length.should be <= 255
File.exist?(filename).should be_true
File.exist?(filename).should be true
File.open(filename) {|f| f.read.should == "<xml></xml>"}
end

Expand All @@ -61,7 +61,7 @@
reporter.write_report(suite)
filename = "#{REPORTS_DIR}/SPEC-#{very_long_name}"[0..170].gsub(/\s/, '-') + ".xml"
filename.length.should be <= 188
File.exist?(filename).should be_true
File.exist?(filename).should be true
File.open(filename) {|f| f.read.should == "<xml></xml>"}
end

Expand All @@ -74,6 +74,6 @@
suite.should_receive(:name).and_return("colliding test suite name")
suite.should_receive(:to_xml).and_return("<xml></xml>")
reporter.write_report(suite)
File.exist?(filename.sub('.xml', '.0.xml')).should be_true
File.exist?(filename.sub('.xml', '.0.xml')).should be true
end
end
4 changes: 2 additions & 2 deletions spec/ci/reporter/rspec_spec.rb
Expand Up @@ -44,7 +44,7 @@ def rspec2_failing_example(exception_text)
end

it "should create a test suite with one success, one failure, and one pending" do
@report_mgr.should_receive(:write_report).and_return do |suite|
@report_mgr.should_receive(:write_report) do |suite|
suite.testcases.length.should == 3
suite.testcases[0].should_not be_failure
suite.testcases[0].should_not be_error
Expand Down Expand Up @@ -95,7 +95,7 @@ def rspec2_failing_example(exception_text)
@formatter.should_receive(:example_passed).once
@formatter.should_receive(:dump_summary)
@formatter.should_receive(:dump_failures).once
@report_mgr.should_receive(:write_report).and_return do |suite|
@report_mgr.should_receive(:write_report) do |suite|
suite.testcases.last.name.should == "should do something"
end

Expand Down
14 changes: 7 additions & 7 deletions spec/ci/reporter/test_unit_spec.rb
Expand Up @@ -14,7 +14,7 @@

it "should build suites based on adjacent tests with the same class name" do
@suite = nil
@report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
@report_mgr.should_receive(:write_report).once {|suite| @suite = suite }

@testunit.started(@result)
@testunit.test_started("test_one(TestCaseClass)")
Expand All @@ -35,7 +35,7 @@

it "should build two suites when encountering different class names" do
@suites = []
@report_mgr.should_receive(:write_report).twice.and_return {|suite| @suites << suite }
@report_mgr.should_receive(:write_report).twice {|suite| @suites << suite }

@testunit.started(@result)
@testunit.test_started("test_one(TestCaseClass)")
Expand All @@ -57,7 +57,7 @@

it "should record assertion counts during test run" do
@suite = nil
@report_mgr.should_receive(:write_report).and_return {|suite| @suite = suite }
@report_mgr.should_receive(:write_report) {|suite| @suite = suite }

@testunit.started(@result)
@testunit.test_started("test_one(TestCaseClass)")
Expand All @@ -72,7 +72,7 @@
@failure = Test::Unit::Failure.new("test_one(TestCaseClass)", "somewhere:10", "it failed")

@suite = nil
@report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
@report_mgr.should_receive(:write_report).once {|suite| @suite = suite }

@testunit.started(@result)
@testunit.test_started("test_one(TestCaseClass)")
Expand All @@ -94,7 +94,7 @@
end

@suite = nil
@report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
@report_mgr.should_receive(:write_report).once {|suite| @suite = suite }

@testunit.started(@result)
@testunit.test_started("test_one(TestCaseClass)")
Expand All @@ -119,7 +119,7 @@
@failure2 = Test::Unit::Failure.new("test_one(TestCaseClass)", "somewhere:12", "it failed again in teardown")

@suite = nil
@report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
@report_mgr.should_receive(:write_report).once {|suite| @suite = suite }

@testunit.started(@result)
@testunit.test_started("test_one(TestCaseClass)")
Expand All @@ -138,7 +138,7 @@

it "should count test case names that don't conform to the standard pattern" do
@suite = nil
@report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
@report_mgr.should_receive(:write_report).once {|suite| @suite = suite }

@testunit.started(@result)
@testunit.test_started("some unknown test")
Expand Down

0 comments on commit 555574d

Please sign in to comment.