Skip to content

Commit

Permalink
Require features so step definitions can be found
Browse files Browse the repository at this point in the history
The cucumber command, by virtue of using the `--require` option to
include the SlimJSON formatter, was not correctly including step
definitions that could be defined in sibling directories of the
features/ directory. It's necessary to explicitly include features/ to
get these included. Turns out one of the self-tests was wrong (expecting
error, meaning undefined step, instead of pass/fail like it should have
had). Fixed.
  • Loading branch information
wapcaplet committed Jul 9, 2011
1 parent 7044162 commit 5ecd58b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions features/cuke_fixture.feature
Expand Up @@ -139,7 +139,7 @@ Feature: Cuke fixture
[
["report:Feature: Passing"],
["report:Scenario: Passing"],
["error:Given a step passes"]
["pass:Given a step passes"]
]
"""

Expand All @@ -148,7 +148,7 @@ Feature: Cuke fixture
[
["report:Feature: Failing"],
["report:Scenario: Failing"],
["error:Given a step fails"]
["fail:Given a step fails"]
]
"""

Expand Down
7 changes: 5 additions & 2 deletions lib/cukable/cuke.rb
Expand Up @@ -304,13 +304,16 @@ def run_cucumber(feature_filenames)
# Tell cucumber to require the directory where this file lives,
# so it can find the SlimJSON formatter
req = "--require #{File.expand_path(File.dirname(__FILE__))}"
req += " --require features"
format = "--format Cucumber::Formatter::SlimJSON"
output = "--out #{@output_dir}"
args = @cucumber_args
features = feature_filenames.join(" ")
cucumber_cmd = "cucumber #{req} #{format} #{output} #{args} #{features}"

#puts "cucumber #{req} #{format} #{output} #{args} #{features}"
system "cucumber #{req} #{format} #{output} #{args} #{features}"
in_project_dir do
system cucumber_cmd
end

# TODO: Ensure that the correct number of output files were written
#if !File.exist?(@results_filename)
Expand Down

0 comments on commit 5ecd58b

Please sign in to comment.