83
106
lines.split("\n").each do |line|
84
@out.string.should include line.strip
107
expect(@out.string).to include line.strip
87
111
it "has 4 undefined scenarios" do
88
@out.string.should include "4 scenarios (4 undefined)"
112
expect(@out.string).to include "4 scenarios (4 undefined)"
90
115
it "has 4 undefined steps" do
91
@out.string.should include "4 steps (4 undefined)"
116
expect(@out.string).to include "4 steps (4 undefined)"
119
context 'when the examples table header is wider than the rows' do
120
define_feature <<-FEATURE
121
Feature: Monkey Business
123
Scenario Outline: Types of monkey
124
Given there are <Types of monkey>
131
it "outputs the scenario outline" do
137
lines.split("\n").each do |line|
138
expect(@out.string).to include line.strip
144
# To ensure https://rspec.lighthouseapp.com/projects/16211/tickets/475 remains fixed.
145
describe "with a scenario outline with a pystring" do
146
define_feature <<-FEATURE
148
Scenario Outline: Monkey eats a balanced diet
149
Given a multiline string:
159
it "outputs the scenario outline" do
161
Given a multiline string:
170
lines.split("\n").each do |line|
171
expect(@out.string).to include line.strip
96
176
describe "with a step with a py string" do
548
context "In --expand mode" do
549
let(:runtime) { Runtime.new({:expand => true})}
551
Cucumber::Term::ANSIColor.coloring = false
553
@formatter = Pretty.new(runtime, @out, {})
556
describe "given a single feature" do
561
describe "with a scenario outline" do
562
define_feature <<-FEATURE
565
Scenario Outline: Monkey eats a balanced diet
566
Given there are <Things>
578
it "outputs the instantiated scenarios" do
582
Given there are apples
583
Scenario: | bananas |
584
Given there are bananas
586
Scenario: | broccoli |
587
Given there are broccoli
588
Scenario: | carrots |
589
Given there are carrots
591
lines.split("\n").each do |line|
592
expect(@out.string).to include line.strip
597
describe "with a scenario outline in en-lol" do
598
define_feature <<-FEATURE
602
MISHUN SRSLY: CUCUMBR
603
I CAN HAZ IN TEH BEGINNIN <BEGINNIN> CUCUMBRZ
604
WEN I EAT <EAT> CUCUMBRZ
605
DEN I HAS <EAT> CUCUMBERZ IN MAH BELLY
606
AN IN TEH END <KTHXBAI> CUCUMBRZ KTHXBAI
609
| BEGINNIN | EAT | KTHXBAI |
613
it "outputs localized text" do
617
MISHUN SRSLY: CUCUMBR
618
I CAN HAZ IN TEH BEGINNIN <BEGINNIN> CUCUMBRZ
619
WEN I EAT <EAT> CUCUMBRZ
620
DEN I HAS <EAT> CUCUMBERZ IN MAH BELLY
621
AN IN TEH END <KTHXBAI> CUCUMBRZ KTHXBAI
623
MISHUN: | 3 | 2 | 1 |
624
I CAN HAZ IN TEH BEGINNIN 3 CUCUMBRZ
626
DEN I HAS 2 CUCUMBERZ IN MAH BELLY
627
AN IN TEH END 1 CUCUMBRZ KTHXBAI
629
lines.split("\n").each do |line|
630
expect(@out.string).to include line.strip
637
context "In --expand mode with --source as an option" do
638
let(:runtime) { Runtime.new({:expand => true})}
640
Cucumber::Term::ANSIColor.coloring = false
642
@formatter = Pretty.new(runtime, @out, {:source => true})
645
describe "given a single feature" do
650
describe "with a scenario outline" do
651
define_feature <<-FEATURE
654
Scenario Outline: Monkey eats a balanced diet
655
Given there are <Things>
667
it "includes the source in the output" do
669
Scenario Outline: Monkey eats a balanced diet # spec.feature:3
670
Given there are <Things> # spec.feature:4
672
Scenario: | apples | # spec.feature:8
673
Given there are apples # spec.feature:8
674
Scenario: | bananas | # spec.feature:9
675
Given there are bananas # spec.feature:9
677
Scenario: | broccoli | # spec.feature:12
678
Given there are broccoli # spec.feature:12
679
Scenario: | carrots | # spec.feature:13
680
Given there are carrots # spec.feature:13
682
lines.split("\n").each do |line|
683
expect(@out.string).to include line.strip
687
context "With very wide cells" do
688
define_feature <<-FEATURE
689
Feature: Monkey Business
691
Scenario Outline: Types of monkey
692
Given there are <Types of monkey>
695
| Types of monkey | Extra |
696
| Hominidae | Very long cell content |
699
it "the scenario line controls the source indentation" do
702
Scenario: | Hominidae | Very long cell content | # spec.feature:8
703
Given there are Hominidae # spec.feature:8
706
lines.split("\n").each do |line|
707
expect(@out.string).to include line.strip
715
context "snippets contain relevant keyword replacements" do
718
Cucumber::Term::ANSIColor.coloring = false
720
@formatter = Pretty.new(runtime, @out, {snippets: true})
724
describe "With a scenario that has undefined steps" do
725
define_feature <<-FEATURE
726
Feature: Banana party
728
Scenario: many monkeys eat many things
729
Given there are bananas and apples
730
And other monkeys are around
731
When one monkey eats a banana
732
And the other monkeys eat all the apples
734
But there are no apples left
737
it "containes snippets with 'And' or 'But' replaced by previous step name" do
738
expect(@out.string).to include("Given(/^there are bananas and apples$/)")
739
expect(@out.string).to include("Given(/^other monkeys are around$/)")
740
expect(@out.string).to include("When(/^one monkey eats a banana$/)")
741
expect(@out.string).to include("When(/^the other monkeys eat all the apples$/)")
742
expect(@out.string).to include("Then(/^bananas remain$/)")
743
expect(@out.string).to include("Then(/^there are no apples left$/)")
747
describe "With a scenario that uses * and 'But'" do
748
define_feature <<-FEATURE
749
Feature: Banana party
751
Scenario: many monkeys eat many things
752
* there are bananas and apples
753
* other monkeys are around
754
When one monkey eats a banana
755
* the other monkeys eat all the apples
757
* there are no apples left
759
it "replaces the first step with 'Given'" do
760
expect(@out.string).to include("Given(/^there are bananas and apples$/)")
762
it "uses actual keywords as the 'previous' keyword for future replacements" do
763
expect(@out.string).to include("Given(/^other monkeys are around$/)")
764
expect(@out.string).to include("When(/^the other monkeys eat all the apples$/)")
765
expect(@out.string).to include("Then(/^there are no apples left$/)")
769
describe "With a scenario where the only undefined step uses 'And'" do
770
define_feature <<-FEATURE
774
Given this step passes
775
Then this step passes
776
And this step is undefined
779
Given(/^this step passes$/) {}
781
it "uses actual keyword of the previous passing step for the undefined step" do
782
expect(@out.string).to include("Then(/^this step is undefined$/)")
786
describe "With scenarios where the first step is undefined and uses '*'" do
787
define_feature <<-FEATURE
791
* this step is undefined
792
Then this step passes
795
* this step is also undefined
796
Then this step passes
799
Given(/^this step passes$/) {}
801
it "uses 'Given' as actual keyword the step in each scenario" do
802
expect(@out.string).to include("Given(/^this step is undefined$/)")
803
expect(@out.string).to include("Given(/^this step is also undefined$/)")
807
describe "with a scenario in en-lol" do
808
define_feature <<-FEATURE
813
I CAN HAZ IN TEH BEGINNIN CUCUMBRZ
816
it "uses actual keyword of the previous passing step for the undefined step" do
817
expect(@out.string).to include("ICANHAZ(/^I EAT CUCUMBRZ$/)")