spec/cucumber/formatter/pretty_spec.rb in cucumber-3.0.0.pre.1 vs spec/cucumber/formatter/pretty_spec.rb in cucumber-3.0.0.pre.2
- old
+ new
@@ -8,77 +8,77 @@
module Formatter
describe Pretty do
extend SpecHelperDsl
include SpecHelper
- context "With no options" do
+ context 'With no options' do
before(:each) do
Cucumber::Term::ANSIColor.coloring = false
@out = StringIO.new
@formatter = Pretty.new(runtime, @out, {})
end
- describe "given a single feature" do
+ describe 'given a single feature' do
before(:each) do
run_defined_feature
end
- describe "with a scenario with no steps" do
+ describe 'with a scenario with no steps' do
define_feature <<-FEATURE
Feature: Banana party
Scenario: Monkey eats banana
FEATURE
- it "outputs the scenario name" do
- expect(@out.string).to include "Scenario: Monkey eats banana"
+ it 'outputs the scenario name' do
+ expect(@out.string).to include 'Scenario: Monkey eats banana'
end
end
- describe "with a scenario" do
+ describe 'with a scenario' do
define_feature <<-FEATURE
Feature: Banana party
Scenario: Monkey eats banana
Given there are bananas
FEATURE
- it "outputs the scenario name" do
- expect(@out.string).to include "Scenario: Monkey eats banana"
+ it 'outputs the scenario name' do
+ expect(@out.string).to include 'Scenario: Monkey eats banana'
end
- it "outputs the step" do
- expect(@out.string).to include "Given there are bananas"
+ it 'outputs the step' do
+ expect(@out.string).to include 'Given there are bananas'
end
end
- describe "with a background" do
+ describe 'with a background' do
define_feature <<-FEATURE
Feature: Banana party
Background:
Given a tree
Scenario: Monkey eats banana
Given there are bananas
FEATURE
- it "outputs the gherkin" do
+ it 'outputs the gherkin' do
expect(@out.string).to include(self.class.feature_content)
end
- it "outputs the scenario name" do
- expect(@out.string).to include "Scenario: Monkey eats banana"
+ it 'outputs the scenario name' do
+ expect(@out.string).to include 'Scenario: Monkey eats banana'
end
- it "outputs the step" do
- expect(@out.string).to include "Given there are bananas"
+ it 'outputs the step' do
+ expect(@out.string).to include 'Given there are bananas'
end
end
- describe "with a scenario outline" do
+ describe 'with a scenario outline' do
define_feature <<-FEATURE
Feature: Fud Pyramid
Scenario Outline: Monkey eats a balanced diet
Given there are <Things>
@@ -91,11 +91,11 @@
| Things |
| broccoli |
| carrots |
FEATURE
- it "outputs the scenario outline" do
+ it 'outputs the scenario outline' do
lines = <<-OUTPUT
Examples: Fruit
| Things |
| apples |
| bananas |
@@ -107,16 +107,16 @@
lines.split("\n").each do |line|
expect(@out.string).to include line.strip
end
end
- it "has 4 undefined scenarios" do
- expect(@out.string).to include "4 scenarios (4 undefined)"
+ it 'has 4 undefined scenarios' do
+ expect(@out.string).to include '4 scenarios (4 undefined)'
end
- it "has 4 undefined steps" do
- expect(@out.string).to include "4 steps (4 undefined)"
+ it 'has 4 undefined steps' do
+ expect(@out.string).to include '4 steps (4 undefined)'
end
context 'when the examples table header is wider than the rows' do
define_feature <<-FEATURE
Feature: Monkey Business
@@ -127,11 +127,11 @@
Examples:
| Types of monkey |
| Hominidae |
FEATURE
- it "outputs the scenario outline" do
+ it 'outputs the scenario outline' do
lines = <<-OUTPUT
Examples:
| Types of monkey |
| Hominidae |
OUTPUT
@@ -141,11 +141,11 @@
end
end
end
# To ensure https://rspec.lighthouseapp.com/projects/16211/tickets/475 remains fixed.
- describe "with a scenario outline with a pystring" do
+ describe 'with a scenario outline with a pystring' do
define_feature <<-FEATURE
Feature:
Scenario Outline: Monkey eats a balanced diet
Given a multiline string:
"""
@@ -155,11 +155,11 @@
Examples:
| things |
| apples |
FEATURE
- it "outputs the scenario outline" do
+ it 'outputs the scenario outline' do
lines = <<-OUTPUT
Given a multiline string:
"""
Monkeys eat <things>
"""
@@ -172,52 +172,52 @@
expect(@out.string).to include line.strip
end
end
end
- describe "with a step with a py string" do
+ describe 'with a step with a py string' do
define_feature <<-FEATURE
Feature: Traveling circus
Scenario: Monkey goes to town
Given there is a monkey called:
"""
foo
"""
FEATURE
- it "displays the pystring nested" do
+ it 'displays the pystring nested' do
expect(@out.string).to include <<OUTPUT
"""
foo
"""
OUTPUT
end
end
- describe "with a multiline step arg" do
+ describe 'with a multiline step arg' do
define_feature <<-FEATURE
Feature: Traveling circus
Scenario: Monkey goes to town
Given there are monkeys:
| name |
| foo |
| bar |
FEATURE
- it "displays the multiline string" do
+ it 'displays the multiline string' do
expect(@out.string).to include <<OUTPUT
Given there are monkeys:
| name |
| foo |
| bar |
OUTPUT
end
end
- describe "with a table in the background and the scenario" do
+ describe 'with a table in the background and the scenario' do
define_feature <<-FEATURE
Feature: accountant monkey
Background:
Given table:
@@ -227,28 +227,28 @@
Given another table:
| e | f |
| g | h |
FEATURE
- it "displays the table for the background" do
+ it 'displays the table for the background' do
expect(@out.string).to include <<OUTPUT
Given table:
| a | b |
| c | d |
OUTPUT
end
- it "displays the table for the scenario" do
+ it 'displays the table for the scenario' do
expect(@out.string).to include <<OUTPUT
Given another table:
| e | f |
| g | h |
OUTPUT
end
end
- describe "with a py string in the background and the scenario" do
+ describe 'with a py string in the background and the scenario' do
define_feature <<-FEATURE
Feature: py strings
Background:
Given stuff:
@@ -260,30 +260,30 @@
"""
bar
"""
FEATURE
- it "displays the background py string" do
+ it 'displays the background py string' do
expect(@out.string).to include <<OUTPUT
Given stuff:
"""
foo
"""
OUTPUT
end
- it "displays the scenario py string" do
+ it 'displays the scenario py string' do
expect(@out.string).to include <<OUTPUT
Given more stuff:
"""
bar
"""
OUTPUT
end
end
- describe "with output from hooks" do
+ describe 'with output from hooks' do
define_feature <<-FEATURE
Feature:
Scenario:
Given this step passes
Scenario Outline:
@@ -293,22 +293,22 @@
| passes |
FEATURE
define_steps do
Before do
- puts "Before hook"
+ puts 'Before hook'
end
AfterStep do
- puts "AfterStep hook"
+ puts 'AfterStep hook'
end
After do
- puts "After hook"
+ puts 'After hook'
end
- Given(/^this step passes$/) {}
+ Given('this step passes') {}
end
- it "displays hook output appropriately " do
+ it 'displays hook output appropriately ' do
expect( @out.string ).to include <<OUTPUT
Feature:
Scenario:
Before hook
@@ -327,33 +327,33 @@
2 steps (2 passed)
OUTPUT
end
end
- describe "with background and output from hooks" do
+ describe 'with background and output from hooks' do
define_feature <<-FEATURE
Feature:
Background:
Given this step passes
Scenario:
Given this step passes
FEATURE
define_steps do
Before do
- puts "Before hook"
+ puts 'Before hook'
end
AfterStep do
- puts "AfterStep hook"
+ puts 'AfterStep hook'
end
After do
- puts "After hook"
+ puts 'After hook'
end
- Given(/^this step passes$/) {}
+ Given('this step passes') {}
end
- it "displays hook output appropriately " do
+ it 'displays hook output appropriately ' do
expect( @out.string ).to include <<OUTPUT
Feature:
Background:
Before hook
@@ -369,11 +369,11 @@
2 steps (2 passed)
OUTPUT
end
end
- describe "with tags on all levels" do
+ describe 'with tags on all levels' do
define_feature <<-FEATURE
@tag1
Feature:
@tag2
Scenario:
@@ -386,11 +386,11 @@
| dummy |
| dummy |
FEATURE
- it "includes the tags in the output " do
+ it 'includes the tags in the output ' do
expect( @out.string ).to include <<OUTPUT
@tag1
Feature:
@tag2
@@ -407,11 +407,11 @@
| dummy |
OUTPUT
end
end
- describe "with comments on all levels" do
+ describe 'with comments on all levels' do
define_feature <<-FEATURE
#comment1
Feature:
#comment2
Background:
@@ -434,11 +434,11 @@
#comment11
| dummy |
FEATURE
- it "includes the all comments except for data table rows in the output " do
+ it 'includes the all comments except for data table rows in the output ' do
expect( @out.string ).to include <<OUTPUT
#comment1
Feature:
#comment2
@@ -467,40 +467,40 @@
end
end
end
end
- context "With --no-multiline passed as an option" do
+ context 'With --no-multiline passed as an option' do
before(:each) do
Cucumber::Term::ANSIColor.coloring = false
@out = StringIO.new
@formatter = Pretty.new(runtime, @out, {:no_multiline => true})
end
- describe "given a single feature" do
+ describe 'given a single feature' do
before(:each) do
run_defined_feature
end
- describe "with a scenario" do
+ describe 'with a scenario' do
define_feature <<-FEATURE
Feature: Banana party
Scenario: Monkey eats banana
Given there are bananas
FEATURE
- it "outputs the scenario name" do
- expect(@out.string).to include "Scenario: Monkey eats banana"
+ it 'outputs the scenario name' do
+ expect(@out.string).to include 'Scenario: Monkey eats banana'
end
- it "outputs the step" do
- expect(@out.string).to include "Given there are bananas"
+ it 'outputs the step' do
+ expect(@out.string).to include 'Given there are bananas'
end
end
- describe "with a scenario outline" do
+ describe 'with a scenario outline' do
define_feature <<-FEATURE
Feature: Fud Pyramid
Scenario Outline: Monkey eats a balanced diet
Given there are <Things>
@@ -513,11 +513,11 @@
| Things |
| broccoli |
| carrots |
FEATURE
- it "outputs the scenario outline" do
+ it 'outputs the scenario outline' do
lines = <<-OUTPUT
Examples: Fruit
| Things |
| apples |
| bananas |
@@ -529,60 +529,60 @@
lines.split("\n").each do |line|
expect(@out.string).to include line.strip
end
end
- it "has 4 undefined scenarios" do
- expect(@out.string).to include "4 scenarios (4 undefined)"
+ it 'has 4 undefined scenarios' do
+ expect(@out.string).to include '4 scenarios (4 undefined)'
end
- it "has 4 undefined steps" do
- expect(@out.string).to include "4 steps (4 undefined)"
+ it 'has 4 undefined steps' do
+ expect(@out.string).to include '4 steps (4 undefined)'
end
end
- describe "with a step with a py string" do
+ describe 'with a step with a py string' do
define_feature <<-FEATURE
Feature: Traveling circus
Scenario: Monkey goes to town
Given there is a monkey called:
"""
foo
"""
FEATURE
- it "does not display the pystring" do
+ it 'does not display the pystring' do
expect(@out.string).not_to include <<OUTPUT
"""
foo
"""
OUTPUT
end
end
- describe "with a multiline step arg" do
+ describe 'with a multiline step arg' do
define_feature <<-FEATURE
Feature: Traveling circus
Scenario: Monkey goes to town
Given there are monkeys:
| name |
| foo |
| bar |
FEATURE
- it "does not display the multiline string" do
+ it 'does not display the multiline string' do
expect(@out.string).not_to include <<OUTPUT
| name |
| foo |
| bar |
OUTPUT
end
end
- describe "with a table in the background and the scenario" do
+ describe 'with a table in the background and the scenario' do
define_feature <<-FEATURE
Feature: accountant monkey
Background:
Given table:
@@ -592,25 +592,25 @@
Given another table:
| e | f |
| g | h |
FEATURE
- it "does not display the table for the background" do
+ it 'does not display the table for the background' do
expect(@out.string).not_to include <<OUTPUT
| a | b |
| c | d |
OUTPUT
end
- it "does not display the table for the scenario" do
+ it 'does not display the table for the scenario' do
expect(@out.string).not_to include <<OUTPUT
| e | f |
| g | h |
OUTPUT
end
end
- describe "with a py string in the background and the scenario" do
+ describe 'with a py string in the background and the scenario' do
define_feature <<-FEATURE
Feature: py strings
Background:
Given stuff:
@@ -622,42 +622,42 @@
"""
bar
"""
FEATURE
- it "does not display the background py string" do
+ it 'does not display the background py string' do
expect(@out.string).not_to include <<OUTPUT
"""
foo
"""
OUTPUT
end
- it "does not display the scenario py string" do
+ it 'does not display the scenario py string' do
expect(@out.string).not_to include <<OUTPUT
"""
bar
"""
OUTPUT
end
end
end
end
- context "In --expand mode" do
+ context 'In --expand mode' do
let(:options) { { expand: true } }
before(:each) do
Cucumber::Term::ANSIColor.coloring = false
@out = StringIO.new
@formatter = Pretty.new(runtime, @out, {})
end
- describe "given a single feature" do
+ describe 'given a single feature' do
before(:each) do
run_defined_feature
end
- describe "with a scenario outline" do
+ describe 'with a scenario outline' do
define_feature <<-FEATURE
Feature: Fud Pyramid
Scenario Outline: Monkey eats a balanced diet
Given there are <Things>
@@ -670,11 +670,11 @@
| Things |
| broccoli |
| carrots |
FEATURE
- it "outputs the instantiated scenarios" do
+ it 'outputs the instantiated scenarios' do
lines = <<-OUTPUT
Examples: Fruit
Scenario: | apples |
Given there are apples
Scenario: | bananas |
@@ -689,11 +689,11 @@
expect(@out.string).to include line.strip
end
end
end
- describe "with a scenario outline in en-lol" do
+ describe 'with a scenario outline in en-lol' do
define_feature <<-FEATURE
# language: en-lol
OH HAI: STUFFING
MISHUN SRSLY: CUCUMBR
@@ -705,11 +705,11 @@
EXAMPLZ:
| BEGINNIN | EAT | KTHXBAI |
| 3 | 2 | 1 |
FEATURE
- it "outputs localized text" do
+ it 'outputs localized text' do
lines = <<-OUTPUT
OH HAI: STUFFING
MISHUN SRSLY: CUCUMBR
I CAN HAZ IN TEH BEGINNIN <BEGINNIN> CUCUMBRZ
@@ -729,24 +729,24 @@
end
end
end
end
- context "In --expand mode with --source as an option" do
+ context 'In --expand mode with --source as an option' do
let(:options) { { expand: true } }
before(:each) do
Cucumber::Term::ANSIColor.coloring = false
@out = StringIO.new
@formatter = Pretty.new(runtime, @out, {:source => true})
end
- describe "given a single feature" do
+ describe 'given a single feature' do
before(:each) do
run_defined_feature
end
- describe "with a scenario outline" do
+ describe 'with a scenario outline' do
define_feature <<-FEATURE
Feature: Fud Pyramid
Scenario Outline: Monkey eats a balanced diet
Given there are <Things>
@@ -759,11 +759,11 @@
| Things |
| broccoli |
| carrots |
FEATURE
- it "includes the source in the output" do
+ it 'includes the source in the output' do
lines = <<-OUTPUT
Scenario Outline: Monkey eats a balanced diet # spec.feature:3
Given there are <Things> # spec.feature:4
Examples: Fruit
Scenario: | apples | # spec.feature:8
@@ -779,11 +779,11 @@
lines.split("\n").each do |line|
expect(@out.string).to include line.strip
end
end
- context "With very wide cells" do
+ context 'With very wide cells' do
define_feature <<-FEATURE
Feature: Monkey Business
Scenario Outline: Types of monkey
Given there are <Types of monkey>
@@ -791,11 +791,11 @@
Examples:
| Types of monkey | Extra |
| Hominidae | Very long cell content |
FEATURE
- it "the scenario line controls the source indentation" do
+ it 'the scenario line controls the source indentation' do
lines = <<-OUTPUT
Examples:
Scenario: | Hominidae | Very long cell content | # spec.feature:8
Given there are Hominidae # spec.feature:8
@@ -807,20 +807,20 @@
end
end
end
end
- context "snippets contain relevant keyword replacements" do
+ context 'snippets contain relevant keyword replacements' do
before(:each) do
Cucumber::Term::ANSIColor.coloring = false
@out = StringIO.new
@formatter = Pretty.new(runtime, @out, {snippets: true})
run_defined_feature
end
- describe "With a scenario that has undefined steps" do
+ describe 'With a scenario that has undefined steps' do
define_feature <<-FEATURE
Feature: Banana party
Scenario: many monkeys eat many things
Given there are bananas and apples
@@ -830,16 +830,16 @@
Then bananas remain
But there are no apples left
FEATURE
it "containes snippets with 'And' or 'But' replaced by previous step name" do
- expect(@out.string).to include("Given(/^there are bananas and apples$/)")
- expect(@out.string).to include("Given(/^other monkeys are around$/)")
- expect(@out.string).to include("When(/^one monkey eats a banana$/)")
- expect(@out.string).to include("When(/^the other monkeys eat all the apples$/)")
- expect(@out.string).to include("Then(/^bananas remain$/)")
- expect(@out.string).to include("Then(/^there are no apples left$/)")
+ expect(@out.string).to include('Given("there are bananas and apples")')
+ expect(@out.string).to include('Given("other monkeys are around")')
+ expect(@out.string).to include('When("one monkey eats a banana")')
+ expect(@out.string).to include('When("the other monkeys eat all the apples")')
+ expect(@out.string).to include('Then("bananas remain")')
+ expect(@out.string).to include('Then("there are no apples left")')
end
end
describe "With a scenario that uses * and 'But'" do
define_feature <<-FEATURE
@@ -852,16 +852,16 @@
* the other monkeys eat all the apples
Then bananas remain
* there are no apples left
FEATURE
it "replaces the first step with 'Given'" do
- expect(@out.string).to include("Given(/^there are bananas and apples$/)")
+ expect(@out.string).to include('Given("there are bananas and apples")')
end
it "uses actual keywords as the 'previous' keyword for future replacements" do
- expect(@out.string).to include("Given(/^other monkeys are around$/)")
- expect(@out.string).to include("When(/^the other monkeys eat all the apples$/)")
- expect(@out.string).to include("Then(/^there are no apples left$/)")
+ expect(@out.string).to include('Given("other monkeys are around")')
+ expect(@out.string).to include('When("the other monkeys eat all the apples")')
+ expect(@out.string).to include('Then("there are no apples left")')
end
end
describe "With a scenario where the only undefined step uses 'And'" do
define_feature <<-FEATURE
@@ -871,14 +871,14 @@
Given this step passes
Then this step passes
And this step is undefined
FEATURE
define_steps do
- Given(/^this step passes$/) {}
+ Given('this step passes') {}
end
- it "uses actual keyword of the previous passing step for the undefined step" do
- expect(@out.string).to include("Then(/^this step is undefined$/)")
+ it 'uses actual keyword of the previous passing step for the undefined step' do
+ expect(@out.string).to include('Then("this step is undefined")')
end
end
describe "With scenarios where the first step is undefined and uses '*'" do
define_feature <<-FEATURE
@@ -891,28 +891,28 @@
Scenario:
* this step is also undefined
Then this step passes
FEATURE
define_steps do
- Given(/^this step passes$/) {}
+ Given('this step passes') {}
end
it "uses 'Given' as actual keyword the step in each scenario" do
- expect(@out.string).to include("Given(/^this step is undefined$/)")
- expect(@out.string).to include("Given(/^this step is also undefined$/)")
+ expect(@out.string).to include('Given("this step is undefined")')
+ expect(@out.string).to include('Given("this step is also undefined")')
end
end
- describe "with a scenario in en-lol" do
+ describe 'with a scenario in en-lol' do
define_feature <<-FEATURE
# language: en-lol
OH HAI: STUFFING
MISHUN: CUCUMBR
I CAN HAZ IN TEH BEGINNIN CUCUMBRZ
AN I EAT CUCUMBRZ
FEATURE
- it "uses actual keyword of the previous passing step for the undefined step" do
- expect(@out.string).to include("ICANHAZ(/^I EAT CUCUMBRZ$/)")
+ it 'uses actual keyword of the previous passing step for the undefined step' do
+ expect(@out.string).to include('ICANHAZ("I EAT CUCUMBRZ")')
end
end
end
end
end