spec/models/spotlight/page_spec.rb in blacklight-spotlight-0.0.3 vs spec/models/spotlight/page_spec.rb in blacklight-spotlight-0.1.0
- old
+ new
@@ -1,10 +1,10 @@
require 'spec_helper'
describe Spotlight::Page do
- let(:exhibit) { Spotlight::Exhibit.default }
+ let(:exhibit) { FactoryGirl.create(:exhibit) }
let!(:parent_page) { Spotlight::FeaturePage.create! exhibit: exhibit, published: true }
let!(:child_page) { Spotlight::FeaturePage.create! exhibit: exhibit, published: false, parent_page: parent_page }
describe ".at_top_level" do
it "should scope results to only top level pages" do
@@ -33,13 +33,20 @@
it "should be the same object if the page is a top level page" do
expect(parent_page.top_level_page_or_self).to be parent_page
end
end
-
- describe "title_or_default" do
- subject { FactoryGirl.build(:about_page, title: 'my title') }
- it "should return the title" do
- expect(subject.title_or_default).to eq 'my title'
+ describe ".display_sidebar" do
+ it "should be set to true by default" do
+ expect(parent_page.display_sidebar?).to be_truthy
+ end
+ end
+ describe "should_display_title?" do
+ let(:page) { FactoryGirl.create(:feature_page) }
+ it "should return if the title is present or not" do
+ expect(page.title).not_to be_blank
+ expect(page.should_display_title?).to be_truthy
+ page.title = ""
+ expect(page.should_display_title?).to be_falsey
end
end
end