Last active
October 17, 2018 07:36
fl_medium_blogpost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe '#subject_category_interest_props' do | |
let(:current_user) { double(:user) } | |
let(:subject_category_one) { double(:subject_category_one, id: 1, title: 'subject-category-title-1') } | |
let(:subject_category_two) { double(:subject_category_two, id: 2, title: 'subject-category-title-2') } | |
let(:subject_category_three) { double(:subject_category_three, id: 3, title: 'subject-category-title-3') } | |
let(:subject_category_interests) { [subject_category_one, subject_category_three] } | |
let(:subject_categories) { [subject_category_one, subject_category_two, subject_category_three] } | |
before do | |
allow(SubjectCategory).to receive(:in_alphabetical_order).and_return(subject_categories) | |
allow(current_user).to receive(:interested_subject_categories).and_return(subject_category_interests) | |
end | |
it 'returns props containing title, id and selected status' do | |
props = { fields: [{ title: 'subject-category-title-1', value: '1', selected: true }, | |
{ title: 'subject-category-title-2', value: '2', selected: false }, | |
{ title: 'subject-category-title-3', value: '3', selected: true }] } | |
expect(subject.subject_category_interest_props).to eq(props) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment