Skip to content

Commit

Permalink
Add spec for two additive filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeiklejohn committed Oct 14, 2011
1 parent 5334396 commit 2128a8b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/cereal_box_spec.rb
Expand Up @@ -18,6 +18,14 @@ def attributes(base)
end
end

class SecondAdditiveFilter
include CerealBox

def attributes(base)
{ :d => "d" }
end
end

describe CerealBox do

describe 'with the base class' do
Expand Down Expand Up @@ -45,4 +53,24 @@ def attributes(base)
end
end

describe 'with two additive filters' do
subject { SecondAdditiveFilter.new(AdditiveFilter.new(Base.new)) }

it 'should include the base attributes' do
subject.as_json.keys.should include :a
end

it 'should include the additional direct attributes' do
subject.as_json.keys.should include :b
end

it 'should include the additional method attributes' do
subject.as_json.keys.should include :c
subject.as_json[:c].should == "ceee"
end

it 'should include the additional method attributes' do
subject.as_json.keys.should include :d
end
end
end

0 comments on commit 2128a8b

Please sign in to comment.