transpec 1.12.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md.erb CHANGED
@@ -107,6 +107,8 @@ Running dynamic analysis with command "bundle exec rspec"...
107
107
  Finished in 13.07 seconds
108
108
  100 examples, 0 failures
109
109
 
110
+ Aggregating spec suite data...
111
+
110
112
  Converting spec/spec_helper.rb
111
113
  Converting spec/support/cache_helper.rb
112
114
  Converting spec/support/file_helper.rb
@@ -258,6 +260,7 @@ Type | Target Syntax | Converted Syntax
258
260
  <%=
259
261
  conversion_type_table = <<END
260
262
  `example_group` | `describe 'something' { }` | `RSpec.describe 'something' { }`
263
+ `hook_scope` | `before(:all) { }` | `before(:context) { }`
261
264
  `stub_with_hash` | `obj.stub(:message => value)` | `allow(obj).to receive(:message).and_return(value)`
262
265
  END
263
266
 
@@ -337,9 +340,7 @@ END
337
340
  <%= convert(example).gsub('original spec', 'converted spec') -%>
338
341
 
339
342
  <%=
340
- configuration = Transpec::Configuration.new
341
- configuration.parenthesize_matcher_arg = false
342
- convert(example, configuration)
343
+ convert(example, cli: ['-p'])
343
344
  .gsub(
344
345
  'original spec',
345
346
  'converted spec with -p/--no-parentheses-matcher-arg option'
@@ -451,16 +452,24 @@ table_of_contents(supported_conversions_section, 3)
451
452
  Targets:
452
453
 
453
454
  ```ruby
455
+ <%=
456
+ positive_example = <<END
454
457
  obj.should matcher
458
+ END
459
+ -%>
460
+ <%=
461
+ negative_example = <<END
455
462
  obj.should_not matcher
463
+ END
464
+ -%>
456
465
  ```
457
466
 
458
467
  Will be converted to:
459
468
 
460
469
  ```ruby
461
- expect(obj).to matcher
462
- expect(obj).not_to matcher
463
- expect(obj).to_not matcher # with `--negative-form to_not`
470
+ <%= convert(positive_example, wrap_with: :example) -%>
471
+ <%= convert(negative_example, wrap_with: :example) -%>
472
+ <%= convert(negative_example, wrap_with: :example, cli: ['--negative-form', 'to_not']).chomp -%> # with `--negative-form to_not`
464
473
  ```
465
474
 
466
475
  * This conversion can be disabled by: `--keep should`
@@ -469,21 +478,29 @@ expect(obj).to_not matcher # with `--negative-form to_not`
469
478
 
470
479
  ### One-liner expectations
471
480
 
472
- **This conversion is available only if your project's RSpec is `<%= Transpec::RSpecVersion.oneliner_is_expected_available_version %>` or later.**
481
+ **This conversion is available only if your project's RSpec is `<%= rspec_version = Transpec::RSpecVersion.oneliner_is_expected_available_version %>` or later.**
473
482
 
474
483
  Targets:
475
484
 
476
485
  ```ruby
486
+ <%=
487
+ positive_example = <<END
477
488
  it { should matcher }
489
+ END
490
+ -%>
491
+ <%=
492
+ negative_example = <<END
478
493
  it { should_not matcher }
494
+ END
495
+ -%>
479
496
  ```
480
497
 
481
498
  Will be converted to:
482
499
 
483
500
  ```ruby
484
- it { is_expected.to matcher }
485
- it { is_expected.not_to matcher }
486
- it { is_expected.to_not matcher } # with `--negative-form to_not`
501
+ <%= convert(positive_example, wrap_with: :example, rspec_version: rspec_version) -%>
502
+ <%= convert(negative_example, wrap_with: :example, rspec_version: rspec_version) -%>
503
+ <%= convert(negative_example, wrap_with: :example, rspec_version: rspec_version, cli: ['--negative-form', 'to_not']).chomp -%> # with `--negative-form to_not`
487
504
  ```
488
505
 
489
506
  `is_expected.to` is designed for the consistency with the `expect` syntax.
@@ -495,7 +512,7 @@ feel free to disable this conversion and continue using the one-liner `should`.
495
512
  See [Two Types of `should`](#two-types-of-should) also.
496
513
 
497
514
  * This conversion can be disabled by: `--keep oneliner`
498
- * Deprecation: Not deprecated
515
+ * Deprecation: not deprecated
499
516
  * See also: [Add `is_expected` for expect-based one-liner syntax. by myronmarston · rspec/rspec-core](https://github.com/rspec/rspec-core/pull/1180)
500
517
 
501
518
  ### Operator matchers
@@ -503,21 +520,21 @@ See [Two Types of `should`](#two-types-of-should) also.
503
520
  Targets:
504
521
 
505
522
  ```ruby
523
+ <%=
524
+ example = <<END
506
525
  1.should == 1
507
526
  1.should < 2
508
527
  Integer.should === 1
509
528
  'string'.should =~ /^str/
510
529
  [1, 2, 3].should =~ [2, 1, 3]
530
+ END
531
+ -%>
511
532
  ```
512
533
 
513
534
  Will be converted to:
514
535
 
515
536
  ```ruby
516
- expect(1).to eq(1)
517
- expect(1).to be < 2
518
- expect(Integer).to be === 1
519
- expect('string').to match(/^str/)
520
- expect([1, 2, 3]).to match_array([2, 1, 3])
537
+ <%= convert(example, wrap_with: :example) -%>
521
538
  ```
522
539
 
523
540
  This conversion is combined with the conversion of [standard expectations](#standard-expecatations) and cannot be disabled separately because the `expect` syntax does not directly support the operator matchers.
@@ -526,29 +543,30 @@ This conversion is combined with the conversion of [standard expectations](#stan
526
543
 
527
544
  ### Boolean matchers
528
545
 
529
- **This conversion is available only if your project's RSpec is `<%= Transpec::RSpecVersion.be_truthy_available_version %>` or later.**
546
+ **This conversion is available only if your project's RSpec is `<%= rspec_version = Transpec::RSpecVersion.be_truthy_available_version %>` or later.**
530
547
 
531
548
  Targets:
532
549
 
533
550
  ```ruby
551
+ <%=
552
+ example = <<END
534
553
  expect(obj).to be_true
535
554
  expect(obj).to be_false
555
+ END
556
+ -%>
536
557
  ```
537
558
 
538
559
  Will be converted to:
539
560
 
540
561
  ```ruby
541
- expect(obj).to be_truthy
542
- expect(obj).to be_falsey
562
+ <%= convert(example, rspec_version: rspec_version, wrap_with: :example) -%>
543
563
 
544
564
  # With `--boolean-matcher truthy,falsy`
545
565
  # be_falsy is just an alias of be_falsey.
546
- expect(obj).to be_truthy
547
- expect(obj).to be_falsy
566
+ <%= convert(example, cli: ['--boolean-matcher', 'truthy,falsy'], rspec_version: rspec_version, wrap_with: :example) -%>
548
567
 
549
568
  # With `--boolean-matcher true,false`
550
- expect(obj).to be true
551
- expect(obj).to be false
569
+ <%= convert(example, cli: ['--boolean-matcher', 'true,false'], rspec_version: rspec_version, wrap_with: :example) -%>
552
570
  ```
553
571
 
554
572
  * `be_true` matcher passes if expectation subject is _truthy_ in conditional semantics. (i.e. all objects except `false` and `nil`)
@@ -569,13 +587,17 @@ So, converting `be_true`/`be_false` to `be_truthy`/`be_falsey` never breaks your
569
587
  Targets:
570
588
 
571
589
  ```ruby
590
+ <%=
591
+ example = <<END
572
592
  expect(1.0 / 3.0).to be_close(0.333, 0.001)
593
+ END
594
+ -%>
573
595
  ```
574
596
 
575
597
  Will be converted to:
576
598
 
577
599
  ```ruby
578
- expect(1.0 / 3.0).to be_within(0.001).of(0.333)
600
+ <%= convert(example, wrap_with: :example) -%>
579
601
  ```
580
602
 
581
603
  * This conversion can be disabled by: `--keep deprecated`
@@ -589,31 +611,74 @@ expect(1.0 / 3.0).to be_within(0.001).of(0.333)
589
611
  Targets:
590
612
 
591
613
  ```ruby
614
+ <%=
615
+ example = <<END
592
616
  expect(collection).to have(3).items
593
617
  expect(collection).to have_exactly(3).items
594
618
  expect(collection).to have_at_least(3).items
595
619
  expect(collection).to have_at_most(3).items
620
+ END
621
+ -%>
622
+
623
+ <%=
624
+ should_example = <<END
596
625
  collection.should have(3).items
626
+ END
627
+ -%>
597
628
 
598
629
  # Assume `team` responds to #players.
630
+ <%=
631
+ collection_owner_example = <<END
599
632
  expect(team).to have(3).players
633
+ END
634
+ -%>
600
635
 
601
636
  # Assume #players is a private method.
637
+ <%=
638
+ private_method_example = <<END
602
639
  expect(team).to have(3).players
640
+ END
641
+ -%>
603
642
  ```
604
643
 
605
644
  Will be converted to:
606
645
 
607
646
  ```ruby
608
- expect(collection.size).to eq(3)
609
- expect(collection.size).to be >= 3
610
- expect(collection.size).to be <= 3
611
- collection.size.should == 3 # with `--keep should`
647
+ <%=
648
+ convert(example, dynamic: true, wrap_with: :example, hidden: 'collection = [1, 2, 3]')
649
+ -%>
650
+
651
+ <%=
652
+ " # With `--keep should`\n" +
653
+ convert(should_example, cli: ['--keep', 'should'], dynamic: true, wrap_with: :example, hidden: 'collection = [1, 2, 3]')
654
+ -%>
612
655
 
613
- expect(team.players.size).to eq(3)
656
+ <%=
657
+ convert(collection_owner_example, dynamic: true, wrap_with: :example, hidden: <<END)
658
+ class Team
659
+ def players
660
+ [1, 2, 3]
661
+ end
662
+ end
663
+
664
+ team = Team.new
665
+ END
666
+ -%>
614
667
 
615
668
  # have(n).items matcher invokes #players even if it's a private method.
616
- expect(team.send(:players).size).to eq(3)
669
+ <%=
670
+ convert(private_method_example, dynamic: true, wrap_with: :example, hidden: <<END)
671
+ class Team
672
+ private
673
+
674
+ def players
675
+ [1, 2, 3]
676
+ end
677
+ end
678
+
679
+ team = Team.new
680
+ END
681
+ -%>
617
682
  ```
618
683
 
619
684
  There's an option to continue using `have(n).items` matcher with [rspec-collection_matchers](https://github.com/rspec/rspec-collection_matchers) which is a gem extracted from `rspec-expectations`.
@@ -637,25 +702,39 @@ Note: `rspec-rails` 3.0 [still uses `have(n).items` matcher with `rspec-collecti
637
702
  Targets:
638
703
 
639
704
  ```ruby
705
+ <%=
706
+ example = <<END
640
707
  it { should have(3).items }
708
+ END
709
+ -%>
710
+ <%=
711
+ collection_owner_example = <<END
641
712
  it { should have_at_least(3).players }
713
+ END
714
+ -%>
642
715
  ```
643
716
 
644
717
  Will be converted to:
645
718
 
646
719
  ```ruby
647
- it 'has 3 items' do
648
- expect(subject.size).to eq(3)
649
- end
720
+ <%= convert(example, dynamic: true, wrap_with: :group, hidden: 'subject { [1, 2, 3] }') -%>
650
721
 
651
722
  # With `--keep should`
652
- it 'has 3 items' do
653
- subject.size.should == 3
654
- end
723
+ <%= convert(example, dynamic: true, wrap_with: :group, hidden: 'subject { [1, 2, 3] }', cli: ['--keep', 'should']) -%>
655
724
 
656
- it 'has at least 3 players' do
657
- expect(subject.players.size).to be >= 3
725
+ <%=
726
+ convert(collection_owner_example, dynamic: true, wrap_with: :group, hidden: <<END)
727
+ subject do
728
+ class Team
729
+ def players
730
+ [1, 2, 3]
731
+ end
732
+ end
733
+
734
+ Team.new
658
735
  end
736
+ END
737
+ -%>
659
738
  ```
660
739
 
661
740
  * This conversion can be disabled by: `--keep have_items`
@@ -665,15 +744,19 @@ end
665
744
  Targets:
666
745
 
667
746
  ```ruby
747
+ <%=
748
+ example = <<END
668
749
  lambda { do_something }.should raise_error
669
750
  proc { do_something }.should raise_error
670
751
  -> { do_something }.should raise_error
752
+ END
753
+ -%>
671
754
  ```
672
755
 
673
756
  Will be converted to:
674
757
 
675
758
  ```ruby
676
- expect { do_something }.to raise_error
759
+ <%= convert(example, wrap_with: :example).lines.to_a.uniq.join("\n") -%>
677
760
  ```
678
761
 
679
762
  * This conversion can be disabled by: `--keep should`
@@ -722,17 +805,25 @@ If you choose to do so, disable this conversion by either:
722
805
  Targets:
723
806
 
724
807
  ```ruby
808
+ <%=
809
+ example = <<END
725
810
  expect { do_something }.not_to raise_error(SomeErrorClass)
726
811
  expect { do_something }.not_to raise_error('message')
727
812
  expect { do_something }.not_to raise_error(SomeErrorClass, 'message')
813
+ END
814
+ -%>
815
+ <%=
816
+ should_example = <<END
728
817
  lambda { do_something }.should_not raise_error(SomeErrorClass)
818
+ END
819
+ -%>
729
820
  ```
730
821
 
731
822
  Will be converted to:
732
823
 
733
824
  ```ruby
734
- expect { do_something }.not_to raise_error
735
- lambda { do_something }.should_not raise_error # with `--keep should`
825
+ <%= convert(example, wrap_with: :example).lines.to_a.uniq.join("\n") -%>
826
+ <%= convert(should_example, wrap_with: :example, cli: ['--keep', 'should']).chomp -%> # with `--keep should`
736
827
  ```
737
828
 
738
829
  * This conversion can be disabled by: `--keep deprecated`
@@ -744,15 +835,18 @@ lambda { do_something }.should_not raise_error # with `--keep should`
744
835
  Targets:
745
836
 
746
837
  ```ruby
838
+ <%=
839
+ example = <<END
747
840
  obj.should_receive(:message)
748
841
  Klass.any_instance.should_receive(:message)
842
+ END
843
+ -%>
749
844
  ```
750
845
 
751
846
  Will be converted to:
752
847
 
753
848
  ```ruby
754
- expect(obj).to receive(:message)
755
- expect_any_instance_of(Klass).to receive(:message)
849
+ <%= convert(example, wrap_with: :example) -%>
756
850
  ```
757
851
 
758
852
  * This conversion can be disabled by: `--keep should_receive`
@@ -764,21 +858,29 @@ expect_any_instance_of(Klass).to receive(:message)
764
858
  Targets:
765
859
 
766
860
  ```ruby
861
+ <%=
862
+ example = <<END
767
863
  obj.should_receive(:message).any_number_of_times
768
864
  obj.should_receive(:message).at_least(0)
865
+ END
866
+ -%>
769
867
 
868
+ <%=
869
+ any_instance_example = <<END
770
870
  Klass.any_instance.should_receive(:message).any_number_of_times
771
871
  Klass.any_instance.should_receive(:message).at_least(0)
872
+ END
873
+ -%>
772
874
  ```
773
875
 
774
876
  Will be converted to:
775
877
 
776
878
  ```ruby
777
- allow(obj).to receive(:message)
778
- obj.stub(:message) # with `--keep stub`
879
+ <%= convert(example, wrap_with: :example).lines.to_a.uniq.join("\n") -%>
880
+ <%= convert(example, wrap_with: :example, cli: ['--keep', 'stub']).lines.to_a.uniq.join("\n").chomp -%> # with `--keep stub`
779
881
 
780
- allow_any_instance_of(Klass).to receive(:message)
781
- Klass.any_instance.stub(:message) # with `--keep stub`
882
+ <%= convert(any_instance_example, wrap_with: :example).lines.to_a.uniq.join("\n") -%>
883
+ <%= convert(any_instance_example, wrap_with: :example, cli: ['--keep', 'stub']).lines.to_a.uniq.join("\n").chomp -%> # with `--keep stub`
782
884
  ```
783
885
 
784
886
  * This conversion can be disabled by: `--keep deprecated`
@@ -790,29 +892,45 @@ Klass.any_instance.stub(:message) # with `--keep stub`
790
892
  Targets:
791
893
 
792
894
  ```ruby
895
+ <%=
896
+ example = <<END
793
897
  obj.stub(:message)
794
898
  obj.stub!(:message)
899
+ END
900
+ -%>
795
901
 
902
+ <%=
903
+ stub_chain_example = <<END
796
904
  obj.stub_chain(:foo, :bar, :baz)
905
+ END
906
+ -%>
797
907
 
908
+ <%=
909
+ any_instance_example = <<END
798
910
  Klass.any_instance.stub(:message)
911
+ END
912
+ -%>
799
913
 
914
+ <%=
915
+ unstub_example = <<END
800
916
  obj.unstub(:message)
801
917
  obj.unstub!(:message)
918
+ END
919
+ -%>
802
920
  ```
803
921
 
804
922
  Will be converted to:
805
923
 
806
924
  ```ruby
807
- allow(obj).to receive(:message)
925
+ <%= convert(example, wrap_with: :example).lines.to_a.uniq.join("\n") -%>
808
926
 
809
927
  # Conversion from `stub_chain` to `receive_message_chain` is available
810
- # only if the target project's RSpec is <%= Transpec::RSpecVersion.receive_message_chain_available_version %> or later
811
- allow(obj).to receive_message_chain(:foo, :bar, :baz)
928
+ # only if the target project's RSpec is <%= rspec_version = Transpec::RSpecVersion.receive_message_chain_available_version %> or later
929
+ <%= convert(stub_chain_example, wrap_with: :example, rspec_version: rspec_version) -%>
812
930
 
813
- allow_any_instance_of(Klass).to receive(:message)
931
+ <%= convert(any_instance_example, wrap_with: :example) -%>
814
932
 
815
- allow(obj).to receive(:message).and_call_original
933
+ <%= convert(unstub_example, wrap_with: :example).lines.to_a.uniq.join("\n") -%>
816
934
  ```
817
935
 
818
936
  * This conversion can be disabled by: `--keep stub`
@@ -826,22 +944,25 @@ allow(obj).to receive(:message).and_call_original
826
944
  Targets:
827
945
 
828
946
  ```ruby
947
+ <%=
948
+ example = <<END
829
949
  obj.stub(:foo => 1, :bar => 2)
950
+ END
951
+ -%>
830
952
  ```
831
953
 
832
954
  Will be converted to:
833
955
 
834
956
  ```ruby
835
- # If the target project's RSpec is <%= Transpec::RSpecVersion.receive_messages_available_version %> or later
836
- allow(obj).to receive_messages(:foo => 1, :bar => 2)
957
+ # If the target project's RSpec is <%= rspec_version = Transpec::RSpecVersion.receive_messages_available_version %> or later
958
+ <%= convert(example, wrap_with: :example, rspec_version: rspec_version) -%>
837
959
 
838
960
  # If the target project's RSpec is prior to <%= Transpec::RSpecVersion.receive_messages_available_version %>
839
- obj.stub(:foo => 1, :bar => 2) # No conversion
961
+ <%= convert(example, wrap_with: :example, rspec_version: Transpec.required_rspec_version).chomp -%> # No conversion
840
962
 
841
963
  # If the target project's RSpec is prior to <%= Transpec::RSpecVersion.receive_messages_available_version %>
842
- # and `--convert-stub-with-hash` is specified
843
- allow(obj).to receive(:foo).and_return(1)
844
- allow(obj).to receive(:bar).and_return(2)
964
+ # and `--convert stub-with-hash` is specified
965
+ <%= convert(example, wrap_with: :example, rspec_version: Transpec.required_rspec_version, cli: ['--convert', 'stub_with_hash']) -%>
845
966
  ```
846
967
 
847
968
  `allow(obj).to receive_messages(:foo => 1, :bar => 2)` which is designed to be the replacement for `obj.stub(:foo => 1, :bar => 2)` is available from RSpec 3.0.
@@ -864,15 +985,19 @@ Or if you're going to stay RSpec 2.14 for now but want to convert all `stub` to
864
985
  Targets:
865
986
 
866
987
  ```ruby
988
+ <%=
989
+ example = <<END
867
990
  obj.stub!(:message)
868
991
  obj.unstub!(:message)
992
+ END
993
+ -%>
869
994
  ```
870
995
 
871
996
  Will be converted to:
872
997
 
873
998
  ```ruby
874
- obj.stub(:message) # with `--keep stub`
875
- obj.unstub(:message) # with `--keep stub`
999
+ # With `--keep stub`
1000
+ <%= convert(example, wrap_with: :example, cli: ['--keep', 'stub']) -%>
876
1001
  ```
877
1002
 
878
1003
  * This conversion can be disabled by: `--keep deprecated`
@@ -884,15 +1009,19 @@ obj.unstub(:message) # with `--keep stub`
884
1009
  Targets:
885
1010
 
886
1011
  ```ruby
1012
+ <%=
1013
+ example = <<END
887
1014
  obj.stub(:message).any_number_of_times
888
1015
  obj.stub(:message).at_least(0)
1016
+ END
1017
+ -%>
889
1018
  ```
890
1019
 
891
1020
  Will be converted to:
892
1021
 
893
1022
  ```ruby
894
- allow(obj).to receive(:message)
895
- obj.stub(:message) # with `--keep stub`
1023
+ <%= convert(example, wrap_with: :example).lines.to_a.uniq.join("\n") -%>
1024
+ <%= convert(example, wrap_with: :example, cli: ['--keep', 'stub']).lines.to_a.uniq.join("\n").chomp -%> # with `--keep stub`
896
1025
  ```
897
1026
 
898
1027
  * This conversion can be disabled by: `--keep deprecated`
@@ -918,7 +1047,7 @@ END
918
1047
  Will be converted to:
919
1048
 
920
1049
  ```ruby
921
- <%= convert(example) -%>
1050
+ <%= convert(example, wrap_with: :example) -%>
922
1051
  ```
923
1052
 
924
1053
  * This conversion can be disabled by: `--keep deprecated`
@@ -952,18 +1081,11 @@ END
952
1081
  Will be converted to:
953
1082
 
954
1083
  ```ruby
955
- <%=
956
- rspec_version = Transpec::RSpecVersion.yielding_receiver_to_any_instance_implementation_block_available_version
957
- convert(example, nil, rspec_version)
958
- -%>
1084
+ <% rspec_version = Transpec::RSpecVersion.yielding_receiver_to_any_instance_implementation_block_available_version -%>
1085
+ <%= convert(example, rspec_version: rspec_version) -%>
959
1086
 
960
1087
  # With `--no-yield-any-instance`
961
- <%=
962
- configuration = Transpec::Configuration.new
963
- configuration.add_receiver_arg_to_any_instance_implementation_block = false
964
- rspec_version = Transpec::RSpecVersion.yielding_receiver_to_any_instance_implementation_block_available_version
965
- convert(example, configuration, rspec_version)
966
- -%>
1088
+ <%= convert(example, cli: ['--no-yield-any-instance'], rspec_version: rspec_version) -%>
967
1089
  ```
968
1090
 
969
1091
  Here's an excerpt from [the warning](https://github.com/rspec/rspec-mocks/blob/aab8dc9/lib/rspec/mocks/message_expectation.rb#L478-L491) for `any_instance` implementation blocks in RSpec 2.99:
@@ -994,14 +1116,18 @@ Here's an excerpt from [the warning](https://github.com/rspec/rspec-mocks/blob/a
994
1116
  Targets:
995
1117
 
996
1118
  ```ruby
1119
+ <%=
1120
+ example = <<END
997
1121
  stub('something')
998
1122
  mock('something')
1123
+ END
1124
+ -%>
999
1125
  ```
1000
1126
 
1001
1127
  Will be converted to:
1002
1128
 
1003
1129
  ```ruby
1004
- double('something')
1130
+ <%= convert(example, wrap_with: :example).lines.to_a.uniq.join("\n") -%>
1005
1131
  ```
1006
1132
 
1007
1133
  * This conversion can be disabled by: `--keep deprecated`
@@ -1045,8 +1171,7 @@ Will be converted to:
1045
1171
 
1046
1172
  ```ruby
1047
1173
  <%=
1048
- rspec_version = Transpec::RSpecVersion.skip_available_version
1049
- convert(example, nil, rspec_version)
1174
+ convert(example, rspec_version: Transpec::RSpecVersion.skip_available_version)
1050
1175
  .gsub('pending', 'pending # #pending with block is no longer supported')
1051
1176
  -%>
1052
1177
  ```
@@ -1069,7 +1194,7 @@ Here's an excerpt from [the warning](https://github.com/rspec/rspec-core/blob/v2
1069
1194
 
1070
1195
  ### Current example object
1071
1196
 
1072
- **This conversion is available only if your project's RSpec is `<%= Transpec::RSpecVersion.yielded_example_available_version %>` or later.**
1197
+ **This conversion is available only if your project's RSpec is `<%= rspec_version = Transpec::RSpecVersion.yielded_example_available_version %>` or later.**
1073
1198
 
1074
1199
  Targets:
1075
1200
 
@@ -1096,10 +1221,7 @@ END
1096
1221
  Will be converted to:
1097
1222
 
1098
1223
  ```ruby
1099
- <%=
1100
- rspec_version = Transpec::RSpecVersion.yielded_example_available_version
1101
- convert(example, nil, rspec_version)
1102
- -%>
1224
+ <%= convert(example, rspec_version: rspec_version) -%>
1103
1225
  ```
1104
1226
 
1105
1227
  Here's an excerpt from [the warning](https://github.com/rspec/rspec-core/blob/7d6d2ca/lib/rspec/core/example_group.rb#L513-L527) for `RSpec::Core::ExampleGroup#example` and `#running_example` in RSpec 2.99:
@@ -1124,7 +1246,7 @@ Here's an excerpt from [the warning](https://github.com/rspec/rspec-core/blob/7d
1124
1246
 
1125
1247
  ### Custom matcher DSL
1126
1248
 
1127
- **This conversion is available only if your project's RSpec is `<%= Transpec::RSpecVersion.non_should_matcher_protocol_available_version %>` or later.**
1249
+ **This conversion is available only if your project's RSpec is `<%= rspec_version = Transpec::RSpecVersion.non_should_matcher_protocol_available_version %>` or later.**
1128
1250
 
1129
1251
  Targets:
1130
1252
 
@@ -1144,19 +1266,16 @@ END
1144
1266
  Will be converted to:
1145
1267
 
1146
1268
  ```ruby
1147
- <%=
1148
- rspec_version = Transpec::RSpecVersion.non_should_matcher_protocol_available_version
1149
- convert(example, nil, rspec_version)
1150
- -%>
1269
+ <%= convert(example, rspec_version: rspec_version) -%>
1151
1270
  ```
1152
1271
 
1153
1272
  * This conversion can be disabled by: `--keep deprecated`
1154
1273
  * Deprecation: deprecated since RSpec 3.0
1155
1274
  * See also: [Expectations: Matcher protocol and custom matcher API changes - The Plan for RSpec 3](http://myronmars.to/n/dev-blog/2013/07/the-plan-for-rspec-3#expectations_matcher_protocol_and_custom_matcher_api_changes)
1156
1275
 
1157
- ### Example Groups
1276
+ ### Example groups
1158
1277
 
1159
- **This conversion is disabled by default and available only if your project's RSpec is `<%= Transpec::RSpecVersion.non_monkey_patch_example_group_available_version %>` or later.**
1278
+ **This conversion is disabled by default and available only if your project's RSpec is `<%= rspec_version = Transpec::RSpecVersion.non_monkey_patch_example_group_available_version %>` or later.**
1160
1279
 
1161
1280
  Targets:
1162
1281
 
@@ -1180,18 +1299,44 @@ END
1180
1299
  Will be converted to:
1181
1300
 
1182
1301
  ```ruby
1183
- <%=
1184
- configuration = Transpec::Configuration.new
1185
- configuration.convert_example_group = true
1186
- rspec_version = Transpec::RSpecVersion.non_monkey_patch_example_group_available_version
1187
- convert(example, configuration, rspec_version)
1188
- -%>
1302
+ <%= convert(example, cli: ['--convert', 'example_group'], rspec_version: rspec_version) -%>
1189
1303
  ```
1190
1304
 
1191
1305
  * This conversion can be enabled by: `--convert example_group`
1192
- * Deprecation: Not deprecated
1306
+ * Deprecation: not deprecated
1193
1307
  * See also: [Zero Monkey Patching Mode! - The Plan for RSpec 3](http://myronmars.to/n/dev-blog/2013/07/the-plan-for-rspec-3#zero_monkey_patching_mode)
1194
1308
 
1309
+ ### Hook scope aliases
1310
+
1311
+ **This conversion is disabled by default and available only if your project's RSpec is `<%= rspec_version = Transpec::RSpecVersion.hook_scope_alias_available_version %>` or later.**
1312
+
1313
+ Targets:
1314
+
1315
+ ```ruby
1316
+ <%=
1317
+ example = <<END
1318
+ describe 'example' do
1319
+ before { do_something }
1320
+ before(:each) { do_something }
1321
+ before(:all) { do_something }
1322
+ end
1323
+
1324
+ RSpec.configure do |config|
1325
+ before(:suite) { do_something }
1326
+ end
1327
+ END
1328
+ -%>
1329
+ ```
1330
+
1331
+ Will be converted to:
1332
+
1333
+ ```ruby
1334
+ <%= convert(example, cli: ['--convert', 'hook_scope'], rspec_version: rspec_version) -%>
1335
+ ```
1336
+
1337
+ * This conversion can be enabled by: `--convert hook_scope`
1338
+ * Deprecation: not deprecated
1339
+ * See also: [Adds hook scope aliases `example` and `context` · rspec/rspec-core](https://github.com/rspec/rspec-core/pull/1174)
1195
1340
 
1196
1341
  ## Compatibility
1197
1342