You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sqm-dashboards/spec/presenters/category_presenter_spec.rb

20 lines
696 B

require 'rails_helper'
describe CategoryPresenter do
let(:category_presenter) do
subcategory1 = Subcategory.new(name: 'A subcategory')
subcategory2 = Subcategory.new(name: 'Another subcategory')
category = SqmCategory.new(name: 'Some Category', subcategories: [subcategory1, subcategory2])
return CategoryPresenter.new(category: category, academic_year: AcademicYear.new, school: School.new)
end
it 'returns the name of the category' do
expect(category_presenter.name).to eq 'Some Category'
end
it 'maps subcategories to subcategory presenters' do
expect(category_presenter.subcategories.map(&:name)).to eq ['A subcategory', 'Another subcategory']
end
end