Sha256: 12e81c483bc9e24ce110b354123ceed135eda859493ced0e55875f56441cf6f6

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

RSpec.describe 'hyrax/my/_sort_and_per_page.html.erb', type: :view do
  let(:mock_response) { double(response: { 'numFound' => 7 }) }
  let(:sort_fields) { double(empty?: true) }

  before do
    stub_template 'hyrax/collections/_form_for_select_collection.html.erb' => ''
    @response = mock_response
    view.extend BatchEditsHelper
    allow(view).to receive(:sort_fields).and_return(sort_fields)
  end

  context "on my works page" do
    before do
      allow(view).to receive(:on_my_works?).and_return(true)
      render
    end
    it "has buttons" do
      expect(rendered).to have_selector('button', text: 'Add to Collection')
      expect(rendered).to have_selector('input[value="Edit Selected"]')
    end
  end

  context "not on my works page (i.e. Works shared with me)" do
    before do
      allow(view).to receive(:on_my_works?).and_return(false)
      render
    end
    it "has buttons" do
      expect(rendered).not_to have_selector('button', text: 'Add to Collection')
      expect(rendered).to have_selector('input[value="Edit Selected"]')
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
hyrax-1.1.0 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
hyrax-1.0.5 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
hyrax-1.0.4 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
hyrax-1.0.3 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
hyrax-1.0.2 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
hyrax-1.0.1 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
hyrax-1.0.0.rc2 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
hyrax-1.0.0.rc1 spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb
test_hyrax-0.0.1.alpha spec/views/hyrax/my/_sort_and_per_page.html.erb_spec.rb