Sha256: f865ad7cfb6f0457bb40556f98ff4cf53250642c34041ca0dd412395a33b123b

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

require 'spec_helper'

describe MultidispatchDSL do
  subject { TestClass.new }

  specify { subject.hello.should == "Version without args" }
  specify { subject.hello(1).should == "Fixnum version with number 1" }
  specify { subject.hello(:foo).should == "Symbol version with :foo & :internal_method" }
  specify { subject.hello(1, "string").should == "Fixnum String version with 1 & string" }
  specify { subject.hello("string", 1).should == "String Fixnum version with string & 1" }
  specify { expect { subject.fooo }.to raise_error(NameError) }
  specify { expect { subject.hello(:not, :defined).to raise_error(MultidispatchDSL::MissingDeclarationError) } }

  it 'allow yield in methods' do
    subject.hello('One', 'Two') do |str_one, str_two|
      "#{str_one} #{ str_two } #{ internal_method }"
    end.should == "ONE two internal_method"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
multidispatch_dsl-0.1.1 spec/lib/multidispatch_dsl_spec.rb
multidispatch_dsl-0.1.0 spec/lib/multidispatch_dsl_spec.rb