spec/cucumber/formatter/legacy_api/adapter_spec.rb in cucumber-3.0.0.pre.2 vs spec/cucumber/formatter/legacy_api/adapter_spec.rb in cucumber-3.0.0

- old
+ new

@@ -109,10 +109,11 @@ end ] runner = Core::Test::Runner.new(events) compile gherkin_docs, runner, default_filters events.test_run_finished + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -147,80 +148,23 @@ :after_steps, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end - it 'a scenario with no steps' do - execute_gherkin do - feature do - scenario - end - end - - expect( formatter.legacy_messages ).to eq [ - :before_features, - :before_feature, - :before_tags, - :after_tags, - :feature_name, - :before_feature_element, - :before_tags, - :after_tags, - :scenario_name, - :after_feature_element, - :after_feature, - :after_features - ] - end - - it 'a scenario with no steps coming after another scenario' do - execute_gherkin do - feature do - scenario do - step 'passing' - end - scenario - end - end - expect( formatter.legacy_messages ).to eq [ - :before_features, - :before_feature, - :before_tags, - :after_tags, - :feature_name, - :before_feature_element, - :before_tags, - :after_tags, - :scenario_name, - :before_steps, - :before_step, - :before_step_result, - :step_name, - :after_step_result, - :after_step, - :after_steps, - :after_feature_element, - :before_feature_element, - :before_tags, - :after_tags, - :scenario_name, - :after_feature_element, - :after_feature, - :after_features - ] - end - it 'a scenario with one step' do execute_gherkin do feature do scenario do step 'passing' end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -238,10 +182,11 @@ :after_steps, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a scenario with two steps, one of them failing' do execute_gherkin do feature do @@ -289,10 +234,12 @@ scenario do step 'passing' end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -322,10 +269,11 @@ :after_steps, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background and an empty scenario' do execute_gherkin do feature do @@ -333,10 +281,12 @@ step 'passing' end scenario end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -357,10 +307,11 @@ :scenario_name, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background and two scenarios' do execute_gherkin do feature do @@ -373,10 +324,12 @@ scenario do step 'passing' end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -416,10 +369,11 @@ :after_steps, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background and one scenario and one scenario outline' do execute_gherkin do feature do @@ -436,10 +390,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -498,10 +454,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background and one scenario outline and one scenario' do execute_gherkin do feature do @@ -518,10 +475,12 @@ scenario do step 'passing' end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -580,10 +539,11 @@ :after_steps, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background and two scenario outlines' do execute_gherkin do feature do @@ -604,10 +564,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -685,10 +647,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background and one scenario outline with two rows' do execute_gherkin do feature do @@ -703,10 +666,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -758,10 +723,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background and one scenario outline with two examples tables' do execute_gherkin do feature do @@ -779,10 +745,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -846,10 +814,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background with two steps' do execute_gherkin do feature do @@ -860,10 +829,12 @@ scenario do step 'passing' end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -896,10 +867,11 @@ :after_steps, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a background' do execute_gherkin do feature do @@ -954,10 +926,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -994,10 +968,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'scenario outline after scenario' do execute_gherkin do feature do @@ -1011,10 +986,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -1063,10 +1040,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'scenario outline before scenario' do execute_gherkin do feature do @@ -1080,10 +1058,12 @@ scenario do step 'passing' end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -1132,10 +1112,11 @@ :after_steps, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'scenario outline two rows' do execute_gherkin do feature do @@ -1147,10 +1128,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -1192,10 +1175,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'scenario outline two examples tables' do execute_gherkin do feature do @@ -1210,10 +1194,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -1267,10 +1253,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'two scenario outline' do execute_gherkin do feature do @@ -1288,10 +1275,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -1359,10 +1348,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'failing scenario outline' do execute_gherkin do feature do @@ -1373,10 +1363,12 @@ row 'fail' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -1413,10 +1405,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end it 'a feature with a failing background and two scenarios' do execute_gherkin do feature do @@ -1429,10 +1422,12 @@ scenario do step 'passing' end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -1473,10 +1468,11 @@ :after_steps, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end context 'in expand mode' do let(:runtime) { Runtime.new expand: true } let(:formatter) { MessageSpy.new } @@ -1492,10 +1488,12 @@ row 'pass' end end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq [ :before_features, :before_feature, :before_tags, :after_tags, @@ -1534,10 +1532,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ] + # rubocop:enable AlignArray end end context 'with exception in after step hook' do @@ -1559,10 +1558,12 @@ scenario do step 'passing' end end end + + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -1580,11 +1581,12 @@ :exception, :after_steps, :after_feature_element, :after_feature, :after_features - ]) + ]) + # rubocop:enable AlignArray end end context 'with exception in a single before hook' do class FailingBeforeHook @@ -1606,10 +1608,11 @@ step 'passing' end end end + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -1627,11 +1630,12 @@ :after_step, :after_steps, :after_feature_element, :after_feature, :after_features - ]) + ]) + # rubocop:enable AlignArray end it 'prints the exception after the background name' do filters = [ Filters::ActivateSteps.new(step_match_search, runtime.configuration), @@ -1647,10 +1651,11 @@ step 'passing' end end end + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -1678,11 +1683,12 @@ :after_step, :after_steps, :after_feature_element, :after_feature, :after_features - ]) + ]) + # rubocop:enable AlignArray end it 'prints the exception before the examples table row' do filters = [ @@ -1700,10 +1706,11 @@ end end end end + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -1741,10 +1748,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ]) + # rubocop:enable AlignArray end end context 'with exception in the first of several before hooks' do # This proves that the second before hook's result doesn't overwrite @@ -1769,10 +1777,11 @@ step 'passing' end end end + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -1790,11 +1799,12 @@ :after_step, :after_steps, :after_feature_element, :after_feature, :after_features - ]) + ]) + # rubocop:enable AlignArray end end context 'with exception in after hooks' do @@ -1817,10 +1827,11 @@ step 'passing' end end end + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -1839,10 +1850,11 @@ :exception, :after_feature_element, :after_feature, :after_features ]) + # rubocop:enable AlignArray end it 'prints the exception after the examples table row' do filters = [ Filters::ActivateSteps.new(step_match_search, runtime.configuration), @@ -1859,10 +1871,11 @@ end end end end + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -1900,10 +1913,11 @@ :after_examples_array, :after_feature_element, :after_feature, :after_features ]) + # rubocop:enable AlignArray end end context 'with exception in the first of several after hooks' do class FailingThenPassingAfterHooks @@ -1926,10 +1940,11 @@ step 'passing' end end end + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -1948,45 +1963,14 @@ :exception, :after_feature_element, :after_feature, :after_features ]) + # rubocop:enable AlignArray end end - context 'with an exception in an after hook but no steps' do - it 'prints the exception after the scenario name' do - filters = [ - Filters::ActivateSteps.new(step_match_search, runtime.configuration), - Filters::ApplyAfterHooks.new(FailingAfterHook.new), - AddBeforeAndAfterHooks.new - ] - execute_gherkin(filters) do - feature do - scenario do - end - end - end - - expect( formatter.legacy_messages ).to eq([ - :before_features, - :before_feature, - :before_tags, - :after_tags, - :feature_name, - :before_feature_element, - :before_tags, - :after_tags, - :scenario_name, - :exception, - :after_feature_element, - :after_feature, - :after_features - ]) - end - end - context 'with an exception in an around hook before the test case is run' do class FailingAroundHookBeforeRunningTestCase def find_around_hooks(test_case) [ Hooks.around_hook(test_case.source) { raise Failure } @@ -2001,14 +1985,16 @@ AddBeforeAndAfterHooks.new ] execute_gherkin(filters) do feature do scenario do + step 'passing' end end end + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -2020,10 +2006,11 @@ :exception, :after_feature_element, :after_feature, :after_features ]) + # rubocop:enable AlignArray end end context 'with an exception in an around hook after the test case is run' do class FailingAroundHookAfterRunningTestCase @@ -2045,11 +2032,11 @@ scenario do step end end end - + # rubocop:disable AlignArray expect( formatter.legacy_messages ).to eq([ :before_features, :before_feature, :before_tags, :after_tags, @@ -2068,10 +2055,11 @@ :after_steps, :after_feature_element, :after_feature, :after_features ]) + # rubocop:enable AlignArray end end end describe 'before_step_result message' do @@ -2124,10 +2112,10 @@ end end end context 'in strict mode' do - let(:runtime) { Runtime.new strict: true } + let(:runtime) { Runtime.new strict: Cucumber::Core::Test::Result::StrictConfiguration.new([:undefined]) } it 'passes an exception to the formatter for undefined steps' do expect( formatter ).to receive(:exception) do |exception| expect( exception.message ).to eq %{Undefined step: "this step is undefined"} end