Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #765 from rspec/new_expect_syntax

Switch to the new `expect` syntax.
  • Loading branch information...
commit 6a54bf8ac66402f44eb8fbb840ff87c871f7194b 2 parents 3b1fd5f + 5c35b2d
alindeman alindeman authored
Showing with 1,703 additions and 2,081 deletions.
  1. +4 −4 spec/autotest/failed_results_re_spec.rb
  2. +20 −21 spec/autotest/rspec_spec.rb
  3. +21 −21 spec/command_line/order_spec.rb
  4. +6 −6 spec/rspec/core/command_line_spec.rb
  5. +73 −74 spec/rspec/core/configuration_options_spec.rb
  6. +155 −160 spec/rspec/core/configuration_spec.rb
  7. +4 −4 spec/rspec/core/deprecations_spec.rb
  8. +9 −9 spec/rspec/core/drb_command_line_spec.rb
  9. +46 −33 spec/rspec/core/drb_options_spec.rb
  10. +3 −3 spec/rspec/core/dsl_spec.rb
  11. +123 −123 spec/rspec/core/example_group_spec.rb
  12. +52 −52 spec/rspec/core/example_spec.rb
  13. +36 −36 spec/rspec/core/filter_manager_spec.rb
  14. +9 −9 spec/rspec/core/formatters/base_formatter_spec.rb
  15. +46 −46 spec/rspec/core/formatters/base_text_formatter_spec.rb
  16. +4 −4 spec/rspec/core/formatters/documentation_formatter_spec.rb
  17. +13 −13 spec/rspec/core/formatters/helpers_spec.rb
  18. +5 −17 spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html
  19. +159 −44 spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html
  20. +14 −14 spec/rspec/core/formatters/html_formatted-1.8.7.html
  21. +0 −410 spec/rspec/core/formatters/html_formatted-1.9.2-jruby.html
  22. +20 −20 spec/rspec/core/formatters/html_formatted-1.9.2.html
  23. +5 −5 spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html
  24. +159 −44 spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html
  25. +20 −20 spec/rspec/core/formatters/html_formatted-1.9.3.html
  26. +2 −2 spec/rspec/core/formatters/html_formatted-2.0.0.html
  27. +8 −4 spec/rspec/core/formatters/html_formatter_spec.rb
  28. +9 −9 spec/rspec/core/formatters/json_formatter_spec.rb
  29. +4 −4 spec/rspec/core/formatters/progress_formatter_spec.rb
  30. +3 −3 spec/rspec/core/formatters/snippet_extractor_spec.rb
  31. +5 −17 spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html
  32. +159 −44 spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html
  33. +16 −16 spec/rspec/core/formatters/text_mate_formatted-1.8.7.html
  34. +0 −410 spec/rspec/core/formatters/text_mate_formatted-1.9.2-jruby.html
  35. +23 −23 spec/rspec/core/formatters/text_mate_formatted-1.9.2.html
  36. +5 −17 spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html
  37. +159 −44 spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html
  38. +23 −23 spec/rspec/core/formatters/text_mate_formatted-1.9.3.html
  39. +23 −23 spec/rspec/core/formatters/text_mate_formatted-2.0.0.html
  40. +8 −4 spec/rspec/core/formatters/text_mate_formatter_spec.rb
  41. +16 −16 spec/rspec/core/hooks_filtering_spec.rb
  42. +11 −11 spec/rspec/core/hooks_spec.rb
  43. +1 −1  spec/rspec/core/kernel_extensions_spec.rb
  44. +6 −6 spec/rspec/core/let_spec.rb
  45. +74 −74 spec/rspec/core/metadata_spec.rb
  46. +27 −27 spec/rspec/core/option_parser_spec.rb
  47. +32 −32 spec/rspec/core/pending_example_spec.rb
  48. +8 −8 spec/rspec/core/project_initializer_spec.rb
  49. +16 −16 spec/rspec/core/rake_task_spec.rb
  50. +3 −3 spec/rspec/core/reporter_spec.rb
  51. +4 −4 spec/rspec/core/resources/formatter_specs.rb
  52. +2 −2 spec/rspec/core/ruby_project_spec.rb
  53. +7 −7 spec/rspec/core/shared_context_spec.rb
  54. +14 −14 spec/rspec/core/shared_example_group_spec.rb
  55. +5 −5 spec/rspec/core/subject_spec.rb
  56. +9 −9 spec/rspec/core/world_spec.rb
  57. +5 −5 spec/rspec/core_spec.rb
  58. +4 −0 spec/spec_helper.rb
  59. +4 −4 spec/support/shared_example_groups.rb
  60. +2 −2 spec/support/spec_files.rb
8 spec/autotest/failed_results_re_spec.rb
View
@@ -16,14 +16,14 @@ def run_example
shared_examples "autotest failed_results_re" do
it "matches a failure" do
output = run_example { fail }
- output.should match(Autotest::Rspec2.new.failed_results_re)
- output.should include(__FILE__.sub(File.expand_path('.'),'.'))
+ expect(output).to match(Autotest::Rspec2.new.failed_results_re)
+ expect(output).to include(__FILE__.sub(File.expand_path('.'),'.'))
end
it "does not match when there are no failures" do
output = run_example { } # pass
- output.should_not match(Autotest::Rspec2.new.failed_results_re)
- output.should_not include(__FILE__.sub(File.expand_path('.'),'.'))
+ expect(output).not_to match(Autotest::Rspec2.new.failed_results_re)
+ expect(output).not_to include(__FILE__.sub(File.expand_path('.'),'.'))
end
end
41 spec/autotest/rspec_spec.rb
View
@@ -11,8 +11,7 @@
it "uses autotest's prefix" do
rspec_autotest.prefix = "this is the prefix "
- rspec_autotest.
- make_test_cmd({'a' => 'b'}).should match(/this is the prefix/)
+ expect(rspec_autotest.make_test_cmd({'a' => 'b'})).to match(/this is the prefix/)
end
describe "commands" do
@@ -30,41 +29,41 @@
it "uses double quotes for windows compatibility" do
command = rspec_autotest.make_test_cmd(@files_to_test)
- command.should include('"')
- command.should_not include("'")
+ expect(command).to include('"')
+ expect(command).not_to include("'")
end
it "makes the appropriate test command" do
actual_command = rspec_autotest.make_test_cmd(@files_to_test)
expected_command = /#{ruby_cmd}.*"#{spec_cmd}" (.*)/
- actual_command.should match(expected_command)
+ expect(actual_command).to match(expected_command)
actual_command =~ expected_command
- $1.should =~ /#{File.expand_path('file_one')}/
- $1.should =~ /#{File.expand_path('file_two')}/
+ expect($1).to match /#{File.expand_path('file_one')}/
+ expect($1).to match /#{File.expand_path('file_two')}/
end
it "returns a blank command for no files" do
- rspec_autotest.make_test_cmd({}).should eq('')
+ expect(rspec_autotest.make_test_cmd({})).to eq('')
end
it "quotes the paths of files to test" do
cmd = rspec_autotest.make_test_cmd(@files_to_test)
@files_to_test.keys.each do |file_to_test|
- cmd.should match(/"#{File.expand_path(file_to_test)}"/)
+ expect(cmd).to match(/"#{File.expand_path(file_to_test)}"/)
end
end
it "quotes the path of the ruby executable" do
cmd = rspec_autotest.make_test_cmd(@files_to_test)
- cmd.should match(%r("/path/to/ruby"))
+ expect(cmd).to match(%r("/path/to/ruby"))
end
it "gives '--tty' to #{Autotest::Rspec2::RSPEC_EXECUTABLE}, not '--autotest'" do
cmd = rspec_autotest.make_test_cmd(@files_to_test)
- cmd.should match(' --tty ')
- cmd.should_not match(' --autotest ')
+ expect(cmd).to match(' --tty ')
+ expect(cmd).not_to match(' --autotest ')
end
end
@@ -76,19 +75,19 @@
end
it "finds the spec file for a given lib file" do
- rspec_autotest.should map_specs([@spec_file]).to(@lib_file)
+ expect(rspec_autotest).to map_specs([@spec_file]).to(@lib_file)
end
it "finds the spec file if given a spec file" do
- rspec_autotest.should map_specs([@spec_file]).to(@spec_file)
+ expect(rspec_autotest).to map_specs([@spec_file]).to(@spec_file)
end
it "ignores files in spec dir that aren't specs" do
- rspec_autotest.should map_specs([]).to("spec/spec_helper.rb")
+ expect(rspec_autotest).to map_specs([]).to("spec/spec_helper.rb")
end
it "ignores untracked files (in @file)" do
- rspec_autotest.should map_specs([]).to("lib/untracked_file")
+ expect(rspec_autotest).to map_specs([]).to("lib/untracked_file")
end
end
@@ -97,12 +96,12 @@
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 eq({})
+ expect(rspec_autotest.consolidate_failures([[]])).to 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 eq({
+ expect(rspec_autotest.consolidate_failures(failures)).to eq({
spec_file => ["false should be false"]
})
end
@@ -113,11 +112,11 @@
end
it "excludes the subject file" do
- rspec_autotest.consolidate_failures(failures).keys.should_not include(subject_file)
+ expect(rspec_autotest.consolidate_failures(failures).keys).not_to include(subject_file)
end
it "includes the spec file" do
- rspec_autotest.consolidate_failures(failures).keys.should include(spec_file)
+ expect(rspec_autotest.consolidate_failures(failures).keys).to include(spec_file)
end
end
end
@@ -128,7 +127,7 @@
['filename.rb', './filename.rb', File.expand_path('filename.rb')].each do |file|
@files_to_test[file] = []
end
- rspec_autotest.normalize(@files_to_test).should have(1).file
+ expect(rspec_autotest.normalize(@files_to_test)).to have(1).file
end
end
end
42 spec/command_line/order_spec.rb
View
@@ -87,12 +87,12 @@
RSpec.configuration.seed = srand && srand # reset seed in same process
run_command 'tmp/aruba/spec/order_spec.rb --order rand -f doc'
- stdout.string.should match(/Randomized with seed \d+/)
+ expect(stdout.string).to match(/Randomized with seed \d+/)
- top_level_groups {|first_run, second_run| first_run.should_not eq(second_run)}
- nested_groups {|first_run, second_run| first_run.should_not eq(second_run)}
- examples('group 1') {|first_run, second_run| first_run.should_not eq(second_run)}
- examples('group 1-1') {|first_run, second_run| first_run.should_not eq(second_run)}
+ top_level_groups {|first_run, second_run| expect(first_run).to_not eq(second_run)}
+ nested_groups {|first_run, second_run| expect(first_run).to_not eq(second_run)}
+ examples('group 1') {|first_run, second_run| expect(first_run).to_not eq(second_run)}
+ examples('group 1-1') {|first_run, second_run| expect(first_run).to_not eq(second_run)}
end
end
@@ -100,12 +100,12 @@
it 'runs the examples and groups in the same order each time' do
2.times { run_command 'tmp/aruba/spec/order_spec.rb --order rand:123 -f doc' }
- stdout.string.should match(/Randomized with seed 123/)
+ expect(stdout.string).to match(/Randomized with seed 123/)
- top_level_groups {|first_run, second_run| first_run.should eq(second_run)}
- nested_groups {|first_run, second_run| first_run.should eq(second_run)}
- examples('group 1') {|first_run, second_run| first_run.should eq(second_run)}
- examples('group 1-1') {|first_run, second_run| first_run.should eq(second_run)}
+ top_level_groups {|first_run, second_run| expect(first_run).to eq(second_run)}
+ nested_groups {|first_run, second_run| expect(first_run).to eq(second_run)}
+ examples('group 1') {|first_run, second_run| expect(first_run).to eq(second_run)}
+ examples('group 1-1') {|first_run, second_run| expect(first_run).to eq(second_run)}
end
end
@@ -113,20 +113,20 @@
it "forces '--order rand' and runs the examples and groups in the same order each time" do
2.times { run_command 'tmp/aruba/spec/order_spec.rb --seed 123 -f doc' }
- stdout.string.should match(/Randomized with seed \d+/)
+ expect(stdout.string).to match(/Randomized with seed \d+/)
- top_level_groups {|first_run, second_run| first_run.should eq(second_run)}
- nested_groups {|first_run, second_run| first_run.should eq(second_run)}
- examples('group 1') {|first_run, second_run| first_run.should eq(second_run)}
- examples('group 1-1') {|first_run, second_run| first_run.should eq(second_run)}
+ top_level_groups {|first_run, second_run| expect(first_run).to eq(second_run)}
+ nested_groups {|first_run, second_run| expect(first_run).to eq(second_run)}
+ examples('group 1') {|first_run, second_run| expect(first_run).to eq(second_run)}
+ examples('group 1-1') {|first_run, second_run| expect(first_run).to eq(second_run)}
end
it "runs examples in the same order, regardless of the order in which files are given" do
run_command 'tmp/aruba/spec/simple_spec.rb tmp/aruba/spec/simple_spec2.rb --seed 1337 -f doc'
run_command 'tmp/aruba/spec/simple_spec2.rb tmp/aruba/spec/simple_spec.rb --seed 1337 -f doc'
- top_level_groups {|first_run, second_run| first_run.should eq(second_run)}
- nested_groups {|first_run, second_run| first_run.should eq(second_run)}
+ top_level_groups {|first_run, second_run| expect(first_run).to eq(second_run)}
+ nested_groups {|first_run, second_run| expect(first_run).to eq(second_run)}
end
end
@@ -136,9 +136,9 @@
run_command 'tmp/aruba/spec/order_spec.rb --order default -f doc'
- stdout.string.should_not match(/Randomized/)
+ expect(stdout.string).not_to match(/Randomized/)
- stdout.string.should match(
+ expect(stdout.string).to match(
/group 1.*group 1 example 1.*group 1 example 2.*group 1-1.*group 1-2.*group 2.*/m
)
end
@@ -169,10 +169,10 @@
it 'orders the groups and examples by the provided strategy' do
run_command 'tmp/aruba/spec/custom_order_spec.rb -f doc'
- top_level_groups { |groups| groups.flatten.should eq(['group A', 'group B']) }
+ top_level_groups { |groups| expect(groups.flatten).to eq(['group A', 'group B']) }
examples('group B') do |examples|
letters = examples.flatten.map { |e| e[/(.)\z/, 1] }
- letters.should eq(['A', 'B', 'C', 'D'])
+ expect(letters).to eq(['A', 'B', 'C', 'D'])
end
end
end
12 spec/rspec/core/command_line_spec.rb
View
@@ -27,13 +27,13 @@ module RSpec::Core
it "assigns ConfigurationOptions built from Array of options to @options" do
config_options = ConfigurationOptions.new(%w[--color])
command_line = CommandLine.new(%w[--color])
- command_line.instance_eval { @options.options }.should eq(config_options.parse_options)
+ expect(command_line.instance_eval { @options.options }).to eq(config_options.parse_options)
end
it "assigns submitted ConfigurationOptions to @options" do
config_options = ConfigurationOptions.new(%w[--color])
command_line = CommandLine.new(config_options)
- command_line.instance_eval { @options }.should be(config_options)
+ expect(command_line.instance_eval { @options }).to be(config_options)
end
describe "#run" do
@@ -42,17 +42,17 @@ module RSpec::Core
it "returns 0 if spec passes" do
command_line = build_command_line passing_spec_filename
- command_line.run(err, out).should eq 0
+ expect(command_line.run(err, out)).to eq 0
end
it "returns 1 if spec fails" do
command_line = build_command_line failing_spec_filename
- command_line.run(err, out).should eq 1
+ expect(command_line.run(err, out)).to eq 1
end
it "returns 2 if spec fails and --failure-exit-code is 2" do
command_line = build_command_line failing_spec_filename, "--failure-exit-code", "2"
- command_line.run(err, out).should eq 2
+ expect(command_line.run(err, out)).to eq 2
end
end
@@ -91,7 +91,7 @@ module RSpec::Core
config.output_stream = output_file
command_line = build_command_line
command_line.run err, out
- command_line.instance_eval { @configuration.output_stream }.should eq output_file
+ expect(command_line.instance_eval { @configuration.output_stream }).to eq output_file
end
end
147 spec/rspec/core/configuration_options_spec.rb
View
@@ -50,14 +50,14 @@
opts = config_options_object(*%w[--tag awesome])
config = RSpec::Core::Configuration.new
opts.configure(config)
- config.inclusion_filter.should have_key(:awesome)
+ expect(config.inclusion_filter).to have_key(:awesome)
end
it "merges the :exclusion_filter option with the default exclusion_filter" do
opts = config_options_object(*%w[--tag ~slow])
config = RSpec::Core::Configuration.new
opts.configure(config)
- config.exclusion_filter.should have_key(:slow)
+ expect(config.exclusion_filter).to have_key(:slow)
end
it "forces color_enabled" do
@@ -80,8 +80,8 @@
opts = config_options_object(*[cli_option, cli_value].compact)
config = RSpec::Core::Configuration.new
config.should_receive(:force) do |pair|
- pair.keys.first.should eq(config_key)
- pair.values.first.should eq(config_value)
+ expect(pair.keys.first).to eq(config_key)
+ expect(pair.values.first).to eq(config_value)
end
opts.configure(config)
end
@@ -115,203 +115,203 @@
describe "-c, --color, and --colour" do
it "sets :color => true" do
- parse_options('-c').should include(:color => true)
- parse_options('--color').should include(:color => true)
- parse_options('--colour').should include(:color => true)
+ expect(parse_options('-c')).to include(:color => true)
+ expect(parse_options('--color')).to include(:color => true)
+ expect(parse_options('--colour')).to include(:color => true)
end
end
describe "--no-color" do
it "sets :color => false" do
- parse_options('--no-color').should include(:color => false)
+ expect(parse_options('--no-color')).to include(:color => false)
end
it "overrides previous :color => true" do
- parse_options('--color', '--no-color').should include(:color => false)
+ expect(parse_options('--color', '--no-color')).to include(:color => false)
end
it "gets overriden by a subsequent :color => true" do
- parse_options('--no-color', '--color').should include(:color => true)
+ expect(parse_options('--no-color', '--color')).to include(:color => true)
end
end
describe "-I" do
example "adds to :libs" do
- parse_options('-I', 'a_dir').should include(:libs => ['a_dir'])
+ expect(parse_options('-I', 'a_dir')).to include(:libs => ['a_dir'])
end
example "can be used more than once" do
- parse_options('-I', 'dir_1', '-I', 'dir_2').should include(:libs => ['dir_1','dir_2'])
+ expect(parse_options('-I', 'dir_1', '-I', 'dir_2')).to include(:libs => ['dir_1','dir_2'])
end
end
describe '--require' do
example "requires files" do
- parse_options('--require', 'a/path').should include(:requires => ['a/path'])
+ expect(parse_options('--require', 'a/path')).to include(:requires => ['a/path'])
end
example "can be used more than once" do
- parse_options('--require', 'path/1', '--require', 'path/2').should include(:requires => ['path/1','path/2'])
+ expect(parse_options('--require', 'path/1', '--require', 'path/2')).to include(:requires => ['path/1','path/2'])
end
end
describe "--format, -f" do
it "sets :formatter" do
[['--format', 'd'], ['-f', 'd'], '-fd'].each do |args|
- parse_options(*args).should include(:formatters => [['d']])
+ expect(parse_options(*args)).to include(:formatters => [['d']])
end
end
example "can accept a class name" do
- parse_options('-fSome::Formatter::Class').should include(:formatters => [['Some::Formatter::Class']])
+ expect(parse_options('-fSome::Formatter::Class')).to include(:formatters => [['Some::Formatter::Class']])
end
end
describe "--profile, -p" do
it "sets :profile_examples" do
- parse_options('-p').should include(:profile_examples => true)
- parse_options('--profile').should include(:profile_examples => true)
- parse_options('-p', '4').should include(:profile_examples => 4)
- parse_options('--profile', '3').should include(:profile_examples => 3)
+ expect(parse_options('-p')).to include(:profile_examples => true)
+ expect(parse_options('--profile')).to include(:profile_examples => true)
+ expect(parse_options('-p', '4')).to include(:profile_examples => 4)
+ expect(parse_options('--profile', '3')).to include(:profile_examples => 3)
end
end
describe "--no-profile" do
it "sets :profile_examples to false" do
- parse_options('--no-profile').should include(:profile_examples => false)
+ expect(parse_options('--no-profile')).to include(:profile_examples => false)
end
end
describe '--line_number' do
it "sets :line_number" do
- parse_options('-l','3').should include(:line_numbers => ['3'])
- parse_options('--line_number','3').should include(:line_numbers => ['3'])
+ expect(parse_options('-l','3')).to include(:line_numbers => ['3'])
+ expect(parse_options('--line_number','3')).to include(:line_numbers => ['3'])
end
it "can be specified multiple times" do
- parse_options('-l','3', '-l', '6').should include(:line_numbers => ['3', '6'])
- parse_options('--line_number','3', '--line_number', '6').should include(:line_numbers => ['3', '6'])
+ expect(parse_options('-l','3', '-l', '6')).to include(:line_numbers => ['3', '6'])
+ expect(parse_options('--line_number','3', '--line_number', '6')).to include(:line_numbers => ['3', '6'])
end
end
describe "--example" do
it "sets :full_description" do
- parse_options('--example','foo').should include(:full_description => [/foo/])
- parse_options('-e','bar').should include(:full_description => [/bar/])
+ expect(parse_options('--example','foo')).to include(:full_description => [/foo/])
+ expect(parse_options('-e','bar')).to include(:full_description => [/bar/])
end
end
describe "--backtrace, -b" do
it "sets full_backtrace on config" do
- parse_options("--backtrace").should include(:full_backtrace => true)
- parse_options("-b").should include(:full_backtrace => true)
+ expect(parse_options("--backtrace")).to include(:full_backtrace => true)
+ expect(parse_options("-b")).to include(:full_backtrace => true)
end
end
describe "--debug, -d" do
it "sets :debug => true" do
- parse_options("--debug").should include(:debug => true)
- parse_options("-d").should include(:debug => true)
+ expect(parse_options("--debug")).to include(:debug => true)
+ expect(parse_options("-d")).to include(:debug => true)
end
end
describe "--fail-fast" do
it "defaults to false" do
- parse_options[:fail_fast].should be_false
+ expect(parse_options[:fail_fast]).to be_false
end
it "sets fail_fast on config" do
- parse_options("--fail-fast")[:fail_fast].should be_true
+ expect(parse_options("--fail-fast")[:fail_fast]).to be_true
end
end
describe "--failure-exit-code" do
it "sets :failure_exit_code" do
- parse_options('--failure-exit-code', '0').should include(:failure_exit_code => 0)
- parse_options('--failure-exit-code', '1').should include(:failure_exit_code => 1)
- parse_options('--failure-exit-code', '2').should include(:failure_exit_code => 2)
+ expect(parse_options('--failure-exit-code', '0')).to include(:failure_exit_code => 0)
+ expect(parse_options('--failure-exit-code', '1')).to include(:failure_exit_code => 1)
+ expect(parse_options('--failure-exit-code', '2')).to include(:failure_exit_code => 2)
end
it "overrides previous :failure_exit_code" do
- parse_options('--failure-exit-code', '2', '--failure-exit-code', '3').should include(:failure_exit_code => 3)
+ expect(parse_options('--failure-exit-code', '2', '--failure-exit-code', '3')).to include(:failure_exit_code => 3)
end
end
describe "--options" do
it "sets :custom_options_file" do
- parse_options(*%w[-O my.opts]).should include(:custom_options_file => "my.opts")
- parse_options(*%w[--options my.opts]).should include(:custom_options_file => "my.opts")
+ expect(parse_options(*%w[-O my.opts])).to include(:custom_options_file => "my.opts")
+ expect(parse_options(*%w[--options my.opts])).to include(:custom_options_file => "my.opts")
end
end
describe "--drb, -X" do
context "combined with --debug" do
it "turns off the debugger if --drb is specified first" do
- config_options_object("--drb", "--debug").drb_argv.should_not include("--debug")
- config_options_object("--drb", "-d" ).drb_argv.should_not include("--debug")
- config_options_object("-X", "--debug").drb_argv.should_not include("--debug")
- config_options_object("-X", "-d" ).drb_argv.should_not include("--debug")
+ expect(config_options_object("--drb", "--debug").drb_argv).not_to include("--debug")
+ expect(config_options_object("--drb", "-d" ).drb_argv).not_to include("--debug")
+ expect(config_options_object("-X", "--debug").drb_argv).not_to include("--debug")
+ expect(config_options_object("-X", "-d" ).drb_argv).not_to include("--debug")
end
it "turns off the debugger option if --drb is specified later" do
- config_options_object("--debug", "--drb").drb_argv.should_not include("--debug")
- config_options_object("-d", "--drb").drb_argv.should_not include("--debug")
- config_options_object("--debug", "-X" ).drb_argv.should_not include("--debug")
- config_options_object("-d", "-X" ).drb_argv.should_not include("--debug")
+ expect(config_options_object("--debug", "--drb").drb_argv).not_to include("--debug")
+ expect(config_options_object("-d", "--drb").drb_argv).not_to include("--debug")
+ expect(config_options_object("--debug", "-X" ).drb_argv).not_to include("--debug")
+ expect(config_options_object("-d", "-X" ).drb_argv).not_to include("--debug")
end
it "turns off the debugger option if --drb is specified in the options file" do
File.open("./.rspec", "w") {|f| f << "--drb"}
- config_options_object("--debug").drb_argv.should_not include("--debug")
- config_options_object("-d" ).drb_argv.should_not include("--debug")
+ expect(config_options_object("--debug").drb_argv).not_to include("--debug")
+ expect(config_options_object("-d" ).drb_argv).not_to include("--debug")
end
it "turns off the debugger option if --debug is specified in the options file" do
File.open("./.rspec", "w") {|f| f << "--debug"}
- config_options_object("--drb").drb_argv.should_not include("--debug")
- config_options_object("-X" ).drb_argv.should_not include("--debug")
+ expect(config_options_object("--drb").drb_argv).not_to include("--debug")
+ expect(config_options_object("-X" ).drb_argv).not_to include("--debug")
end
end
it "does not send --drb back to the parser after parsing options" do
- config_options_object("--drb", "--color").drb_argv.should_not include("--drb")
+ expect(config_options_object("--drb", "--color").drb_argv).not_to include("--drb")
end
end
describe "--no-drb" do
it "disables drb" do
- parse_options("--no-drb").should include(:drb => false)
+ expect(parse_options("--no-drb")).to include(:drb => false)
end
it "overrides a previous drb => true" do
- parse_options("--drb", "--no-drb").should include(:drb => false)
+ expect(parse_options("--drb", "--no-drb")).to include(:drb => false)
end
it "gets overriden by a subsquent drb => true" do
- parse_options("--no-drb", "--drb").should include(:drb => true)
+ expect(parse_options("--no-drb", "--drb")).to include(:drb => true)
end
end
describe "files_or_directories_to_run" do
it "parses files from '-c file.rb dir/file.rb'" do
- parse_options("-c", "file.rb", "dir/file.rb").should include(
+ expect(parse_options("-c", "file.rb", "dir/file.rb")).to include(
:files_or_directories_to_run => ["file.rb", "dir/file.rb"]
)
end
it "parses dir from 'dir'" do
- parse_options("dir").should include(:files_or_directories_to_run => ["dir"])
+ expect(parse_options("dir")).to include(:files_or_directories_to_run => ["dir"])
end
it "parses dir and files from 'spec/file1_spec.rb, spec/file2_spec.rb'" do
- parse_options("dir", "spec/file1_spec.rb", "spec/file2_spec.rb").should include(
+ expect(parse_options("dir", "spec/file1_spec.rb", "spec/file2_spec.rb")).to include(
:files_or_directories_to_run => ["dir", "spec/file1_spec.rb", "spec/file2_spec.rb"]
)
end
it "provides no files or directories if spec directory does not exist" do
FileTest.stub(:directory?).with("spec").and_return false
- parse_options().should include(:files_or_directories_to_run => [])
+ expect(parse_options()).to include(:files_or_directories_to_run => [])
end
end
@@ -327,8 +327,7 @@
describe "#filter_manager" do
it "returns the same object as RSpec::configuration.filter_manager" do
- config_options_object.filter_manager.
- should be(RSpec::configuration.filter_manager)
+ expect(config_options_object.filter_manager).to be(RSpec::configuration.filter_manager)
end
end
@@ -339,37 +338,37 @@
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--color"}
with_env_vars 'SPEC_OPTS' => "--debug --example 'foo bar'" do
options = parse_options("--drb")
- options[:color].should be_true
- options[:line_numbers].should eq(["37"])
- options[:debug].should be_true
- options[:full_description].should eq([/foo\ bar/])
- options[:drb].should be_true
- options[:formatters].should eq([['global']])
+ expect(options[:color]).to be_true
+ expect(options[:line_numbers]).to eq(["37"])
+ expect(options[:debug]).to be_true
+ expect(options[:full_description]).to eq([/foo\ bar/])
+ expect(options[:drb]).to be_true
+ expect(options[:formatters]).to eq([['global']])
end
end
it "prefers SPEC_OPTS over CLI" do
with_env_vars 'SPEC_OPTS' => "--format spec_opts" do
- parse_options("--format", "cli")[:formatters].should eq([['spec_opts']])
+ expect(parse_options("--format", "cli")[:formatters]).to eq([['spec_opts']])
end
end
it "prefers CLI over file options" do
File.open("./.rspec", "w") {|f| f << "--format project"}
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
- parse_options("--format", "cli")[:formatters].should eq([['cli']])
+ expect(parse_options("--format", "cli")[:formatters]).to eq([['cli']])
end
it "prefers project file options over global file options" do
File.open("./.rspec", "w") {|f| f << "--format project"}
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
- parse_options[:formatters].should eq([['project']])
+ expect(parse_options[:formatters]).to eq([['project']])
end
it "prefers local file options over project file options" do
File.open("./.rspec-local", "w") {|f| f << "--format local"}
File.open("./.rspec", "w") {|f| f << "--format global"}
- parse_options[:formatters].should eq([['local']])
+ expect(parse_options[:formatters]).to eq([['local']])
end
context "with custom options file" do
@@ -378,14 +377,14 @@
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
File.open("./custom.opts", "w") {|f| f << "--color"}
options = parse_options("-O", "./custom.opts")
- options[:format].should be_nil
- options[:color].should be_true
+ expect(options[:format]).to be_nil
+ expect(options[:color]).to be_true
end
it "parses -e 'full spec description'" do
File.open("./custom.opts", "w") {|f| f << "-e 'The quick brown fox jumps over the lazy dog'"}
options = parse_options("-O", "./custom.opts")
- options[:full_description].should eq([/The\ quick\ brown\ fox\ jumps\ over\ the\ lazy\ dog/])
+ expect(options[:full_description]).to eq([/The\ quick\ brown\ fox\ jumps\ over\ the\ lazy\ dog/])
end
end
end
315 spec/rspec/core/configuration_spec.rb
View
@@ -43,12 +43,12 @@ module RSpec::Core
describe "#treat_symbols_as_metadata_keys_with_true_values?" do
it 'defaults to false' do
- config.treat_symbols_as_metadata_keys_with_true_values?.should be_false
+ expect(config.treat_symbols_as_metadata_keys_with_true_values?).to be_false
end
it 'can be set to true' do
config.treat_symbols_as_metadata_keys_with_true_values = true
- config.treat_symbols_as_metadata_keys_with_true_values?.should be_true
+ expect(config.treat_symbols_as_metadata_keys_with_true_values?).to be_true
end
end
@@ -76,16 +76,16 @@ module RSpec::Core
mod_config.custom_setting = true
end
- custom_config.custom_setting.should be_true
+ expect(custom_config.custom_setting).to be_true
end
it "raises if framework module doesn't support configuration" do
mod = Module.new
- lambda do
+ expect {
config.send m, mod do |mod_config|
end
- end.should raise_error(/must respond to `configuration`/)
+ }.to raise_error(/must respond to `configuration`/)
end
end
@@ -117,7 +117,7 @@ module RSpec::Core
it "sets the mock_framework_adapter to that module" do
mod = Module.new
config.mock_with mod
- config.mock_framework.should eq(mod)
+ expect(config.mock_framework).to eq(mod)
end
end
@@ -187,14 +187,14 @@ module RSpec::Core
it "supports multiple calls" do
config.expect_with :rspec
config.expect_with :stdlib
- config.expectation_frameworks.should eq [RSpec::Matchers, Test::Unit::Assertions]
+ expect(config.expectation_frameworks).to eq [RSpec::Matchers, Test::Unit::Assertions]
end
it "raises if block given with multiple args" do
- lambda do
+ expect {
config.expect_with :rspec, :stdlib do |mod_config|
end
- end.should raise_error(/expect_with only accepts/)
+ }.to raise_error(/expect_with only accepts/)
end
it "raises ArgumentError if framework is not supported" do
@@ -234,76 +234,76 @@ module RSpec::Core
end
it "returns false by default" do
- config.should_not be_expecting_with_rspec
+ expect(config).not_to be_expecting_with_rspec
end
it "returns true when `expect_with :rspec` has been configured" do
config.expect_with :rspec
- config.should be_expecting_with_rspec
+ expect(config).to be_expecting_with_rspec
end
it "returns true when `expect_with :rspec, :stdlib` has been configured" do
config.expect_with :rspec, :stdlib
- config.should be_expecting_with_rspec
+ expect(config).to be_expecting_with_rspec
end
it "returns true when `expect_with :stdlib, :rspec` has been configured" do
config.expect_with :stdlib, :rspec
- config.should be_expecting_with_rspec
+ expect(config).to be_expecting_with_rspec
end
it "returns false when `expect_with :stdlib` has been configured" do
config.expect_with :stdlib
- config.should_not be_expecting_with_rspec
+ expect(config).not_to be_expecting_with_rspec
end
end
describe "#files_to_run" do
it "loads files not following pattern if named explicitly" do
config.files_or_directories_to_run = "spec/rspec/core/resources/a_bar.rb"
- config.files_to_run.should eq([ "spec/rspec/core/resources/a_bar.rb"])
+ expect(config.files_to_run).to eq([ "spec/rspec/core/resources/a_bar.rb"])
end
it "prevents repetition of dir when start of the pattern" do
config.pattern = "spec/**/a_spec.rb"
config.files_or_directories_to_run = "spec"
- config.files_to_run.should eq(["spec/rspec/core/resources/a_spec.rb"])
+ expect(config.files_to_run).to eq(["spec/rspec/core/resources/a_spec.rb"])
end
it "does not prevent repetition of dir when later of the pattern" do
config.pattern = "rspec/**/a_spec.rb"
config.files_or_directories_to_run = "spec"
- config.files_to_run.should eq(["spec/rspec/core/resources/a_spec.rb"])
+ expect(config.files_to_run).to eq(["spec/rspec/core/resources/a_spec.rb"])
end
context "with <path>:<line_number>" do
it "overrides inclusion filters set on config" do
config.filter_run_including :foo => :bar
config.files_or_directories_to_run = "path/to/file.rb:37"
- config.inclusion_filter.size.should eq(1)
- config.inclusion_filter[:locations].keys.first.should match(/path\/to\/file\.rb$/)
- config.inclusion_filter[:locations].values.first.should eq([37])
+ expect(config.inclusion_filter.size).to eq(1)
+ expect(config.inclusion_filter[:locations].keys.first).to match(/path\/to\/file\.rb$/)
+ expect(config.inclusion_filter[:locations].values.first).to eq([37])
end
it "overrides inclusion filters set before config" do
config.force(:inclusion_filter => {:foo => :bar})
config.files_or_directories_to_run = "path/to/file.rb:37"
- config.inclusion_filter.size.should eq(1)
- config.inclusion_filter[:locations].keys.first.should match(/path\/to\/file\.rb$/)
- config.inclusion_filter[:locations].values.first.should eq([37])
+ expect(config.inclusion_filter.size).to eq(1)
+ expect(config.inclusion_filter[:locations].keys.first).to match(/path\/to\/file\.rb$/)
+ expect(config.inclusion_filter[:locations].values.first).to eq([37])
end
it "clears exclusion filters set on config" do
config.exclusion_filter = { :foo => :bar }
config.files_or_directories_to_run = "path/to/file.rb:37"
- config.exclusion_filter.should be_empty,
+ expect(config.exclusion_filter).to be_empty,
"expected exclusion filter to be empty:\n#{config.exclusion_filter}"
end
it "clears exclusion filters set before config" do
config.force(:exclusion_filter => { :foo => :bar })
config.files_or_directories_to_run = "path/to/file.rb:37"
- config.exclusion_filter.should be_empty,
+ expect(config.exclusion_filter).to be_empty,
"expected exclusion filter to be empty:\n#{config.exclusion_filter}"
end
end
@@ -311,17 +311,17 @@ module RSpec::Core
context "with default pattern" do
it "loads files named _spec.rb" do
config.files_or_directories_to_run = "spec/rspec/core/resources"
- config.files_to_run.should eq([ "spec/rspec/core/resources/a_spec.rb"])
+ expect(config.files_to_run).to eq([ "spec/rspec/core/resources/a_spec.rb"])
end
it "loads files in Windows", :if => RSpec.windows_os? do
config.files_or_directories_to_run = "C:\\path\\to\\project\\spec\\sub\\foo_spec.rb"
- config.files_to_run.should eq([ "C:/path/to/project/spec/sub/foo_spec.rb"])
+ expect(config.files_to_run).to eq([ "C:/path/to/project/spec/sub/foo_spec.rb"])
end
it "loads files in Windows when directory is specified", :if => RSpec.windows_os? do
config.files_or_directories_to_run = "spec\\rspec\\core\\resources"
- config.files_to_run.should eq([ "spec/rspec/core/resources/a_spec.rb"])
+ expect(config.files_to_run).to eq([ "spec/rspec/core/resources/a_spec.rb"])
end
end
@@ -329,20 +329,20 @@ module RSpec::Core
it "loads files in the default path when run by rspec" do
config.stub(:command) { 'rspec' }
config.files_or_directories_to_run = []
- config.files_to_run.should_not be_empty
+ expect(config.files_to_run).not_to be_empty
end
it "loads files in the default path when run with DRB (e.g., spork)" do
config.stub(:command) { 'spork' }
RSpec::Core::Runner.stub(:running_in_drb?) { true }
config.files_or_directories_to_run = []
- config.files_to_run.should_not be_empty
+ expect(config.files_to_run).not_to be_empty
end
it "does not load files in the default path when run by ruby" do
config.stub(:command) { 'ruby' }
config.files_or_directories_to_run = []
- config.files_to_run.should be_empty
+ expect(config.files_to_run).to be_empty
end
end
@@ -359,7 +359,7 @@ def specify_consistent_ordering_of_files_to_run
config.files_to_run
end
- orderings.uniq.size.should eq(1)
+ expect(orderings.uniq.size).to eq(1)
end
context 'when the given directories match the pattern' do
@@ -403,19 +403,19 @@ def specify_consistent_ordering_of_files_to_run
it "loads files following pattern" do
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
config.files_or_directories_to_run = file
- config.files_to_run.should include(file)
+ expect(config.files_to_run).to include(file)
end
it "loads files in directories following pattern" do
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
config.files_or_directories_to_run = dir
- config.files_to_run.should include("#{dir}/a_foo.rb")
+ expect(config.files_to_run).to include("#{dir}/a_foo.rb")
end
it "does not load files in directories not following pattern" do
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
config.files_or_directories_to_run = dir
- config.files_to_run.should_not include("#{dir}/a_bar.rb")
+ expect(config.files_to_run).not_to include("#{dir}/a_bar.rb")
end
end
@@ -424,16 +424,16 @@ def specify_consistent_ordering_of_files_to_run
config.send(setter, "**/*_foo.rb,**/*_bar.rb")
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
config.files_or_directories_to_run = dir
- config.files_to_run.should include("#{dir}/a_foo.rb")
- config.files_to_run.should include("#{dir}/a_bar.rb")
+ expect(config.files_to_run).to include("#{dir}/a_foo.rb")
+ expect(config.files_to_run).to include("#{dir}/a_bar.rb")
end
it "supports comma separated values with spaces" do
config.send(setter, "**/*_foo.rb, **/*_bar.rb")
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
config.files_or_directories_to_run = dir
- config.files_to_run.should include("#{dir}/a_foo.rb")
- config.files_to_run.should include("#{dir}/a_bar.rb")
+ expect(config.files_to_run).to include("#{dir}/a_foo.rb")
+ expect(config.files_to_run).to include("#{dir}/a_bar.rb")
end
end
end
@@ -442,7 +442,7 @@ def specify_consistent_ordering_of_files_to_run
describe "path with line number" do
it "assigns the line number as a location filter" do
config.files_or_directories_to_run = "path/to/a_spec.rb:37"
- config.filter.should eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
+ expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
end
end
@@ -450,7 +450,7 @@ def specify_consistent_ordering_of_files_to_run
it "overrides filters" do
config.filter_run :focused => true
config.full_description = "foo"
- config.filter.should_not have_key(:focused)
+ expect(config.filter).not_to have_key(:focused)
end
end
@@ -458,41 +458,41 @@ def specify_consistent_ordering_of_files_to_run
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 eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
+ expect(config.filter).to 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 eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37],
+ expect(config.filter).to 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 eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37, 44]}})
+ expect(config.filter).to 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 eq({:locations => {File.expand_path("path/to/a_spec.rb") => [1,3,5,7]}})
+ expect(config.filter).to 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 eq({:full_description => /foo/})
+ expect(config.filter).to eq({:full_description => /foo/})
end
it "assigns the example names as the filter on description if description is an array" do
config.full_description = [ "foo", "bar" ]
- config.filter.should eq({:full_description => Regexp.union(/foo/, /bar/)})
+ expect(config.filter).to eq({:full_description => Regexp.union(/foo/, /bar/)})
end
describe "#default_path" do
it 'defaults to "spec"' do
- config.default_path.should eq('spec')
+ expect(config.default_path).to eq('spec')
end
end
@@ -518,8 +518,8 @@ def metadata_hash(*args)
end
group = ExampleGroup.describe('does like, stuff and junk', :magic_key => :include) { }
- group.should_not respond_to(:you_call_this_a_blt?)
- group.new.you_call_this_a_blt?.should eq("egad man, where's the mayo?!?!?")
+ expect(group).not_to respond_to(:you_call_this_a_blt?)
+ expect(group.new.you_call_this_a_blt?).to eq("egad man, where's the mayo?!?!?")
end
end
@@ -530,8 +530,8 @@ def metadata_hash(*args)
end
group = ExampleGroup.describe('does like, stuff and junk', :magic_key => :include) { }
- group.should_not respond_to(:you_call_this_a_blt?)
- group.new.you_call_this_a_blt?.should eq("egad man, where's the mayo?!?!?")
+ expect(group).not_to respond_to(:you_call_this_a_blt?)
+ expect(group.new.you_call_this_a_blt?).to eq("egad man, where's the mayo?!?!?")
end
end
@@ -557,7 +557,7 @@ def metadata_hash(*args)
end
group = ExampleGroup.describe(ThatThingISentYou, :magic_key => :extend) { }
- group.should respond_to(:that_thing)
+ expect(group).to respond_to(:that_thing)
end
end
@@ -565,12 +565,12 @@ def metadata_hash(*args)
describe "#run_all_when_everything_filtered?" do
it "defaults to false" do
- config.run_all_when_everything_filtered?.should be_false
+ expect(config.run_all_when_everything_filtered?).to be_false
end
it "can be queried with question method" do
config.run_all_when_everything_filtered = true
- config.run_all_when_everything_filtered?.should be_true
+ expect(config.run_all_when_everything_filtered?).to be_true
end
end
@@ -587,8 +587,8 @@ def metadata_hash(*args)
config.tty = true
config.output_stream.stub :tty? => true
- config.send(color_option).should be_true
- config.send(color_option, output).should be_true
+ expect(config.send(color_option)).to be_true
+ expect(config.send(color_option, output)).to be_true
end
end
@@ -600,8 +600,8 @@ def metadata_hash(*args)
config.tty = true
config.output_stream.stub :tty? => false
- config.send(color_option).should be_true
- config.send(color_option, output).should be_true
+ expect(config.send(color_option)).to be_true
+ expect(config.send(color_option, output)).to be_true
end
end
@@ -613,8 +613,8 @@ def metadata_hash(*args)
config.tty = false
config.output_stream.stub :tty? => true
- config.send(color_option).should be_true
- config.send(color_option, output).should be_true
+ expect(config.send(color_option)).to be_true
+ expect(config.send(color_option, output)).to be_true
end
end
@@ -626,8 +626,8 @@ def metadata_hash(*args)
config.tty = false
config.output_stream.stub :tty? => false
- config.send(color_option).should be_false
- config.send(color_option, output).should be_false
+ expect(config.send(color_option)).to be_false
+ expect(config.send(color_option, output)).to be_false
end
end
@@ -650,7 +650,7 @@ def metadata_hash(*args)
config.output_stream = StringIO.new
config.output_stream.stub :tty? => true
config.send "#{color_option}=", true
- config.send(color_option).should be_true
+ expect(config.send(color_option)).to be_true
end
it "leaves output stream intact" do
@@ -659,7 +659,7 @@ def metadata_hash(*args)
config.output_stream = 'foo' if what =~ /Win32/
end
config.send "#{color_option}=", true
- config.output_stream.should eq($stdout)
+ expect(config.output_stream).to eq($stdout)
end
end
@@ -675,7 +675,7 @@ def metadata_hash(*args)
config.stub(:require) { raise LoadError }
config.send "#{color_option}=", true
config.color_enabled = true
- config.send(color_option).should be_false
+ expect(config.send(color_option)).to be_false
end
end
end
@@ -687,7 +687,7 @@ def metadata_hash(*args)
config.output_stream.stub :tty? => true
config.force :color => true
config.color = false
- config.color.should be_true
+ expect(config.color).to be_true
end
end
@@ -702,35 +702,35 @@ def metadata_hash(*args)
it "adds to the list of formatters" do
config.add_formatter :documentation
- config.formatters.first.should be_an_instance_of(Formatters::DocumentationFormatter)
+ expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
end
it "finds a formatter by name (w/ Symbol)" do
config.add_formatter :documentation
- config.formatters.first.should be_an_instance_of(Formatters::DocumentationFormatter)
+ expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
end
it "finds a formatter by name (w/ String)" do
config.add_formatter 'documentation'
- config.formatters.first.should be_an_instance_of(Formatters::DocumentationFormatter)
+ expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
end
it "finds a formatter by class" do
formatter_class = Class.new(Formatters::BaseTextFormatter)
config.add_formatter formatter_class
- config.formatters.first.should be_an_instance_of(formatter_class)
+ expect(config.formatters.first).to be_an_instance_of(formatter_class)
end
it "finds a formatter by class name" do
stub_const("CustomFormatter", Class.new(Formatters::BaseFormatter))
config.add_formatter "CustomFormatter"
- config.formatters.first.should be_an_instance_of(CustomFormatter)
+ expect(config.formatters.first).to be_an_instance_of(CustomFormatter)
end
it "finds a formatter by class fully qualified name" do
stub_const("RSpec::CustomFormatter", Class.new(Formatters::BaseFormatter))
config.add_formatter "RSpec::CustomFormatter"
- config.formatters.first.should be_an_instance_of(RSpec::CustomFormatter)
+ expect(config.formatters.first).to be_an_instance_of(RSpec::CustomFormatter)
end
it "requires a formatter file based on its fully qualified name" do
@@ -738,24 +738,24 @@ def metadata_hash(*args)
stub_const("RSpec::CustomFormatter", Class.new(Formatters::BaseFormatter))
end
config.add_formatter "RSpec::CustomFormatter"
- config.formatters.first.should be_an_instance_of(RSpec::CustomFormatter)
+ expect(config.formatters.first).to be_an_instance_of(RSpec::CustomFormatter)
end
it "raises NameError if class is unresolvable" do
config.should_receive(:require).with('rspec/custom_formatter3')
- lambda { config.add_formatter "RSpec::CustomFormatter3" }.should raise_error(NameError)
+ expect(lambda { config.add_formatter "RSpec::CustomFormatter3" }).to raise_error(NameError)
end
it "raises ArgumentError if formatter is unknown" do
- lambda { config.add_formatter :progresss }.should raise_error(ArgumentError)
+ expect(lambda { config.add_formatter :progresss }).to raise_error(ArgumentError)
end
context "with a 2nd arg defining the output" do
it "creates a file at that path and sets it as the output" do
path = File.join(Dir.tmpdir, 'output.txt')
config.add_formatter('doc', path)
- config.formatters.first.output.should be_a(File)
- config.formatters.first.output.path.should eq(path)
+ expect(config.formatters.first.output).to be_a(File)
+ expect(config.formatters.first.output.path).to eq(path)
end
end
end
@@ -770,21 +770,21 @@ def metadata_hash(*args)
it "sets the filter with a hash" do
config.filter_run_including :foo => true
- config.inclusion_filter[:foo].should be(true)
+ expect(config.inclusion_filter[:foo]).to be(true)
end
it "sets the filter with a symbol" do
RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
config.filter_run_including :foo
- config.inclusion_filter[:foo].should be(true)
+ expect(config.inclusion_filter[:foo]).to be(true)
end
it "merges with existing filters" do
config.filter_run_including :foo => true
config.filter_run_including :bar => false
- config.inclusion_filter[:foo].should be(true)
- config.inclusion_filter[:bar].should be(false)
+ expect(config.inclusion_filter[:foo]).to be(true)
+ expect(config.inclusion_filter[:bar]).to be(false)
end
end
@@ -798,28 +798,28 @@ def metadata_hash(*args)
it "sets the filter" do
config.filter_run_excluding :foo => true
- config.exclusion_filter[:foo].should be(true)
+ expect(config.exclusion_filter[:foo]).to be(true)
end
it "sets the filter using a symbol" do
RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
config.filter_run_excluding :foo
- config.exclusion_filter[:foo].should be(true)
+ expect(config.exclusion_filter[:foo]).to be(true)
end
it "merges with existing filters" do
config.filter_run_excluding :foo => true
config.filter_run_excluding :bar => false
- config.exclusion_filter[:foo].should be(true)
- config.exclusion_filter[:bar].should be(false)
+ expect(config.exclusion_filter[:foo]).to be(true)
+ expect(config.exclusion_filter[:bar]).to be(false)
end
end
describe "#inclusion_filter" do
it "returns {} even if set to nil" do
config.inclusion_filter = nil
- config.inclusion_filter.should eq({})
+ expect(config.inclusion_filter).to eq({})
end
end
@@ -827,47 +827,47 @@ def metadata_hash(*args)
it "treats symbols as hash keys with true values when told to" do
RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
config.inclusion_filter = :foo
- config.inclusion_filter.should eq({:foo => true})
+ expect(config.inclusion_filter).to eq({:foo => true})
end
it "overrides any inclusion filters set on the command line or in configuration files" do
config.force(:inclusion_filter => { :foo => :bar })
config.inclusion_filter = {:want => :this}
- config.inclusion_filter.should eq({:want => :this})
+ expect(config.inclusion_filter).to eq({:want => :this})
end
end
describe "#exclusion_filter" do
it "returns {} even if set to nil" do
config.exclusion_filter = nil
- config.exclusion_filter.should eq({})
+ expect(config.exclusion_filter).to eq({})
end
describe "the default :if filter" do
it "does not exclude a spec with { :if => true } metadata" do
- config.exclusion_filter[:if].call(true).should be_false
+ expect(config.exclusion_filter[:if].call(true)).to be_false
end
it "excludes a spec with { :if => false } metadata" do
- config.exclusion_filter[:if].call(false).should be_true
+ expect(config.exclusion_filter[:if].call(false)).to be_true
end
it "excludes a spec with { :if => nil } metadata" do
- config.exclusion_filter[:if].call(nil).should be_true
+ expect(config.exclusion_filter[:if].call(nil)).to be_true
end
end
describe "the default :unless filter" do
it "excludes a spec with { :unless => true } metadata" do
- config.exclusion_filter[:unless].call(true).should be_true
+ expect(config.exclusion_filter[:unless].call(true)).to be_true
end
it "does not exclude a spec with { :unless => false } metadata" do
- config.exclusion_filter[:unless].call(false).should be_false
+ expect(config.exclusion_filter[:unless].call(false)).to be_false
end
it "does not exclude a spec with { :unless => nil } metadata" do
- config.exclusion_filter[:unless].call(nil).should be_false
+ expect(config.exclusion_filter[:unless].call(nil)).to be_false
end
end
end
@@ -876,13 +876,13 @@ def metadata_hash(*args)
it "treats symbols as hash keys with true values when told to" do
RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
config.exclusion_filter = :foo
- config.exclusion_filter.should eq({:foo => true})
+ expect(config.exclusion_filter).to eq({:foo => true})
end
it "overrides any exclusion filters set on the command line or in configuration files" do
config.force(:exclusion_filter => { :foo => :bar })
config.exclusion_filter = {:want => :this}
- config.exclusion_filter.should eq({:want => :this})
+ expect(config.exclusion_filter).to eq({:want => :this})
end
end
@@ -891,19 +891,19 @@ def metadata_hash(*args)
it "sets the line numbers" do
config.line_numbers = ['37']
- config.filter.should eq({:line_numbers => [37]})
+ expect(config.filter).to eq({:line_numbers => [37]})
end
it "overrides filters" do
config.filter_run :focused => true
config.line_numbers = ['37']
- config.filter.should eq({:line_numbers => [37]})
+ expect(config.filter).to eq({:line_numbers => [37]})
end
it "prevents subsequent filters" do
config.line_numbers = ['37']
config.filter_run :focused => true
- config.filter.should eq({:line_numbers => [37]})
+ expect(config.filter).to eq({:line_numbers => [37]})
end
end
@@ -911,14 +911,14 @@ def metadata_hash(*args)
context "given true" do
it "clears the backtrace clean patterns" do
config.full_backtrace = true
- config.backtrace_clean_patterns.should eq([])
+ expect(config.backtrace_clean_patterns).to eq([])
end
end
context "given false" do
it "restores backtrace clean patterns" do
config.full_backtrace = false
- config.backtrace_clean_patterns.should eq(RSpec::Core::Configuration::DEFAULT_BACKTRACE_PATTERNS)
+ expect(config.backtrace_clean_patterns).to eq(RSpec::Core::Configuration::DEFAULT_BACKTRACE_PATTERNS)
end
end
@@ -927,34 +927,29 @@ def metadata_hash(*args)
config_2 = Configuration.new
config_1.full_backtrace = true
- config_2.backtrace_clean_patterns.should_not be_empty
+ expect(config_2.backtrace_clean_patterns).not_to be_empty
end
end
describe "#cleaned_from_backtrace? defaults" do
it "returns true for rspec files" do
- config.cleaned_from_backtrace?("lib/rspec/core.rb").
- should be_true
+ expect(config.cleaned_from_backtrace?("lib/rspec/core.rb")).to be_true
end
it "returns true for spec_helper" do
- config.cleaned_from_backtrace?("spec/spec_helper.rb").
- should be_true
+ expect(config.cleaned_from_backtrace?("spec/spec_helper.rb")).to be_true
end
it "returns true for java files (for JRuby)" do
- config.cleaned_from_backtrace?("org/jruby/RubyArray.java:2336").
- should be_true
+ expect(config.cleaned_from_backtrace?("org/jruby/RubyArray.java:2336")).to be_true
end
it "returns true for files within installed gems" do
- config.cleaned_from_backtrace?('ruby-1.8.7-p334/gems/mygem-2.3.0/lib/mygem.rb').
- should be_true
+ expect(config.cleaned_from_backtrace?('ruby-1.8.7-p334/gems/mygem-2.3.0/lib/mygem.rb')).to be_true
end
it "returns false for files in projects containing 'gems' in the name" do
- config.cleaned_from_backtrace?('code/my-gems-plugin/lib/plugin.rb').
- should be_false
+ expect(config.cleaned_from_backtrace?('code/my-gems-plugin/lib/plugin.rb')).to be_false
end
end
@@ -999,7 +994,7 @@ def metadata_hash(*args)
it "sets the output" do
output = mock("output")
config.output = output
- config.output.should equal(output)
+ expect(config.output).to equal(output)
end
end
@@ -1025,16 +1020,16 @@ def metadata_hash(*args)
end
it "defaults to nil" do
- config.custom_option.should be_nil
+ expect(config.custom_option).to be_nil
end
it "adds a predicate" do
- config.custom_option?.should be_false
+ expect(config.custom_option?).to be_false
end
it "can be overridden" do
config.custom_option = "a value"
- config.custom_option.should eq("a value")
+ expect(config.custom_option).to eq("a value")
end
end
@@ -1044,26 +1039,26 @@ def metadata_hash(*args)
end
it "defaults to 'a value'" do
- config.custom_option.should eq("a value")
+ expect(config.custom_option).to eq("a value")
end
it "returns true for the predicate" do
- config.custom_option?.should be_true
+ expect(config.custom_option?).to be_true
end
it "can be overridden with a truthy value" do
config.custom_option = "a new value"
- config.custom_option.should eq("a new value")
+ expect(config.custom_option).to eq("a new value")
end
it "can be overridden with nil" do
config.custom_option = nil
- config.custom_option.should eq(nil)
+ expect(config.custom_option).to eq(nil)
end
it "can be overridden with false" do
config.custom_option = false
- config.custom_option.should eq(false)
+ expect(config.custom_option).to eq(false)
end
end
end
@@ -1083,17 +1078,17 @@ def metadata_hash(*args)
it "delegates the getter to the other option" do
config.another_custom_option = "this value"
- config.custom_option.should eq("this value")
+ expect(config.custom_option).to eq("this value")
end
it "delegates the setter to the other option" do
config.custom_option = "this value"
- config.another_custom_option.should eq("this value")
+ expect(config.another_custom_option).to eq("this value")
end
it "delegates the predicate to the other option" do
config.custom_option = true
- config.another_custom_option?.should be_true
+ expect(config.another_custom_option?).to be_true
end
end
end
@@ -1105,7 +1100,7 @@ def metadata_hash(*args)
config.extend(mod, :foo => :bar)
config.configure_group(group)
- group.should be_a(mod)
+ expect(group).to be_a(mod)
end
it "extends with 'module'" do
@@ -1114,7 +1109,7 @@ def metadata_hash(*args)
config.include(mod, :foo => :bar)
config.configure_group(group)
- group.included_modules.should include(mod)
+ expect(group.included_modules).to include(mod)
end
it "requires only one matching filter" do
@@ -1123,7 +1118,7 @@ def metadata_hash(*args)
config.include(mod, :foo => :bar, :baz => :bam)
config.configure_group(group)
- group.included_modules.should include(mod)
+ expect(group.included_modules).to include(mod)
end
it "includes each one before deciding whether to include the next" do
@@ -1139,8 +1134,8 @@ def self.included(host)
config.include(mod1)
config.include(mod2, :foo => :bar)
config.configure_group(group)
- group.included_modules.should include(mod1)
- group.included_modules.should include(mod2)
+ expect(group.included_modules).to include(mod1)
+ expect(group.included_modules).to include(mod2)
end
module IncludeOrExtendMeOnce
@@ -1196,15 +1191,15 @@ def metadata_hash(*args)
describe "#reset" do
it "clears the reporter" do
- config.reporter.should_not be_nil
+ expect(config.reporter).not_to be_nil
config.reset
- config.instance_variable_get("@reporter").should be_nil
+ expect(config.instance_variable_get("@reporter")).to be_nil
end
it "clears the formatters" do
config.add_formatter "doc"
config.reset
- config.formatters.should be_empty
+ expect(config.formatters).to be_empty
end
end
@@ -1212,21 +1207,21 @@ def metadata_hash(*args)
it "forces order" do
config.force :order => "default"
config.order = "rand"
- config.order.should eq("default")
+ expect(config.order).to eq("default")
end
it "forces order and seed with :order => 'rand:37'" do
config.force :order => "rand:37"
config.order = "default"
- config.order.should eq("rand")
- config.seed.should eq(37)
+ expect(config.order).to eq("rand")
+ expect(config.seed).to eq(37)
end
it "forces order and seed with :seed => '37'" do
config.force :seed => "37"
config.order = "default"
- config.seed.should eq(37)
- config.order.should eq("rand")
+ expect(config.seed).to eq(37)
+ expect(config.order).to eq("rand")
end
it 'can set random ordering' do
@@ -1234,24 +1229,24 @@ def metadata_hash(*args)
RSpec.stub(:configuration => config)
list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
Kernel.should_receive(:rand).and_return(3, 1, 4, 2)
- list.ordered.should eq([2, 4, 1, 3])
+ expect(list.ordered).to eq([2, 4, 1, 3])
end
it "forces 'false' value" do
config.add_setting :custom_option
config.custom_option = true
- config.custom_option?.should be_true
+ expect(config.custom_option?).to be_true
config.force :custom_option => false
- config.custom_option?.should be_false
+ expect(config.custom_option?).to be_false
config.custom_option = true
- config.custom_option?.should be_false
+ expect(config.custom_option?).to be_false
end
end
describe '#seed' do
it 'returns the seed as an int' do
config.seed = '123'
- config.seed.should eq(123)
+ expect(config.seed).to eq(123)
end
end
@@ -1260,7 +1255,7 @@ def metadata_hash(*args)
before { config.order = :random }
it 'returns true' do
- config.randomize?.should be_true
+ expect(config.randomize?).to be_true
end
end
@@ -1268,7 +1263,7 @@ def metadata_hash(*args)
before { config.order = nil }
it 'returns false' do
- config.randomize?.should be_false
+ expect(config.randomize?).to be_false
end
end
end
@@ -1278,18 +1273,18 @@ def metadata_hash(*args)
before { config.order = 'random:123' }
it 'sets order to "random"' do
- config.order.should eq('random')
+ expect(config.order).to eq('random')
end
it 'sets seed to 123' do
- config.seed.should eq(123)
+ expect(config.seed).to eq(123)
end
it 'sets up random ordering' do
RSpec.stub(:configuration => config)
list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
Kernel.should_receive(:rand).and_return(3, 1, 4, 2)
- list.ordered.should eq([2, 4, 1, 3])
+ expect(list.ordered).to eq([2, 4, 1, 3])
end
end
@@ -1300,18 +1295,18 @@ def metadata_hash(*args)
end
it "sets the order to nil" do
- config.order.should be_nil
+ expect(config.order).to be_nil
end
it "sets the seed to nil" do
- config.seed.should be_nil
+ expect(config.seed).to be_nil
end
it 'clears the random ordering' do
RSpec.stub(:configuration => config)
list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
Kernel.should_not_receive(:rand)
- list.ordered.should eq([1, 2, 3, 4])
+ expect(list.ordered).to eq([1, 2, 3, 4])
end
end
end
@@ -1323,18 +1318,18 @@ def metadata_hash(*args)
examples = [1, 2, 3, 4]
examples.extend Extensions::Ordered::Examples
config.order_examples { |examples| examples.reverse }
- examples.ordered.should eq([4, 3, 2, 1])
+ expect(examples.ordered).to eq([4, 3, 2, 1])
end
it 'sets #order to "custom"' do
config.order_examples { |examples| examples.reverse }
- config.order.should eq("custom")
+ expect(config.order).to eq("custom")
end
end
describe "#example_ordering_block" do
it 'defaults to a block that returns the passed argument' do
- config.example_ordering_block.call([1, 2, 3]).should eq([1, 2, 3])
+ expect(config.example_ordering_block.call([1, 2, 3])).to eq([1, 2, 3])
end
end
@@ -1345,18 +1340,18 @@ def metadata_hash(*args)
groups = [1, 2, 3, 4]
groups.extend Extensions::Ordered::ExampleGroups
config.order_groups { |groups| groups.reverse }
- groups.ordered.should eq([4, 3, 2, 1])
+ expect(groups.ordered).to eq([4, 3, 2, 1])
end
it 'sets #order to "custom"' do
config.order_groups { |groups| groups.reverse }
- config.order.should eq("custom")
+ expect(config.order).to eq("custom")
end
end
describe "#group_ordering_block" do
it 'defaults to a block that returns the passed argument' do
- config.group_ordering_block.call([1, 2, 3]).should eq([1, 2, 3])
+ expect(config.group_ordering_block.call([1, 2, 3])).to eq([1, 2, 3])
end
end
@@ -1370,11 +1365,11 @@ def metadata_hash(*args)
end
it 'sets a block that determines the ordering of a collection extended with Extensions::Ordered::Examples' do
- examples.ordered.should eq([4, 3, 2, 1])
+ expect(examples.ordered).to eq([4, 3, 2, 1])
end
it 'sets a block that determines the ordering of a collection extended with Extensions::Ordered::ExampleGroups' do
- groups.ordered.should eq([4, 3, 2, 1])
+ expect(groups.ordered).to eq([4, 3, 2, 1])
end
end
end
8 spec/rspec/core/deprecations_spec.rb
View
@@ -9,7 +9,7 @@
it "returns RSpec" do
RSpec.stub(:warn_deprecation)
- Spec.should eq(RSpec)
+ expect(Spec).to eq(RSpec)
end
it "doesn't include backward compatibility in const_missing backtrace" do
@@ -19,7 +19,7 @@
ConstantThatDoesNotExist
rescue Exception => exception
end
- exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }.should be_nil
+ expect(exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }).to be_nil
end
end
@@ -32,7 +32,7 @@
it "delegates to example" do
RSpec.stub(:warn_deprecation)
- running_example.should eq(example)
+ expect(running_example).to eq(example)
end
end
end
@@ -68,7 +68,7 @@
Spec::Rake::ConstantThatDoesNotExist
rescue Exception => exception
end
- exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }.should be_nil
+ expect(exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }).to be_nil
end
end
18 spec/rspec/core/drb_command_line_spec.rb
View
@@ -20,7 +20,7 @@ def config_options(*args)
context "without server running" do
it "raises an error" do
- lambda { command_line.run(err, out) }.should raise_error(DRb::DRbConnError)
+ expect { command_line.run(err, out) }.to raise_error(DRb::DRbConnError)
end
end
@@ -32,14 +32,14 @@ def with_RSPEC_DRB_set_to(val)
context "without RSPEC_DRB environment variable set" do
it "defaults to 8989" do
with_RSPEC_DRB_set_to(nil) do
- command_line.drb_port.should eq(8989)
+ expect(command_line.drb_port).to eq(8989)
end
end
it "sets the DRb port" do
with_RSPEC_DRB_set_to(nil) do
- command_line("--drb-port", "1234").drb_port.should eq(1234)
- command_line("--drb-port", "5678").drb_port.should eq(5678)
+ expect(command_line("--drb-port", "1234").drb_port).to eq(1234)
+ expect(command_line("--drb-port", "5678").drb_port).to eq(5678)
end
end
end
@@ -48,7 +48,7 @@ def with_RSPEC_DRB_set_to(val)
context "without config variable set" do
it "uses RSPEC_DRB value" do
with_RSPEC_DRB_set_to('9000') do
- command_line.drb_port.should eq("9000")
+ expect(command_line.drb_port).to eq("9000")
end
end
end
@@ -56,7 +56,7 @@ def with_RSPEC_DRB_set_to(val)
context "and config variable set" do
it "uses configured value" do
with_RSPEC_DRB_set_to('9000') do
- command_line(*%w[--drb-port 5678]).drb_port.should eq(5678)
+ expect(command_line(*%w[--drb-port 5678]).drb_port).to eq(5678)
end
end
end
@@ -84,19 +84,19 @@ def self.run(argv, err, out)
it "returns 0 if spec passes" do
result = command_line("--drb-port", @drb_port, passing_spec_filename).run(err, out)
- result.should be(0)
+ expect(result).to be(0)
end
it "returns 1 if spec fails" do
result = command_line("--drb-port", @drb_port, failing_spec_filename).run(err, out)
- result.should be(1)
+ expect(result).to be(1)
end
it "outputs colorized text when running with --colour option" do
pending "figure out a way to tell the output to say it's tty"
command_line(failing_spec_filename, "--color", "--drb-port", @drb_port).run(err, out)
out.rewind
- out.read.should =~ /\e\[31m/m
+ expect(out.read).to match /\e\[31m/m
end
end
end
79 spec/rspec/core/drb_options_spec.rb
View
@@ -7,116 +7,116 @@
describe "#drb_argv" do
it "preserves extra arguments" do
File.stub(:exist?) { false }
- config_options_object(*%w[ a --drb b --color c ]).drb_argv.should =~ %w[ --color a b c ]
+ expect(config_options_object(*%w[ a --drb b --color c ]).drb_argv).to match_array %w[ --color a b c ]
end
%w(--color --fail-fast --profile --backtrace --tty).each do |option|
it "includes #{option}" do
- config_options_object("#{option}").drb_argv.should include("#{option}")
+ expect(config_options_object("#{option}").drb_argv).to include("#{option}")
end
end
it "includes --failure-exit-code" do
- config_options_object(*%w[--failure-exit-code 2]).drb_argv.should include("--failure-exit-code", "2")
+ expect(config_options_object(*%w[--failure-exit-code 2]).drb_argv).to include("--failure-exit-code", "2")
end
it "includes --options" do
- config_options_object(*%w[--options custom.opts]).drb_argv.should include("--options", "custom.opts")
+ expect(config_options_object(*%w[--options custom.opts]).drb_argv).to include("--options", "custom.opts")
end
it "includes --order" do
- config_options_object(*%w[--order random]).drb_argv.should include('--order', 'random')
+ expect(config_options_object(*%w[--order random]).drb_argv).to include('--order', 'random')
end
context "with --example" do
it "includes --example" do
- config_options_object(*%w[--example foo]).drb_argv.should include("--example", "foo")
+ expect(config_options_object(*%w[--example foo]).drb_argv).to include("--example", "foo")
end
it "unescapes characters which were escaped upon storing --example originally" do
- config_options_object("--example", "foo\\ bar").drb_argv.should include("--example", "foo bar")
+ expect(config_options_object("--example", "foo\\ bar").drb_argv).to include("--example", "foo bar")
end
end
context "with tags" do
it "includes the inclusion tags" do
coo = config_options_object("--tag", "tag")
- coo.drb_argv.should eq(["--tag", "tag"])
+ expect(coo.drb_argv).to eq(["--tag", "tag"])
end
it "includes the inclusion tags with values" do
coo = config_options_object("--tag", "tag:foo")
- coo.drb_argv.should eq(["--tag", "tag:foo"])
+ expect(coo.drb_argv).to eq(["--tag", "tag:foo"])
end
it "leaves inclusion tags intact" do
coo = config_options_object("--tag", "tag")
coo.drb_argv
- coo.filter_manager.inclusions.should eq( {:tag=>true} )
+ expect(coo.filter_manager.inclusions).to eq( {:tag=>true} )
end
it "leaves inclusion tags with values intact" do
coo = config_options_object("--tag", "tag:foo")
coo.drb_argv
- coo.filter_manager.inclusions.should eq( {:tag=>'foo'} )
+ expect(coo.filter_manager.inclusions).to eq( {:tag=>'foo'} )
end
it "includes the exclusion tags" do
coo = config_options_object("--tag", "~tag")
- coo.drb_argv.should eq(["--tag", "~tag"])
+ expect(coo.drb_argv).to eq(["--tag", "~tag"])
end
it "includes the exclusion tags with values" do
coo = config_options_object("--tag", "~tag:foo")
- coo.drb_argv.should eq(["--tag", "~tag:foo"])
+ expect(coo.drb_argv).to eq(["--tag", "~tag:foo"])
end
it "leaves exclusion tags intact" do
coo = config_options_object("--tag", "~tag")
coo.drb_argv
- coo.filter_manager.exclusions.should include(:tag=>true)
+ expect(coo.filter_manager.exclusions).to include(:tag=>true)
end
it "leaves exclusion tags with values intact" do
coo = config_options_object("--tag", "~tag:foo")
coo.drb_argv
- coo.filter_manager.exclusions.should include(:tag=>'foo')
+ expect(coo.filter_manager.exclusions).to include(:tag=>'foo')
end