1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
require 'spec_helper'
describe Buff::Config::Base do
subject { Class.new(described_class).new }
describe "#to_hash" do
it "returns a Hash" do
expect(subject.to_hash).to be_a(Hash)
end
it "contains all of the attributes" do
subject.set_attribute(:something, "value")
expect(subject.to_hash).to have_key(:something)
expect(subject.to_hash[:something]).to 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
expect(@sliced).to be_a(Hash)
end
it "contains just the sliced elements" do
expect(@sliced.size).to eq(1)
end
end
end
|