Sha256: ec500682f71f8abaf89958d4f0d11582e8500d06740538575f3dd9684cd20d3e

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

module Spotlight
  describe "spotlight/roles/index", :type => :view do
    let(:user) { stub_model(::User, email: 'jane@example.com') } 

    let(:exhibit) { FactoryGirl.create(:exhibit) }
    let(:admin_role) { FactoryGirl.create(:role, role: 'admin', user: user, exhibit: 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

      assert_select "form[action=?][method=?]", spotlight.update_all_exhibit_roles_path(exhibit), "post" do
        assert_select "tr[data-show-for=?]", admin_role.id
        assert_select "tr[data-edit-for=?]", admin_role.id, 2
        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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-0.3.1 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-0.3.0 spec/views/spotlight/roles/index.html.erb_spec.rb
blacklight-spotlight-0.2.0 spec/views/spotlight/roles/index.html.erb_spec.rb