discourse/spec/models/category_featured_user_spec.rb

26 lines
514 B
Ruby
Raw Normal View History

require 'rails_helper'
2013-02-05 14:16:51 -05:00
describe CategoryFeaturedUser do
2013-02-25 11:42:20 -05:00
it { is_expected.to belong_to :category }
it { is_expected.to belong_to :user }
2013-02-05 14:16:51 -05:00
context 'featuring users' do
before do
@category = Fabricate(:category)
CategoryFeaturedUser.feature_users_in(@category)
end
it 'has a featured user' do
expect(CategoryFeaturedUser.count).to be(1)
2013-02-05 14:16:51 -05:00
end
it 'returns the user via the category association' do
expect(@category.featured_users).to be_present
2013-02-05 14:16:51 -05:00
end
end
end