Sha256: cd0a3e8f1b905e009c73f09e922e3ee917cfc3fdbf120a9861710161dd6cb496

Contents?: true

Size: 1.26 KB

Versions: 17

Compression:

Stored size: 1.26 KB

Contents

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

module Cucumber
  module Ast
    describe Background do

      before do
        extend(RbSupport::RbDsl)
        @step_mother = StepMother.new
        @step_mother.load_natural_language('en')
        @rb = @step_mother.load_programming_language('rb')

        $x = $y = nil
        Before do
          $x = 2
        end
        Given /y is (\d+)/ do |n|
          $y = $x * n.to_i
        end

        @visitor = TreeWalker.new(@step_mother)

        @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

17 entries across 17 versions & 5 rubygems

Version Path
davidtrogers-cucumber-0.6.2 spec/cucumber/ast/background_spec.rb
cucumber-0.6.2 spec/cucumber/ast/background_spec.rb
cucumber-0.6.1 spec/cucumber/ast/background_spec.rb
cucumber-0.6.0 spec/cucumber/ast/background_spec.rb
cucumber-0.5.3 spec/cucumber/ast/background_spec.rb
cucumber-0.5.2 spec/cucumber/ast/background_spec.rb
cucumber-0.5.1 spec/cucumber/ast/background_spec.rb
cucumber-0.5.0 spec/cucumber/ast/background_spec.rb
cucumber-0.4.5.rc2 spec/cucumber/ast/background_spec.rb
kbaum-cucumber-0.4.5.pre spec/cucumber/ast/background_spec.rb
cucumber-0.4.5.rc1 spec/cucumber/ast/background_spec.rb
middleman-0.10.17 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/ast/background_spec.rb
middleman-0.10.16 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/ast/background_spec.rb
middleman-0.10.15 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/ast/background_spec.rb
rackjour-0.1.8 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/ast/background_spec.rb
middleman-0.10.14 vendor/gems/gems/cucumber-0.4.4/spec/cucumber/ast/background_spec.rb
cucumber-0.4.4 spec/cucumber/ast/background_spec.rb