Sha256: d788d4caea29a4500cc62295ab417c33d259ad0002b3cc29b4cbbdce8a22c2e4

Contents?: true

Size: 1.51 KB

Versions: 32

Compression:

Stored size: 1.51 KB

Contents

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

module Cucumber
  module CoreExt
    describe "proc extended with CallIn" do
      it "should raise ArityMismatchError for too many args (expecting 0)" do
        proc = lambda {}
        proc.extend CallIn
        lambda {
          proc.call_in(Object.new, 1)
        }.should raise_error(Cucumber::ArityMismatchError, "expected 0 block argument(s), got 1")
      end

      it "should raise ArityMismatchError for too many args (expecting 1)" do
        proc = lambda {|a|}
        proc.extend CallIn
        lambda {
          proc.call_in(Object.new, 1, 2)
        }.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 2")
      end

      it "should raise ArityMismatchError for too few args (expecting 1)" do
        proc = lambda {|a|}
        proc.extend CallIn
        lambda {
          proc.call_in(Object.new)
        }.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 0")
      end

      it "should raise ArityMismatchError for too few args (expecting 2)" do
        proc = lambda {|a,b|}
        proc.extend CallIn
        lambda {
          proc.call_in(Object.new, 1)
        }.should raise_error(Cucumber::ArityMismatchError, "expected 2 block argument(s), got 1")
      end
      
      it "should remove extraneous path info for file" do
        proc = lambda {|a,b|}
        proc.extend CallIn
        proc.file_colon_line.should == "spec/cucumber/core_ext/proc_spec.rb:39"
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 6 rubygems

Version Path
jeffrafter-cucumber-0.1.12 spec/cucumber/core_ext/proc_spec.rb
kosmas58-cucumber-0.1.16.5 spec/cucumber/core_ext/proc_spec.rb
kosmas58-cucumber-0.1.16.6 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.11 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.12 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.10 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.14 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.13 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.8 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.15 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.16 spec/cucumber/core_ext/proc_spec.rb
cucumber-0.1.9 spec/cucumber/core_ext/proc_spec.rb