Sha256: 101b209b89f1766565d47b13be8c6dcd1cc26e7b47566cfe48234697c319b3e9

Contents?: true

Size: 1.34 KB

Versions: 16

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

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

16 entries across 16 versions & 1 rubygems

Version Path
blacklight-spotlight-2.13.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.12.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.12.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.11.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.10.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.9.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.8.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.7.2 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.7.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.7.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.6.1.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.6.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.6.0 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.5.2 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.5.1 spec/views/spotlight/pages/index.html.erb_spec.rb
blacklight-spotlight-2.5.0 spec/views/spotlight/pages/index.html.erb_spec.rb