Sha256: c31d169a5123f70846363141e8e2943c62f7ca9a9cbb7c24e25f0d8bc333d8d0

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Neutral::Icons::Collection do
  let(:collection) { Neutral::Icons::Collection.new }
  let(:set) { Neutral::Icons::Set.new(:my_test_icons) }

  describe "#add" do
    context "when given set already exists" do
      let(:set) { Neutral::Icons::Set.new(:thumbs) }

      it "raises AlreadyDefinedIconSet error" do
        expect { collection.add(set.name, set.definitions) }.to raise_error
      end
    end

    context "when given set does not exist yet" do
      it "defines method on icons object with given set name and definitions" do
        collection.should_receive(:define!).with(set.name, set.definitions)
        collection.add(set)
      end
    end
  end

  describe "#define!" do
    before do
      collection.send(:define!, set.name, set.definitions)
    end

    subject { collection.send(set.name) }

    it { should be_a(Neutral::Icons::Collection::Definitions) }

    [:positive, :negative, :remove].each do |definition|
      its(definition) { should == set.definitions[definition] }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neutral-0.0.7 spec/icons/collection_spec.rb