You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a test case for the transpec testsuite which should illustrate the bug. When I run it, it fails, specifically it converts raise_error(SpecificErrorClass) to raise_error (which is incorrect because that conversion is supposed to only be for negative assertions). I didn't even know expect { }.should was possible, but I found it in our production app when transpec converted it this way.
diff --git a/spec/transpec/syntax/raise_error_spec.rb b/spec/transpec/syntax/raise_error_spec.rb
index 2fd06f8..b578f6d 100644
--- a/spec/transpec/syntax/raise_error_spec.rb+++ b/spec/transpec/syntax/raise_error_spec.rb@@ -63,6 +63,28 @@ module Transpec
end
end
+ context 'with expression `expect { }.should raise_error(SpecificErrorClass)`' do+ let(:source) do+ <<-END+ describe 'example' do+ it 'raises SpecificErrorClass' do+ expect { do_something }.should raise_error(SpecificErrorClass)+ end+ end+ END+ end++ let(:raise_error_object) { expect_object.raise_error_matcher }++ it 'does nothing' do+ rewritten_source.should == source+ end++ it 'reports nothing' do+ raise_error_object.report.records.should be_empty+ end+ end+
context 'with expression `lambda { }.should raise_error(SpecificErrorClass) { |error| ... }`' do
let(:source) do
<<-END
The text was updated successfully, but these errors were encountered:
Here is a test case for the transpec testsuite which should illustrate the bug. When I run it, it fails, specifically it converts
raise_error(SpecificErrorClass)
toraise_error
(which is incorrect because that conversion is supposed to only be for negative assertions). I didn't even knowexpect { }.should
was possible, but I found it in our production app when transpec converted it this way.The text was updated successfully, but these errors were encountered: