2015-10-11 05:41:23 -04:00
|
|
|
require 'rails_helper'
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
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
|