Sha256: b46b0d5f8bc632d35031f4ed4e2d2fa6a161be11a6e0bd31f2cde90a74b2a466

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

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

require 'cucumber/ast'
require 'cucumber/step_mother'
require 'cucumber/step_definition'

module Cucumber
  describe StepDefinition do
    before do
      extend StepMother
      @world = new_world
      $inside = nil
    end

    it "should allow calling of other steps" do
      Given /Outside/ do
        Given "Inside"
      end
      Given /Inside/ do
        $inside = true
      end

      step_definition("Outside").execute(nil, @world)
      $inside.should == true
    end

    it "should allow calling of other steps with inline arg" do
      Given /Outside/ do
        Given "Inside", Ast::Table.new([['inside']])
      end
      Given /Inside/ do |table|
        $inside = table.raw[0][0]
      end

      step_definition("Outside").execute(nil, @world)
      $inside.should == 'inside'
    end

    it "should raise Undefined when inside step is not defined" do
      Given /Outside/ do
        Given 'Inside'
      end

      step = mock('Step')
      step.should_receive(:exception=)
      lambda do
        @world.__cucumber_current_step = step
        step_definition('Outside').execute(nil, @world)
      end.should raise_error(Undefined, 'Undefined step: "Inside"')
    end

    it "should allow forced pending" do
      Given /Outside/ do
        pending("Do me!")
      end

      lambda do
        step_definition("Outside").execute(nil, @world)
      end.should raise_error(Pending, "Do me!")
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
aslakhellesoy-cucumber-0.1.99.17 spec/cucumber/step_definition_spec.rb
aslakhellesoy-cucumber-0.1.99.18 spec/cucumber/step_definition_spec.rb
aslakhellesoy-cucumber-0.1.99.19 spec/cucumber/step_definition_spec.rb
aslakhellesoy-cucumber-0.1.99.20 spec/cucumber/step_definition_spec.rb
aslakhellesoy-cucumber-0.1.99.21 spec/cucumber/step_definition_spec.rb
kosmas58-cucumber-0.1.99.21 spec/cucumber/step_definition_spec.rb