Skip to content

Commit

Permalink
Fix rspec deprecation warnings for passing a lambda to expect method
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtt committed Feb 19, 2024
1 parent 10d5c28 commit 50eb769
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions spec/bulldoze_renamer/shell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
it "exits without replacing if no argument is passed" do
argv = []
expect(err_double).to receive(:puts).with ::BulldozeRenamer::Shell::BANNER
expect(lambda { ::BulldozeRenamer::Shell.start( argv, out: out_double, err: err_double) }).to raise_error SystemExit
expect{::BulldozeRenamer::Shell.start( argv, out: out_double, err: err_double)}.to raise_error SystemExit
end

it "exits without replacing if one argument is passed" do
argv = ['one']
expect(err_double).to receive(:puts).with ::BulldozeRenamer::Shell::BANNER
expect(lambda { ::BulldozeRenamer::Shell.start( argv, out: out_double, err: err_double) }).to raise_error SystemExit
expect{::BulldozeRenamer::Shell.start( argv, out: out_double, err: err_double)}.to raise_error SystemExit
end

it "performs a replace if there are exactly two arguments" do
Expand All @@ -34,7 +34,7 @@
it "exits without replacing if more than two arguments are passed" do
argv = ['.', 'one', 'two', 'three']
expect(err_double).to receive(:puts).with ::BulldozeRenamer::Shell::BANNER
expect(lambda { ::BulldozeRenamer::Shell.start( argv, out: out_double, err: err_double) }).to raise_error SystemExit
expect{::BulldozeRenamer::Shell.start( argv, out: out_double, err: err_double)}.to raise_error SystemExit
expect(::BulldozeRenamer::RenamingOrchestrator).not_to receive(:rename_with_options)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/bulldoze_renamer/string_inflector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@
end

it "raises an error if the current string does not map to any of the inflections" do
expect(-> { BulldozeRenamer::StringInflector.new('current does-Not_Reflect', 'whatevs').mappings }).
expect { BulldozeRenamer::StringInflector.new('current does-Not_Reflect', 'whatevs').mappings }.
to raise_error(BulldozeRenamer::StringInflector::StringDoesNotInflectToItselfError, "current does-Not_Reflect")
end

it "raises an error if the target string does not map to any of the inflections" do
expect(-> { BulldozeRenamer::StringInflector.new('whatevs', 'target does-Not_Reflect').mappings }).
expect { BulldozeRenamer::StringInflector.new('whatevs', 'target does-Not_Reflect').mappings }.
to raise_error(BulldozeRenamer::StringInflector::StringDoesNotInflectToItselfError, "target does-Not_Reflect")
end

Expand Down

0 comments on commit 50eb769

Please sign in to comment.