forked from troessner/reek
/
reek_steps.rb
51 lines (39 loc) · 1.18 KB
/
reek_steps.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
When /^I run reek (.*)$/ do |args|
reek(args)
end
When /^I pass "([^\"]*)" to reek *(.*)$/ do |stdin, args|
reek_with_pipe(stdin, args)
end
When /^I run rake (\w*) with:$/ do |name, task_def|
rake(name, task_def)
end
Then /^stdout equals "([^\"]*)"$/ do |report|
@last_stdout.should == report
end
Then /^stdout includes \/([^\"]*)\/$/ do |report|
@last_stdout.should match(report)
end
Then /^it succeeds$/ do
@last_exit_status.should == Reek::Cli::Application::STATUS_SUCCESS
end
Then /^the exit status indicates an error$/ do
@last_exit_status.should == Reek::Cli::Application::STATUS_ERROR
end
Then /^the exit status indicates smells$/ do
@last_exit_status.should == Reek::Cli::Application::STATUS_SMELLS
end
Then /^it reports:$/ do |report|
@last_stdout.chomp.should == report.chomp
end
Then /^it reports something like: (.*)$/ do |line|
@last_stdout.chomp.should match Regexp.new(Regexp.escape(line))
end
Then /^stderr reports:$/ do |report|
@last_stderr.should == report
end
Then /^it reports the error ['"](.*)['"]$/ do |string|
@last_stderr.chomp.should == string
end
Then /^it reports the current version$/ do
@last_stdout.should == "reek #{Reek::VERSION}\n"
end