Sha256: fe4c248928a63e1e8dd3416acffa28715fe4374342d51ca05a10d9a7c1349ffd

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

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

module Cucumber
  describe StepMother do
    it "should report file and line numbers for both duplicate step definitions" do
      m = StepMother.new
      
      m.register_step_proc /Three (.*) mice/ do |disability|
      end

      begin
        m.register_step_proc /Three (.*) mice/ do |disability|
        end
        violated("Should raise error")
      rescue => e
        e.message.should =~ %r{Duplicate step definitions:.+step_mother_spec\.rb:8:in `/Three \(\.\*\) mice/'.+step_mother_spec\.rb\:12:in `/Three \(\.\*\) mice/'}m

      end
    end

    it "should report file and line numbers for multiple step definitions" do
      m = StepMother.new
      
      m.register_step_proc /Three (.*) mice/ do |disability|
      end

      m.register_step_proc /Three blind (.*)/ do |animal|
      end

      begin
        m.regexp_args_proc('Three blind mice')
        violated("Should raise error")
      rescue => e
        e.message.should =~ %r{Multiple step definitions match "Three blind mice":

.+step_mother_spec\.rb:24:in `/Three \(\.\*\) mice/'
.+step_mother_spec\.rb:27:in `/Three blind \(\.\*\)/'

}m
      end
    end
    
    it "should mark step as pending when it doesn't match any procs" do
      pending "think some more about what to expect here" do
        m = StepMother.new
        step = mock('step')
        step.should_receive(:pending!)
        raise "FIXME"
        m.execute(step)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
elight-cucumber-0.1.9 spec/cucumber/step_mother_spec.rb
cucumber-0.1.8 spec/cucumber/step_mother_spec.rb
cucumber-0.1.7 spec/cucumber/step_mother_spec.rb
cucumber-0.1.6 spec/cucumber/step_mother_spec.rb