Sha256: 25e26e5bf6c1e00f95937fedca3b3571cd91e955e9c12dab5138a3ee0b4d5d2c

Contents?: true

Size: 1.35 KB

Versions: 8

Compression:

Stored size: 1.35 KB

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe 'XCRes::Section' do

  def subject
    XCRes::Section
  end

  describe '#initialize' do
    it 'should initialize a new section without options' do
      section = subject.new('Name', { 'a' => 'a.gif' })
      section.name.should.be.eql?('Name')
      section.items.should.be.eql?({ 'a' => 'a.gif' })
      section.options.should.be.eql?({})
    end

    it 'should initialize a new section with options' do
      section = subject.new('Name', { 'a' => 'a.gif' }, { custom_flag: true })
      section.name.should.be.eql?('Name')
      section.items.should.be.eql?({ 'a' => 'a.gif' })
      section.options.should.be.eql?({ custom_flag: true })
    end
  end

  describe '#==' do
    before do
      @left = subject.new('Cats', 'cat' => 'cat.gif')
    end

    it 'should be true for equal sections' do
      (@left == subject.new('Cats', 'cat' => 'cat.gif')).should.be.true?
    end

    it 'should be false if name is different' do
      (@left == subject.new('Dog', 'cat' => 'cat.gif')).should.be.false?
    end

    it 'should be false if items are different' do
      (@left == subject.new('Cat', 'dog' => 'dog.gif')).should.be.false?
    end

    it 'should be false if options are different' do
      (@left == subject.new('Cat', { 'cat' => 'cat.gif' }, custom_flag: true)).should.be.false?
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
xcres-0.6.1 spec/unit/model/section_spec.rb
xcres-0.6.0 spec/unit/model/section_spec.rb
xcres-0.5.0 spec/unit/model/section_spec.rb
xcres-0.4.4 spec/unit/model/section_spec.rb
xcres-0.4.3 spec/unit/model/section_spec.rb
xcres-0.4.2 spec/unit/model/section_spec.rb
xcres-0.4.1 spec/unit/model/section_spec.rb
xcres-0.4.0 spec/unit/model/section_spec.rb