Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
Updated some integration tests that were broken by the new linter.
  • Loading branch information
enkessler committed Jan 11, 2020
1 parent a66646a commit f580d8f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
14 changes: 7 additions & 7 deletions testing/cucumber/features/command_line.feature
Expand Up @@ -57,14 +57,14 @@ Feature: Using cuke_linter on the command line
"""

Scenario: Specifying directories and files to lint
Given the following feature file "some.feature":
Given the following feature file "some_feature.feature":
"""
Feature: Some feature
Scenario: A scenario
When a step
Then a step
"""
And the following feature file "a_directory/with_a.feature":
And the following feature file "a_directory/with/some_feature.feature":
"""
Feature: Some feature
Scenario: A scenario
Expand All @@ -73,14 +73,14 @@ Feature: Using cuke_linter on the command line
"""
When the following command is executed:
"""
cuke_linter -p <path_to>/some.feature -p <path_to>/a_directory
cuke_linter -p <path_to>/some_feature.feature -p <path_to>/a_directory
"""
Then the resulting output is the following:
"""
FeatureWithoutDescriptionLinter
Feature has no description
<path_to>/a_directory/with_a.feature:1
<path_to>/some.feature:1
<path_to>/a_directory/with/some_feature.feature:1
<path_to>/some_feature.feature:1
2 issues found
"""
Expand Down Expand Up @@ -173,8 +173,8 @@ Feature: Using cuke_linter on the command line

Given the following feature file "has_no_scenarios.feature":
"""
Feature: This feature
has no scenarios
Feature: Has no scenarios
Not a single one
"""
And the following configuration file "my_config.file":
"""
Expand Down
15 changes: 8 additions & 7 deletions testing/rspec/spec/integration/cli_integration_spec.rb
Expand Up @@ -99,7 +99,7 @@
let!(:linted_file) { CukeLinter::FileHelper.create_file(directory: test_directory,
name: 'nothing_wrong',
extension: '.feature',
text: 'Feature: A name
text: 'Feature: Nothing wrong
A description
Scenario: A scenario
When a step
Expand Down Expand Up @@ -148,14 +148,14 @@

context 'with path arguments' do
let(:file_1) { CukeLinter::FileHelper.create_file(directory: test_directory,
name: 'some',
name: 'some_feature',
extension: '.feature',
text: 'Feature: Some feature
Scenario: A scenario
When a step
Then a step') }
let(:file_2) { CukeLinter::FileHelper.create_file(directory: test_directory,
name: 'a_directory/with_a',
name: 'a_directory/with/some_feature',
extension: '.feature',
text: 'Feature: Some feature
Scenario: A scenario
Expand All @@ -165,12 +165,13 @@
let(:file_2_directory) { File.dirname(file_2) }
let(:command) { "bundle exec ruby #{executable_path} #{flag} #{file_1_path} #{flag} #{file_2_directory}" }

# TODO: add a negative test that makes sure that non-included paths aren't linted when paths are explicitly included

it "lints that locations specified by '#{path_flag}'" do
expect(results[:std_out]).to eq(['FeatureWithoutDescriptionLinter',
' Feature has no description',
' <path_to>/a_directory/with_a.feature:1',
' <path_to>/some.feature:1',
' <path_to>/a_directory/with/some_feature.feature:1',
' <path_to>/some_feature.feature:1',
'',
'2 issues found',
''].join("\n").gsub('<path_to>', test_directory))
Expand Down Expand Up @@ -209,7 +210,7 @@
let(:flag) { formatter_flag }

context 'with formatter arguments' do
let(:linted_file) { CukeLinter::FileHelper.create_file(name: 'some',
let(:linted_file) { CukeLinter::FileHelper.create_file(name: 'some_feature',
extension: '.feature',
text: 'Feature: Some feature
Scenario: A scenario
Expand Down Expand Up @@ -275,7 +276,7 @@ def format(data)
context 'with output arguments' do
let(:output_location) { "#{CukeLinter::FileHelper.create_directory}/output.txt" }
let(:other_output_location) { "#{CukeLinter::FileHelper.create_directory}/other_output.txt" }
let(:linted_file) { CukeLinter::FileHelper.create_file(name: 'some',
let(:linted_file) { CukeLinter::FileHelper.create_file(name: 'some_feature',
extension: '.feature',
text: 'Feature: Some feature
Scenario: A scenario
Expand Down
Expand Up @@ -81,6 +81,8 @@
linting_options.delete(:model_trees)
end

# TODO: add a negative test that makes sure that non-included paths aren't linted when paths are explicitly included

it 'lints every model in each path' do
results = subject.lint(linting_options)

Expand Down

0 comments on commit f580d8f

Please sign in to comment.