Sha256: b50ba7cd52c2b34954bc7d52c9361976ea6d1e53c66a832e8d636fed5f95abeb

Contents?: true

Size: 811 Bytes

Versions: 4

Compression:

Stored size: 811 Bytes

Contents

require 'spec_helper'

describe Chozo::Config::Abstract do
  subject { Class.new(described_class).new }

  describe "#to_hash" do
    it "returns a Hash" do
      subject.to_hash.should be_a(Hash)
    end

    it "contains all of the attributes" do
      subject.attributes[:something] = "value"
      
      subject.to_hash.should have_key(:something)
      subject.to_hash[:something].should eql("value")
    end
  end

  describe "#slice" do
    before(:each) do
      subject.attributes[:one] = {
        nested: "value"
      }
      subject.attributes[:two] = {
        nested: "other"
      }
      @sliced = subject.slice(:one)
    end

    it "returns a Hash" do
      @sliced.should be_a(Hash)
    end

    it "contains just the sliced elements" do
      @sliced.should have(1).item
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chozo-0.4.2 spec/unit/chozo/config/abstract_spec.rb
chozo-0.4.1 spec/unit/chozo/config/abstract_spec.rb
chozo-0.4.0 spec/unit/chozo/config/abstract_spec.rb
chozo-0.3.0 spec/unit/chozo/config/abstract_spec.rb