Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neudabei/deea93fb68d75f4d0c66b3e013959906 to your computer and use it in GitHub Desktop.
Save neudabei/deea93fb68d75f4d0c66b3e013959906 to your computer and use it in GitHub Desktop.
fl_medium_blogpost
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