forked from troessner/reek
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more cucumber features for bad config files
- Loading branch information
1 parent
849485c
commit 715bbbc
Showing
10 changed files
with
66 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@samples | ||
Feature: Basic smell detection | ||
In order to write better software | ||
As a developer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
When /^I run reek (.*)$/ do |args| | ||
@last_output = `ruby -Ilib bin/reek #{args}` | ||
@last_exit_status = $?.exitstatus | ||
run args | ||
end | ||
|
||
Then /^it fails with exit status (\d+)$/ do |status| | ||
@last_exit_status.should == status.to_i | ||
end | ||
|
||
Then /^it reports:$/ do |report| | ||
@last_output.should == report | ||
@last_stdout.should == report | ||
end | ||
|
||
Then /^it displays the error message:$/ do |string| | ||
@last_stderr.should == string | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'rubygems' | ||
require 'tempfile' | ||
require 'spec/expectations' | ||
require 'fileutils' | ||
|
||
class CucumberWorld | ||
|
||
def run(args) | ||
stderr_file = Tempfile.new('cucumber') | ||
stderr_file.close | ||
@last_stdout = `ruby -Ilib bin/reek #{args} 2> #{stderr_file.path}` | ||
@last_exit_status = $?.exitstatus | ||
@last_stderr = IO.read(stderr_file.path) | ||
end | ||
end | ||
|
||
World do | ||
CucumberWorld.new | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is not a config file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Dirty | ||
def a | ||
puts @s.title | ||
@s.map {|x| x.each {|key| key += 3}} | ||
puts @s.title | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ def a | |
@s.map {|x| x.each {|key| key += 3}} | ||
puts @s.title | ||
end | ||
end | ||
end |