require 'spec_helper' describe Banyan::BanyanGroupModel do subject { FactoryGirl.create :banyan_group_model } it { should be_valid } its(:category_groups) { should be_an(Array) } its(:category_groups) { should be_empty } context "with category group created" do let(:category_group) { FactoryGirl.create :banyan_category_group } before do subject.category_groups << category_group subject.reload end it "should return only one instance of a category group" do subject.category_groups << category_group subject.category_groups << category_group subject.category_groups.should have(1).item end its(:category_groups) { should include(category_group) } end end