transpec 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md.erb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Transpec** is a tool for converting your specs to the latest [RSpec](http://rspec.info/) syntax with static and dynamic code analysis.
6
6
 
7
- This aims to facilitate smooth transition to RSpec 3, and it's now ready for RSpec 2.99 and 3.0 beta!
7
+ This aims to facilitate a smooth transition to RSpec 3, and it's now ready for RSpec 2.99 and 3.0 beta!
8
8
 
9
9
  See the following pages for the new RSpec syntax and the plan for RSpec 3:
10
10
 
@@ -12,8 +12,8 @@ See the following pages for the new RSpec syntax and the plan for RSpec 3:
12
12
  * [RSpec's new message expectation syntax - Tea is awesome.](http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/)
13
13
  * [Myron Marston » The Plan for RSpec 3](http://myronmars.to/n/dev-blog/2013/07/the-plan-for-rspec-3)
14
14
 
15
- Transpec now supports almost all conversions for the RSpec changes,
16
- but the changes for RSpec 3 is not fixed and may vary in the future.
15
+ Transpec now supports conversions for almost all of the RSpec 3 changes,
16
+ but the changes are not fixed and may vary in the future.
17
17
  So it's recommended to follow updates of both RSpec and Transpec.
18
18
 
19
19
  ## Examples
@@ -88,7 +88,7 @@ Before converting your specs:
88
88
 
89
89
  * Make sure your project has `rspec` gem dependency **<%= Transpec.required_rspec_version %>** or later. If not, change your `*.gemspec` or `Gemfile` to do so.
90
90
  * Run `rspec` and check if all the specs pass.
91
- * Ensure the Git repository is clean. (You don't want to mix up your changes and Transpec's changes, right?)
91
+ * Ensure the Git repository is clean. (You don't want to mix up your changes and Transpec's changes, do you?)
92
92
 
93
93
  Then, run `transpec` in the project root directory:
94
94
 
@@ -157,7 +157,7 @@ Skip dynamic analysis and convert with only static analysis. Note that specifyin
157
157
  Specify a command to run your specs that is used for dynamic analysis.
158
158
 
159
159
  Transpec needs to run your specs in a copied project directory for dynamic analysis.
160
- If your project requires some special setups or commands to run specs, use this option.
160
+ If your project requires some special setup or commands to run specs, use this option.
161
161
  `bundle exec rspec` is used by default.
162
162
 
163
163
  ```bash
@@ -327,31 +327,39 @@ Then run `transpec` again.
327
327
 
328
328
  ### Standard expectations
329
329
 
330
+ Targets:
331
+
330
332
  ```ruby
331
- # Targets
332
333
  obj.should matcher
333
334
  obj.should_not matcher
335
+ ```
336
+
337
+ Will be converted to:
334
338
 
335
- # Converted
339
+ ```ruby
336
340
  expect(obj).to matcher
337
341
  expect(obj).not_to matcher
338
342
  expect(obj).to_not matcher # with `--negative-form to_not`
339
343
  ```
340
344
 
341
- * Conversion can be disabled by: `--keep should`
342
- * Deprecation: Deprecated since RSpec 3.0
345
+ * This conversion can be disabled by: `--keep should`
346
+ * Deprecation: deprecated since RSpec 3.0
343
347
  * See also: [Myron Marston » RSpec's New Expectation Syntax](http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax)
344
348
 
345
349
  ### One-liner expectations
346
350
 
347
- **This conversion is available only if your project has `rspec` gem dependency `<%= Transpec::RSpecVersion.one_liner_is_expected_available_version %>` or later.**
351
+ **This conversion is available only if your project's RSpec is `<%= Transpec::RSpecVersion.oneliner_is_expected_available_version %>` (not yet released) or later.**
352
+
353
+ Targets:
348
354
 
349
355
  ```ruby
350
- # Targets
351
356
  it { should matcher }
352
357
  it { should_not matcher }
358
+ ```
353
359
 
354
- # Converted
360
+ Will be converted to:
361
+
362
+ ```ruby
355
363
  it { is_expected.to matcher }
356
364
  it { is_expected.not_to matcher }
357
365
  it { is_expected.to_not matcher } # with `--negative-form to_not`
@@ -363,21 +371,25 @@ and available even if the `should` syntax is disabled with `RSpec.configure`.
363
371
  So if you think `is_expected.to` is verbose,
364
372
  feel free to disable this conversion and continue using the one-liner `should`.
365
373
 
366
- * Conversion can be disabled by: `--keep oneliner`
374
+ * This conversion can be disabled by: `--keep oneliner`
367
375
  * Deprecation: Not deprecated
368
376
  * See also: [Add `is_expected` for expect-based one-liner syntax. by myronmarston · rspec/rspec-core](https://github.com/rspec/rspec-core/pull/1180)
369
377
 
370
378
  ### Operator matchers
371
379
 
380
+ Targets:
381
+
372
382
  ```ruby
373
- # Targets
374
383
  1.should == 1
375
384
  1.should < 2
376
385
  Integer.should === 1
377
386
  'string'.should =~ /^str/
378
387
  [1, 2, 3].should =~ [2, 1, 3]
388
+ ```
389
+
390
+ Will be converted to:
379
391
 
380
- # Converted
392
+ ```ruby
381
393
  expect(1).to eq(1)
382
394
  expect(1).to be < 2
383
395
  expect(Integer).to be === 1
@@ -391,14 +403,18 @@ This conversion is combined with the conversion of [standard expectations](#stan
391
403
 
392
404
  ### Boolean matchers
393
405
 
394
- **This conversion is available only if your project has `rspec` gem dependency `<%= Transpec::RSpecVersion.be_truthy_available_version %>` or later.**
406
+ **This conversion is available only if your project's RSpec is `<%= Transpec::RSpecVersion.be_truthy_available_version %>` or later.**
407
+
408
+ Targets:
395
409
 
396
410
  ```ruby
397
- # Targets
398
411
  expect(obj).to be_true
399
412
  expect(obj).to be_false
413
+ ```
400
414
 
401
- # Converted
415
+ Will be converted to:
416
+
417
+ ```ruby
402
418
  expect(obj).to be_truthy
403
419
  expect(obj).to be_falsey
404
420
 
@@ -417,34 +433,39 @@ expect(obj).to be false
417
433
  * `be_truthy` and `be_falsey` matchers are renamed version of `be_true` and `be_false` and their behaviors are same.
418
434
  * `be true` and `be false` are not new things. These are combinations of `be` matcher and boolean literals. These pass if expectation subject is exactly equal to boolean value.
419
435
 
420
- So, converting `be_true`/`be_false` to `be_truthy`/`be_falsey` never breaks your specs and this is the Transpec's default. If you are willing to test boolean values strictly, you can convert them to `be true`/`be false` with `--boolean-matcher true,false` option. Note that this may break your specs if your application codes don't return exact boolean values.
436
+ So, converting `be_true`/`be_false` to `be_truthy`/`be_falsey` never breaks your specs and this is Transpec's default. If you are willing to test boolean values strictly, you can convert them to `be true`/`be false` with `--boolean-matcher true,false` option. Note that this may break your specs if your application code don't return exact boolean values.
421
437
 
422
438
  ---
423
439
 
424
- * Conversion can be disabled by: `--keep deprecated`
425
- * Deprecation: Deprecated since RSpec 2.99, removed in RSpec 3.0
440
+ * This conversion can be disabled by: `--keep deprecated`
441
+ * Deprecation: deprecated since RSpec 2.99, removed in RSpec 3.0
426
442
  * See also: [Consider renaming `be_true` and `be_false` to `be_truthy` and `be_falsey` · rspec/rspec-expectations](https://github.com/rspec/rspec-expectations/issues/283)
427
443
 
428
444
  ### `be_close` matcher
429
445
 
446
+ Targets:
447
+
430
448
  ```ruby
431
- # Targets
432
449
  expect(1.0 / 3.0).to be_close(0.333, 0.001)
450
+ ```
451
+
452
+ Will be converted to:
433
453
 
434
- # Converted
454
+ ```ruby
435
455
  expect(1.0 / 3.0).to be_within(0.001).of(0.333)
436
456
  ```
437
457
 
438
- * Conversion can be disabled by: `--keep deprecated`
439
- * Deprecation: Deprecated since RSpec 2.1, removed in RSpec 3.0
458
+ * This conversion can be disabled by: `--keep deprecated`
459
+ * Deprecation: deprecated since RSpec 2.1, removed in RSpec 3.0
440
460
  * See also: [New be within matcher and RSpec.deprecate fix · rspec/rspec-expectations](https://github.com/rspec/rspec-expectations/pull/32)
441
461
 
442
462
  ### `have(n).items` matcher
443
463
 
444
464
  **This conversion will be disabled automatically if `rspec-collection_matchers` or `rspec-rails` is loaded in your spec.**
445
465
 
466
+ Targets:
467
+
446
468
  ```ruby
447
- # Targets
448
469
  expect(collection).to have(3).items
449
470
  expect(collection).to have_exactly(3).items
450
471
  expect(collection).to have_at_least(3).items
@@ -456,8 +477,11 @@ expect(team).to have(3).players
456
477
 
457
478
  # Assume #players is a private method.
458
479
  expect(team).to have(3).players
480
+ ```
459
481
 
460
- # Converted
482
+ Will be converted to:
483
+
484
+ ```ruby
461
485
  expect(collection.size).to eq(3)
462
486
  expect(collection.size).to be >= 3
463
487
  expect(collection.size).to be <= 3
@@ -469,8 +493,8 @@ expect(team.players.size).to eq(3)
469
493
  expect(team.send(:players).size).to eq(3)
470
494
  ```
471
495
 
472
- There's an option to continue using `have(n).items` matcher with [rspec-collection_matchers](https://github.com/rspec/rspec-collection_matchers) that is a gem extracted from `rspec-expectations`.
473
- If you choose so, disable this conversion by either:
496
+ 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`.
497
+ If you choose to do so, disable this conversion by either:
474
498
 
475
499
  * Specify `--keep have_items` option manually.
476
500
  * Require `rspec-collection_matchers` or `rspec-rails` in your spec so that Transpec automatically disables this conversion.
@@ -479,20 +503,24 @@ Note: `rspec-rails` 3.0 [still uses `have(n).items` matcher with `rspec-collecti
479
503
 
480
504
  ---
481
505
 
482
- * Conversion can be disabled by: `--keep have_items`
483
- * Deprecation: Deprecated since RSpec 2.99, removed in RSpec 3.0
506
+ * This conversion can be disabled by: `--keep have_items`
507
+ * Deprecation: deprecated since RSpec 2.99, removed in RSpec 3.0
484
508
  * See also: [Expectations: have(x).items matchers will be moved into an external gem - The Plan for RSpec 3](http://myronmars.to/n/dev-blog/2013/07/the-plan-for-rspec-3#expectations__matchers_will_be_moved_into_an_external_gem)
485
509
 
486
510
  ### One-liner expectations with `have(n).items` matcher
487
511
 
488
512
  **This conversion will be disabled automatically if `rspec-collection_matchers` or `rspec-rails` is loaded in your spec.**
489
513
 
514
+ Targets:
515
+
490
516
  ```ruby
491
- # Targets
492
517
  it { should have(3).items }
493
518
  it { should have_at_least(3).players }
519
+ ```
520
+
521
+ Will be converted to:
494
522
 
495
- # Converted
523
+ ```ruby
496
524
  it 'has 3 items' do
497
525
  expect(subject.size).to eq(3)
498
526
  end
@@ -507,69 +535,85 @@ it 'has at least 3 players' do
507
535
  end
508
536
  ```
509
537
 
510
- * Conversion can be disabled by: `--keep have_items`
538
+ * This conversion can be disabled by: `--keep have_items`
511
539
 
512
540
  ### Expectations on block
513
541
 
542
+ Targets:
543
+
514
544
  ```ruby
515
- # Targets
516
545
  lambda { do_something }.should raise_error
517
546
  proc { do_something }.should raise_error
518
547
  -> { do_something }.should raise_error
548
+ ```
549
+
550
+ Will be converted to:
519
551
 
520
- # Converted
552
+ ```ruby
521
553
  expect { do_something }.to raise_error
522
554
  ```
523
555
 
524
- * Conversion can be disabled by: `--keep should`
525
- * Deprecation: Deprecated since RSpec 3.0
556
+ * This conversion can be disabled by: `--keep should`
557
+ * Deprecation: deprecated since RSpec 3.0
526
558
  * See also: [Unification of Block vs. Value Syntaxes - RSpec's New Expectation Syntax](http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax#unification_of_block_vs_value_syntaxes)
527
559
 
528
560
  ### Negative error expectations with specific error
529
561
 
562
+ Targets:
563
+
530
564
  ```ruby
531
- # Targets
532
565
  expect { do_something }.not_to raise_error(SomeErrorClass)
533
566
  expect { do_something }.not_to raise_error('message')
534
567
  expect { do_something }.not_to raise_error(SomeErrorClass, 'message')
535
568
  lambda { do_something }.should_not raise_error(SomeErrorClass)
569
+ ```
570
+
571
+ Will be converted to:
536
572
 
537
- # Converted
573
+ ```ruby
538
574
  expect { do_something }.not_to raise_error
539
575
  lambda { do_something }.should_not raise_error # with `--keep should`
540
576
  ```
541
577
 
542
- * Conversion can be disabled by: `--keep deprecated`
543
- * Deprecation: Deprecated since RSpec 2.14, removed in RSpec 3.0
578
+ * This conversion can be disabled by: `--keep deprecated`
579
+ * Deprecation: deprecated since RSpec 2.14, removed in RSpec 3.0
544
580
  * See also: [Consider deprecating `expect { }.not_to raise_error(SpecificErrorClass)` · rspec/rspec-expectations](https://github.com/rspec/rspec-expectations/issues/231)
545
581
 
546
582
  ### Message expectations
547
583
 
584
+ Targets:
585
+
548
586
  ```ruby
549
- # Targets
550
587
  obj.should_receive(:foo)
551
588
  Klass.any_instance.should_receive(:foo)
589
+ ```
552
590
 
553
- # Converted
591
+ Will be converted to:
592
+
593
+ ```ruby
554
594
  expect(obj).to receive(:foo)
555
595
  expect_any_instance_of(Klass).to receive(:foo)
556
596
  ```
557
597
 
558
- * Conversion can be disabled by: `--keep should_receive`
559
- * Deprecation: Deprecated since RSpec 3.0
598
+ * This conversion can be disabled by: `--keep should_receive`
599
+ * Deprecation: deprecated since RSpec 3.0
560
600
  * See also: [RSpec's new message expectation syntax - Tea is awesome.](http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/)
561
601
 
562
602
  ### Message expectations that are actually method stubs
563
603
 
604
+ Targets:
605
+
564
606
  ```ruby
565
- # Targets
566
607
  obj.should_receive(:foo).any_number_of_times
567
608
  obj.should_receive(:foo).at_least(0)
568
609
 
569
610
  Klass.any_instance.should_receive(:foo).any_number_of_times
570
611
  Klass.any_instance.should_receive(:foo).at_least(0)
612
+ ```
613
+
614
+ Will be converted to:
571
615
 
572
- # Converted
616
+ ```ruby
573
617
  allow(obj).to receive(:foo)
574
618
  obj.stub(:foo) # with `--keep stub`
575
619
 
@@ -577,14 +621,15 @@ allow_any_instance_of(Klass).to receive(:foo)
577
621
  Klass.any_instance.stub(:foo) # with `--keep stub`
578
622
  ```
579
623
 
580
- * Conversion can be disabled by: `--keep deprecated`
581
- * Deprecation: Deprecated since RSpec 2.14, removed in RSpec 3.0
624
+ * This conversion can be disabled by: `--keep deprecated`
625
+ * Deprecation: deprecated since RSpec 2.14, removed in RSpec 3.0
582
626
  * See also: [Don't allow at_least(0) · rspec/rspec-mocks](https://github.com/rspec/rspec-mocks/issues/133)
583
627
 
584
628
  ### Method stubs
585
629
 
630
+ Targets:
631
+
586
632
  ```ruby
587
- # Targets
588
633
  obj.stub(:foo)
589
634
  obj.stub!(:foo)
590
635
 
@@ -593,19 +638,22 @@ obj.stub(:foo => 1, :bar => 2)
593
638
  obj.stub_chain(:foo, :bar, :baz)
594
639
 
595
640
  Klass.any_instance.stub(:foo)
641
+ ```
596
642
 
597
- # Converted
643
+ Will be converted to:
644
+
645
+ ```ruby
598
646
  allow(obj).to receive(:foo)
599
647
 
600
- # If the target project's rspec gem dependency is prior to <%= Transpec::RSpecVersion.receive_messages_available_version %>
648
+ # If the target project's RSpec is prior to <%= Transpec::RSpecVersion.receive_messages_available_version %>
601
649
  allow(obj).to receive(:foo).and_return(1)
602
650
  allow(obj).to receive(:bar).and_return(2)
603
651
 
604
- # If the target project's rspec gem dependency is <%= Transpec::RSpecVersion.receive_messages_available_version %> or later
652
+ # If the target project's RSpec is <%= Transpec::RSpecVersion.receive_messages_available_version %> or later
605
653
  allow(obj).to receive_messages(:foo => 1, :bar => 2)
606
654
 
607
655
  # Conversion from `stub_chain` to `receive_message_chain` is available
608
- # only if the target project's rspec gem dependency is <%= Transpec::RSpecVersion.receive_message_chain_available_version %> or later
656
+ # only if the target project's RSpec is <%= Transpec::RSpecVersion.receive_message_chain_available_version %> (not yet released) or later
609
657
  allow(obj).to receive_message_chain(:foo, :bar, :baz)
610
658
 
611
659
  allow_any_instance_of(Klass).to receive(:foo)
@@ -613,7 +661,7 @@ allow_any_instance_of(Klass).to receive(:foo)
613
661
 
614
662
  #### No replacement for `unstub`
615
663
 
616
- There's no replacement for `unstub` in the `expect` syntax. See [the discussion](https://github.com/rspec/rspec-mocks/issues/153#issuecomment-12208638) for more details.
664
+ There's no replacement for `unstub` in the `expect` syntax. See [this discussion](https://github.com/rspec/rspec-mocks/issues/153#issuecomment-12208638) for more details.
617
665
 
618
666
  #### Steps to upgrade `obj.stub(:foo => 1, :bar => 2)`
619
667
 
@@ -628,8 +676,8 @@ Otherwise `obj.stub(:foo => 1, :bar => 2)` will be converted to two `allow(obj).
628
676
 
629
677
  ---
630
678
 
631
- * Conversion can be disabled by: `--keep stub`
632
- * Deprecation: Deprecated since RSpec 3.0
679
+ * This conversion can be disabled by: `--keep stub`
680
+ * Deprecation: deprecated since RSpec 3.0
633
681
  * See also:
634
682
  * [RSpec's new message expectation syntax - Tea is awesome.](http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/)
635
683
  * [allow receive with multiple methods · rspec/rspec-mocks](https://github.com/rspec/rspec-mocks/issues/368)
@@ -637,57 +685,70 @@ Otherwise `obj.stub(:foo => 1, :bar => 2)` will be converted to two `allow(obj).
637
685
 
638
686
  ### Deprecated method stub aliases
639
687
 
688
+ Targets:
689
+
640
690
  ```ruby
641
- # Targets
642
691
  obj.stub!(:foo)
643
692
  obj.unstub!(:foo)
693
+ ```
694
+
695
+ Will be converted to:
644
696
 
645
- # Converted
697
+ ```ruby
646
698
  obj.stub(:foo) # with `--keep stub`
647
699
  obj.unstub(:foo)
648
700
  ```
649
701
 
650
- * Conversion can be disabled by: `--keep deprecated`
651
- * Deprecation: Deprecated since RSpec 2.14, removed in RSpec 3.0
702
+ * This conversion can be disabled by: `--keep deprecated`
703
+ * Deprecation: deprecated since RSpec 2.14, removed in RSpec 3.0
652
704
  * See also: [Consider deprecating and/or removing #stub! and #unstub! at some point · rspec/rspec-mocks](https://github.com/rspec/rspec-mocks/issues/122)
653
705
 
654
706
  ### Method stubs with deprecated specification of number of times
655
707
 
708
+ Targets:
709
+
656
710
  ```ruby
657
- # Targets
658
711
  obj.stub(:foo).any_number_of_times
659
712
  obj.stub(:foo).at_least(0)
713
+ ```
660
714
 
661
- # Converted
715
+ Will be converted to:
716
+
717
+ ```ruby
662
718
  allow(obj).to receive(:foo)
663
719
  obj.stub(:foo) # with `--keep stub`
664
720
  ```
665
721
 
666
- * Conversion can be disabled by: `--keep deprecated`
667
- * Deprecation: Deprecated since RSpec 2.14, removed in RSpec 3.0
722
+ * This conversion can be disabled by: `--keep deprecated`
723
+ * Deprecation: deprecated since RSpec 2.14, removed in RSpec 3.0
668
724
  * See also: [Don't allow at_least(0) · rspec/rspec-mocks](https://github.com/rspec/rspec-mocks/issues/133)
669
725
 
670
726
  ### Deprecated test double aliases
671
727
 
728
+ Targets:
729
+
672
730
  ```ruby
673
- # Targets
674
731
  stub('something')
675
732
  mock('something')
733
+ ```
734
+
735
+ Will be converted to:
676
736
 
677
- # Converted
737
+ ```ruby
678
738
  double('something')
679
739
  ```
680
740
 
681
- * Conversion can be disabled by: `--keep deprecated`
682
- * Deprecation: Deprecated since RSpec 2.14, removed in RSpec 3.0
741
+ * This conversion can be disabled by: `--keep deprecated`
742
+ * Deprecation: deprecated since RSpec 2.14, removed in RSpec 3.0
683
743
  * See also: [myronmarston / why_double.md - Gist](https://gist.github.com/myronmarston/6576665)
684
744
 
685
745
  ### Expectations on attribute of subject with `its`
686
746
 
687
747
  **This conversion will be disabled automatically if `rspec-its` is loaded in your spec.**
688
748
 
749
+ Targets:
750
+
689
751
  ```ruby
690
- # Targets
691
752
  <%=
692
753
  its_target = <<END
693
754
  describe 'example' do
@@ -698,29 +759,33 @@ describe 'example' do
698
759
  end
699
760
  END
700
761
  -%>
762
+ ```
701
763
 
702
- # Converted
764
+ Will be converted to:
765
+
766
+ ```ruby
703
767
  <%= Transpec::Converter.new.convert(its_target) -%>
704
768
  ```
705
769
 
706
- There's an option to continue using `its` with [rspec-its](https://github.com/rspec/rspec-its) that is a gem extracted from `rspec-core`.
707
- If you choose so, disable this conversion by either:
770
+ There's an option to continue using `its` with [rspec-its](https://github.com/rspec/rspec-its) which is a gem extracted from `rspec-core`.
771
+ If you choose to do so, disable this conversion by either:
708
772
 
709
773
  * Specify `--keep its` option manually.
710
774
  * Require `rspec-its` in your spec so that Transpec automatically disables this conversion.
711
775
 
712
776
  ---
713
777
 
714
- * Conversion can be disabled by: `--keep its`
715
- * Deprecation: Deprecated since RSpec 2.99, removed in RSpec 3.0
778
+ * This conversion can be disabled by: `--keep its`
779
+ * Deprecation: deprecated since RSpec 2.99, removed in RSpec 3.0
716
780
  * See also: [Core: its will be moved into an external gem - The Plan for RSpec 3](http://myronmars.to/n/dev-blog/2013/07/the-plan-for-rspec-3#core__will_be_moved_into_an_external_gem)
717
781
 
718
782
  ### Current example object
719
783
 
720
- **This conversion is available only if your project has `rspec` gem dependency `<%= Transpec::RSpecVersion.yielded_example_available_version %>` or later.**
784
+ **This conversion is available only if your project's RSpec is `<%= Transpec::RSpecVersion.yielded_example_available_version %>` or later.**
785
+
786
+ Targets:
721
787
 
722
788
  ```ruby
723
- # Targets
724
789
  <%=
725
790
  example_target = <<END
726
791
  module ScreenshotHelper
@@ -738,8 +803,11 @@ describe 'example page' do
738
803
  end
739
804
  END
740
805
  -%>
806
+ ```
807
+
808
+ Will be converted to:
741
809
 
742
- # Converted
810
+ ```ruby
743
811
  <%=
744
812
  rspec_version = Transpec::RSpecVersion.yielded_example_available_version
745
813
  Transpec::Converter.new(nil, rspec_version).convert(example_target)
@@ -748,24 +816,56 @@ Transpec::Converter.new(nil, rspec_version).convert(example_target)
748
816
 
749
817
  Here's an excerpt from [the warning for `RSpec::Core::ExampleGroup#example` and `#running_example` in RSpec 2.99](https://github.com/rspec/rspec-core/blob/7d6d2ca/lib/rspec/core/example_group.rb#L513-L527):
750
818
 
751
- >`RSpec::Core::ExampleGroup#example` is deprecated and will be removed in RSpec 3. There are a few options for what you can use instead:
819
+ > `RSpec::Core::ExampleGroup#example` is deprecated and will be removed in RSpec 3. There are a few options for what you can use instead:
752
820
  >
753
- >- `rspec-core`'s DSL methods (`it`, `before`, `after`, `let`, `subject`, etc) now yield the example as a block argument, and that is the recommended way to access the current example from those contexts.
754
- >- The current example is now exposed via `RSpec.current_example`, which is accessible from any context.
755
- >- If you can't update the code at this call site (e.g. because it is in an extension gem), you can use this snippet to continue making this method available in RSpec 2.99 and RSpec 3:
821
+ > - `rspec-core`'s DSL methods (`it`, `before`, `after`, `let`, `subject`, etc) now yield the example as a block argument, and that is the recommended way to access the current example from those contexts.
822
+ > - The current example is now exposed via `RSpec.current_example`, which is accessible from any context.
823
+ > - If you can't update the code at this call site (e.g. because it is in an extension gem), you can use this snippet to continue making this method available in RSpec 2.99 and RSpec 3:
756
824
  >
757
- >```ruby
758
- >RSpec.configure do |c|
759
- > c.expose_current_running_example_as :example
760
- >end
761
- >```
825
+ > ```ruby
826
+ > RSpec.configure do |c|
827
+ > c.expose_current_running_example_as :example
828
+ > end
829
+ > ```
762
830
 
763
831
  ---
764
832
 
765
- * Conversion can be disabled by: `--keep deprecated`
766
- * Deprecation: Deprecated since RSpec 2.99, removed in RSpec 3.0
833
+ * This conversion can be disabled by: `--keep deprecated`
834
+ * Deprecation: deprecated since RSpec 2.99, removed in RSpec 3.0
767
835
  * See also: [Core: DSL methods will yield the example - The Plan for RSpec 3](http://myronmars.to/n/dev-blog/2013/07/the-plan-for-rspec-3#core_dsl_methods_will_yield_the_example)
768
836
 
837
+ ### Custom matcher DSL
838
+
839
+ **This conversion is available only if your project's RSpec is `<%= Transpec::RSpecVersion.non_should_matcher_protocol_available_version %>` (not yet released) or later.**
840
+
841
+ Targets:
842
+
843
+ ```ruby
844
+ <%=
845
+ custom_matcher_dsl_target = <<END
846
+ RSpec::Matchers.define :be_awesome do
847
+ match_for_should { }
848
+ match_for_should_not { }
849
+ failure_message_for_should { }
850
+ failure_message_for_should_not { }
851
+ end
852
+ END
853
+ -%>
854
+ ```
855
+
856
+ Will be converted to:
857
+
858
+ ```ruby
859
+ <%=
860
+ rspec_version = Transpec::RSpecVersion.non_should_matcher_protocol_available_version
861
+ Transpec::Converter.new(nil, rspec_version).convert(custom_matcher_dsl_target)
862
+ -%>
863
+ ```
864
+
865
+ * This conversion can be disabled by: `--keep deprecated`
866
+ * Deprecation: deprecated since RSpec 3.0
867
+ * 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)
868
+
769
869
  ## Compatibility
770
870
 
771
871
  Tested on MRI 1.9, MRI 2.0 and JRuby in 1.9 mode.