lib/allure-cucumber/dsl.rb in allure-cucumber-0.4.4 vs lib/allure-cucumber/dsl.rb in allure-cucumber-0.5.0

- old
+ new

@@ -1,10 +1,15 @@ module AllureCucumber module DSL def attach_file(title, file) @tracker = AllureCucumber::FeatureTracker.tracker - AllureRubyAdaptorApi::Builder.add_attachment(@tracker.feature_name, @tracker.scenario_name, :step => @tracker.step_name, :file => file, :title => title) + if @tracker.scenario_name + AllureRubyAdaptorApi::Builder.add_attachment(@tracker.feature_name, @tracker.scenario_name, :step => @tracker.step_name, :file => file, :title => title) + else + # TODO: This is possible for background steps. + puts "Cannot attach #{title} to step #{@tracker.step_name} as scenario name is undefined" + end end end end