require 'spec_helper' describe Banyan::BanyanModel do let(:timestamp) { 1.day.ago } subject { FactoryGirl.create :banyan_model, :updated_at => timestamp } it { should be_valid } its('categories.class') { should eql(Array) } its(:categories) { should be_empty } context "with category created" do let(:category) { FactoryGirl.create :banyan_category } before do subject.categories << category subject.reload end its(:categories) { should include(category) } its(:updated_at) { should be > timestamp } it "should be visible from category" do category.banyan_model_categorizations.should include(subject) end it "should return only one instance of a category" do subject.categories << category subject.categories.should have(1).item end end end