spec/models/spotlight/page_spec.rb in blacklight-spotlight-0.11.0 vs spec/models/spotlight/page_spec.rb in blacklight-spotlight-0.12.0

- old
+ new

@@ -72,6 +72,27 @@ it 'has content when the page has a widget' do page.content = [{ type: 'rule' }] expect(page).to have_content end end + + describe '#slug' do + let(:page) { FactoryGirl.create(:feature_page) } + + it 'gets a default slug' do + expect(page.slug).not_to be_blank + end + + it 'is updated when the title changes' do + page.update(title: 'abc') + expect(page.slug).to eq 'abc' + end + + context 'with a custom slug' do + let(:page) { FactoryGirl.create(:feature_page, slug: 'xyz') } + + it 'gets a default slug' do + expect(page.slug).to eq 'xyz' + end + end + end end