lib/synvert/snippets/rspec/one_liner_expectation.rb in synvert-0.0.13 vs lib/synvert/snippets/rspec/one_liner_expectation.rb in synvert-0.0.14
- old
+ new
@@ -1,5 +1,24 @@
-Synvert::Rewriter.new "convert_rspec_one_liner_expectation", "RSpec converts one liner expectation" do
+Synvert::Rewriter.new "convert_rspec_one_liner_expectation" do
+ description <<-EOF
+It convers rspec one liner expectation.
+
+ it { should matcher } => it { is_expected.to matcher }
+ it { should_not matcher } => it { is_expected.not_to matcher }
+
+ it { should have(3).items }
+ =>
+ it 'has 3 items' do
+ expect(subject.size).to eq(3)
+ end
+
+ it { should have_at_least(3).players }
+ =>
+ it 'has at least 3 players' do
+ expect(subject.players.size).to be >= 3
+ end
+ EOF
+
if_gem 'rspec', {gte: '2.99.0'}
matcher_converters = {have: 'eq', have_exactly: 'eq', have_at_least: 'be >=', have_at_most: 'be <='}
within_files 'spec/**/*.rb' do
{should: 'to', should_not: 'not_to'}.each do |old_message, new_message|