Sha256: b2acf3381cbf33659916b28310145bd6aa973dd73fc6f74a93f7bca2510a9c02

Contents?: true

Size: 1.37 KB

Versions: 26

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe 'spotlight/pages/index.html.erb', type: :view do
  let(:pages) do
    [
      stub_model(Spotlight::FeaturePage,
                 title: 'Title1',
                 content: '[]',
                 exhibit: exhibit
                ),
      stub_model(Spotlight::FeaturePage,
                 title: 'Title2',
                 content: '[]',
                 exhibit: exhibit
                )
    ]
  end
  let(:exhibit) { stub_model(Spotlight::Exhibit) }
  before do
    allow(view).to receive(:page_collection_name).and_return(:feature_pages)
    allow(view).to receive(:update_all_exhibit_feature_pages_path).and_return('/exhibit/features/update_all')
    assign(:page, Spotlight::FeaturePage.new)
    assign(:exhibit, exhibit)
    allow(view).to receive(:current_exhibit).and_return(exhibit)
  end

  it 'renders a list of pages' do
    assign(:pages, pages)
    allow(exhibit).to receive(:feature_pages).and_return pages
    render
    expect(rendered).to have_selector '.panel-title', text: 'Title1'
    expect(rendered).to have_selector '.panel-title', text: 'Title2'
  end

  describe 'Without pages' do
    it 'does not disable the update button' do
      assign(:pages, [])
      render
      expect(rendered).not_to have_selector 'button[disabled]', text: 'Save changes'
      expect(rendered).to have_selector 'button', text: 'Save changes'
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
blacklight-spotlight-0.17.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.17.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.16.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.15.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.14.2 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.14.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.14.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.13.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.12.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.12.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.11.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.10.3 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.10.2 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.10.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.10.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.9.2 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.9.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.9.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.8.2 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-0.8.1 spec/views/spotlight/pages/index.html.erb_spec.rb