Sha256: 5ad0a403349f61d91e9b3dbf08639ff27de6501e1ab9caed12db0fc2bb1d35ff

Contents?: true

Size: 667 Bytes

Versions: 5

Compression:

Stored size: 667 Bytes

Contents

require 'spec_helper'
module Domain
  describe Equalizer, "new" do

    let(:clazz){
      eq = equalizer
      Class.new{
        def initialize(x, y)
          @x, @y = x, y
        end
        attr_reader :x, :y
        include eq
      }
    }

    subject{ clazz.new(1, 2).equality_components }

    context 'with a block' do
      let(:equalizer){ Equalizer.new{ [x] } }

      it{ should eq([1]) }
    end

    context 'with a single name' do
      let(:equalizer){ Equalizer.new(:x) }

      it{ should eq([1]) }
    end

    context 'with a multiple names' do
      let(:equalizer){ Equalizer.new([:x, :y]) }

      it{ should eq([1, 2]) }
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
domain-1.0.0 spec/support/equalizer/test_new.rb
domain-1.0.0.rc4 spec/support/equalizer/test_new.rb
domain-1.0.0.rc3 spec/support/equalizer/test_new.rb
domain-1.0.0.rc2 spec/support/equalizer/test_new.rb
domain-1.0.0.rc1 spec/support/equalizer/test_new.rb