Sha256: a571e5a5d94a59bb4132c1fcb95c114c62314a41e081c426dd44228d2e9e1152

Contents?: true

Size: 1.17 KB

Versions: 84

Compression:

Stored size: 1.17 KB

Contents

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

module Cucumber
  module Ast
    describe Background do

      before do
        @step_mother = Object.new
        @step_mother.extend(StepMother)
        $x = $y = nil
        @step_mother.Before do
          $x = 2
        end
        @step_mother.Given /y is (\d+)/ do |n|
          $y = $x * n.to_i
        end
        @visitor = Visitor.new(@step_mother)
        @visitor.options = {}

        @feature = mock('feature', :visit? => true).as_null_object
      end

      it "should execute Before blocks before background steps" do
        background = Background.new(
          comment=Comment.new(''),
          line=2,
          keyword="", 
          name="",
          steps=[
            Step.new(7, "Given", "y is 5")
          ])

        scenario = Scenario.new(
          background,
          comment=Comment.new(""), 
          tags=Tags.new(98,[]),
          line=99,
          keyword="", 
          name="", 
          steps=[])
        background.feature = @feature
        
        @visitor.visit_background(background)
        $x.should == 2
        $y.should == 10
      end
    end
  end
end

Version data entries

84 entries across 84 versions & 9 rubygems

Version Path
aslakhellesoy-cucumber-0.2.3.1 specs/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.2.3.2 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.2.3.3 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.2.3.4 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.0.1 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.0 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.1.1 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.1 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.10 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.11.1 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.11.200907091518 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.11.3 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.11.5 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.11.6 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.11 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.2 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.3.1 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.3.2 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.3.3 spec/cucumber/ast/background_spec.rb
aslakhellesoy-cucumber-0.3.3.4 spec/cucumber/ast/background_spec.rb