lib/synvert/snippets/rspec/should_to_expect.rb in synvert-0.0.13 vs lib/synvert/snippets/rspec/should_to_expect.rb in synvert-0.0.14
- old
+ new
@@ -1,5 +1,19 @@
-Synvert::Rewriter.new "convert_rspec_should_to_expect", "RSpec converts should to expect" do
+Synvert::Rewriter.new "convert_rspec_should_to_expect" do
+ description <<-EOF
+It converts rspec should to expect.
+
+ obj.should matcher => expect(obj).to matcher
+ obj.should_not matcher => expect(obj).not_to matcher
+
+ 1.should == 1 => expect(1).to eq 1
+ 1.should < 1 => expect(1).to be < 2
+ Integer.should === 1 => expect(Integer).to be === 1
+
+ 'string'.should =~ /^str/ => expect('string').to match /^str/
+ [1, 2, 3].should =~ [2, 1, 3] => expect([1, 2, 3]).to match_array [2, 1, 3]
+ EOF
+
if_gem 'rspec', {gte: '2.11.0'}
within_files 'spec/**/*.rb' do
# obj.should matcher => expect(obj).to matcher
# obj.should_not matcher => expect(obj).not_to matcher