2013-02-05 14:16:51 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe CategoryFeaturedUser do
|
2013-02-25 11:42:20 -05:00
|
|
|
|
2014-12-31 09:55:03 -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
|
2014-12-31 09:55:03 -05:00
|
|
|
expect(CategoryFeaturedUser.count).to be(1)
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the user via the category association' do
|
2014-12-31 09:55:03 -05:00
|
|
|
expect(@category.featured_users).to be_present
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|