Sha256: 232025dae41e21f355013d223301453dccc2f10a5ce1e6db5a2fc306136e6493

Contents?: true

Size: 1.67 KB

Versions: 26

Compression:

Stored size: 1.67 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'
require 'cucumber/step_mother'
require 'cucumber/ast'

module Cucumber
  module Ast
    describe Scenario do
      before do
        @step_mother = Object.new
        @step_mother.extend(StepMother)
        $x = $y = nil
        @step_mother.Given /y is (\d+)/ do |n|
          $y = n.to_i
        end
        @visitor = Visitor.new(@step_mother)
        @visitor.options = {}
      end

      it "should skip steps when previous is not passed" do
        scenario = Scenario.new(
          background=nil,
          comment=Comment.new(""),
          tags=Tags.new(98, []), 
          line=99,
          keyword="",
          name="", 
          steps=[
            Step.new(7, "Given", "this is missing"),
            Step.new(8, "Given", "y is 5")
          ])
        @visitor.visit_feature_element(scenario)

        $y.should == nil
      end

      it "should be at exact line" do
        s = Scenario.new(background=nil, comment=Comment.new(""), 
          tags=Tags.new(44, []), 45, keyword="", name="", steps=[])

        s.should be_matches_lines([44])
        s.should be_matches_lines([45])
      end

      it "should be at line if tags or steps are" do
        s = Scenario.new(
          background=nil,
          comment=Comment.new(""), 
          tags=Tags.new(43, []), 
          line=45,
          keyword="",
          name="", 
          steps=[
            Step.new(46, "Given", ""),
            Step.new(47, "Given", ""),
            Step.new(48, "Given", ""),
          ]
        )

        s.should be_matches_lines([43])
        s.should be_matches_lines([47])
        s.should_not be_matches_lines([49])
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 4 rubygems

Version Path
aslakhellesoy-cucumber-0.1.100.1 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.1.100.2 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.1.100.3 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.1.100.4 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.1.100.5 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.0.1 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.0.2 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.0.3 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.0.4 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.0 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.1 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.2.1 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.2.2 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.2 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.3.1 specs/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.3.2 spec/cucumber/ast/scenario_spec.rb
aslakhellesoy-cucumber-0.2.3 specs/cucumber/ast/scenario_spec.rb
fcoury-cucumber-0.2.3.1 specs/cucumber/ast/scenario_spec.rb
kosmas58-cucumber-0.1.100.5 spec/cucumber/ast/scenario_spec.rb
kosmas58-cucumber-0.2.0.1 spec/cucumber/ast/scenario_spec.rb