spec/views/spotlight/pages/show.html.erb_spec.rb in blacklight-spotlight-0.4.1 vs spec/views/spotlight/pages/show.html.erb_spec.rb in blacklight-spotlight-0.5.0
- old
+ new
@@ -1,65 +1,64 @@
require 'spec_helper'
module Spotlight
- describe "spotlight/pages/show", :type => :view do
+ describe 'spotlight/pages/show', type: :view do
let(:exhibit) { stub_model(Exhibit) }
- let(:page) {
+ let(:page) do
stub_model(FeaturePage,
- :exhibit => exhibit,
- :title => "Title",
- :content => "[]"
- )
- }
+ exhibit: exhibit,
+ title: 'Title',
+ content: '[]'
+ )
+ end
before(:each) do
allow(view).to receive(:current_exhibit).and_return(exhibit)
- @page = assign(:page, page)
- stub_template "spotlight/pages/_sidebar.html.erb" => "Sidebar"
-
+ assign(:page, page)
+ stub_template 'spotlight/pages/_sidebar.html.erb' => 'Sidebar'
end
- it "should render the title as a heading" do
+ it 'renders the title as a heading' do
render
- expect(rendered).to have_css(".page-title", text: @page.title)
+ expect(rendered).to have_css('.page-title', text: page.title)
end
- it "should not render an empty heading" do
+ it 'does not render an empty heading' do
allow(page).to receive_messages(title: nil)
render
- expect(rendered).to_not have_css(".page-title")
+ expect(rendered).to_not have_css('.page-title')
end
-
- it "should inject the page title into the html title" do
+
+ it 'injects the page title into the html title' do
expect(view).to receive(:set_html_page_title)
render
end
-
- it "should not include the page title" do
- allow(page).to receive_messages(:should_display_title? => false)
+
+ it 'does not include the page title' do
+ allow(page).to receive_messages(should_display_title?: false)
expect(view).to_not receive(:set_html_page_title)
render
end
- it "renders attributes in <p>" do
+ it 'renders attributes in <p>' do
render
expect(rendered).to match(/Title/)
end
- it "should render the sidebar" do
+ it 'renders the sidebar' do
page.display_sidebar = true
render
- expect(rendered).to match("Sidebar")
+ expect(rendered).to match('Sidebar')
end
- it "should not render the sidebar if the page has it disabled" do
+ it 'does not render the sidebar if the page has it disabled' do
allow(page).to receive_messages(display_sidebar?: false)
render
- expect(rendered).to_not match("Sidebar")
+ expect(rendered).to_not match('Sidebar')
end
- it "should render an empty partial if the page has no content" do
- allow(page).to receive_messages(has_content?: false)
- stub_template "spotlight/pages/_empty.html.erb" => "Empty message"
+ it 'renders an empty partial if the page has no content' do
+ allow(page).to receive_messages(content?: false)
+ stub_template 'spotlight/pages/_empty.html.erb' => 'Empty message'
render
- expect(rendered).to have_content("Empty message")
+ expect(rendered).to have_content('Empty message')
end
end
end