Sha256: 8e274a9064a2212a4dd8a97674fa9e6e01adb859bb969361a96f2c7d79d79301

Contents?: true

Size: 1.14 KB

Versions: 19

Compression:

Stored size: 1.14 KB

Contents

describe 'spotlight/roles/index', type: :view do
  let(:user) { stub_model(Spotlight::Engine.user_class, email: 'jane@example.com') }
  let(:exhibit) { FactoryBot.create(:exhibit) }
  let(:admin_role) { FactoryBot.create(:role, role: 'admin', user: user, resource: exhibit) }
  let(:roles) { [admin_role] }

  before do
    assign(:exhibit, exhibit)
    allow(view).to receive(:current_exhibit).and_return(exhibit)
    allow(exhibit).to receive(:roles).and_return roles
  end

  it 'renders the index page form' do
    render

    action = spotlight.update_all_exhibit_roles_path(exhibit)
    assert_select "form[action='#{action}'][method='post']" do
      assert_select "tr[data-show-for='#{admin_role.id}']"
      assert_select "tr[data-edit-for='#{admin_role.id}']"
      assert_select 'td', /jane@example.com/
      assert_select 'td', 'Admin'
      assert_select "input[type='submit'][data-behavior='destroy-user'][data-target='#{admin_role.id}']"
      assert_select "input[type='hidden'][data-destroy-for='#{admin_role.id}']"
      assert_select "a[data-behavior='cancel-edit']"
      assert_select "input[type='submit'][value='Save changes']"
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.4.0 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.3.3 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.3.2 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.3.1 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.3.0 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.2.1 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.2.0 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.1.0 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.2 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.1 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.0 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc6 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc5 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc4 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc3 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc2 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc1 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-1.5.1 spec/views/spotlight/roles/index.html.erb_spec.rb