Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of https://github.com/asynchrony/cucumber into …

…asynchrony-master
  • Loading branch information...
commit cf9cc1f91d6e56883dbbc997275e14104098545d 2 parents b3d48ea + c2e30f8
@aslakhellesoy aslakhellesoy authored
View
7 lib/cucumber/formatter/junit.rb
@@ -62,7 +62,10 @@ def scenario_name(keyword, name, file_colon_line, source_indent)
scenario_name = "Unnamed scenario" if name == ""
@scenario = scenario_name
description = "Scenario"
- description << " outline" if keyword.include?('Scenario Outline')
+ if keyword.include?('Scenario Outline')
+ description << " outline"
+ @in_examples = true
+ end
@output = "#{description}: #{@scenario}\n\n"
end
@@ -142,7 +145,7 @@ def format_exception(exception)
def feature_result_filename(feature_file)
ext_length = File.extname(feature_file).length
- basename = File.basename(feature_file)[0...-ext_length]
+ basename = feature_file.gsub(File::SEPARATOR, '_')[0...-ext_length]
File.join(@reportdir, "TEST-#{basename}.xml")
end
View
13 spec/cucumber/formatter/junit_spec.rb
@@ -51,6 +51,19 @@ def write_file(feature_filename, data)
it { @doc.to_s.should =~ /One passing scenario, one failing scenario/ }
end
+
+ describe "with a scenario in a subdirectory" do
+ define_feature %{
+ Feature: One passing scenario, one failing scenario
+
+ Scenario: Passing
+ Given a passing scenario
+ }, File.join('some', 'path', 'spec.feature')
+
+ it 'writes the filename including the subdirectory' do
+ @formatter.written_files.keys.first.should == File.join('', 'TEST-some_path_spec.xml')
+ end
+ end
describe "with a scenario outline table" do
define_steps do
View
7 spec/cucumber/formatter/spec_helper.rb
@@ -2,10 +2,11 @@ module Cucumber
module Formatter
module SpecHelperDsl
- attr_reader :feature_content, :step_defs
+ attr_reader :feature_content, :step_defs, :feature_filename
- def define_feature(string)
+ def define_feature(string, feature_file = 'spec.feature')
@feature_content = string
+ @feature_filename = feature_file
end
def define_steps(&block)
@@ -25,7 +26,7 @@ def step_mother
end
def load_features(content)
- feature_file = FeatureFile.new('spec.feature', content)
+ feature_file = FeatureFile.new(self.class.feature_filename, content)
features = Ast::Features.new
filters = []
feature = feature_file.parse(filters, {})
Please sign in to comment.
Something went wrong with that request. Please try again.