Sha256: 747ded102e5b6c08de901487b1f87a79fbb8788b63a82641d2cd494fbf3ccace

Contents?: true

Size: 781 Bytes

Versions: 3

Compression:

Stored size: 781 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.set_attribute(: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.set_attribute(:one, nested: "value")
      subject.set_attribute(: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

3 entries across 3 versions & 1 rubygems

Version Path
chozo-0.6.1 spec/unit/chozo/config/abstract_spec.rb
chozo-0.6.0 spec/unit/chozo/config/abstract_spec.rb
chozo-0.5.0 spec/unit/chozo/config/abstract_spec.rb