Sha256: 367c6625580404128cfd09e636869e0d60ffac7ae2e2935e0ecd787a49b95a1a

Contents?: true

Size: 1.19 KB

Versions: 27

Compression:

Stored size: 1.19 KB

Contents

require 'rails_helper'

describe "my_accounts/show" do
  fixtures :all

  before(:each) do
    @profile = assign(:profile, profiles(:profile_admin))
  end

  describe "when logged in as Librarian" do
    before(:each) do
      @profile = assign(:profile, profiles(:profile_librarian2))
      user = users(:librarian1)
      view.stub(:current_user).and_return(user)
    end

    it "renders attributes in <p>" do
      allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
      render
      # Run the generator again with the --webrat flag if you want to use webrat matchers
      rendered.should match(/Checkout/)
    end

    it "cannot be deletable by other librarian" do
      allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
      render
    end
  end

  describe "when logged in as User" do
    before(:each) do
      @profile = assign(:profile, profiles(:profile_user2))
      user = users(:librarian1)
      view.stub(:current_user).and_return(user)
    end

    it "renders attributes in <p>" do
      allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
      render
      rendered.should match(/Checkout/)
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
enju_circulation-0.3.11 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.10 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.9 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.4.0.rc.1 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.8 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.7 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.4.0.beta.4 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.4.0.beta.3 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.6 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.4.0.beta.2 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.4.0.beta.1 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.5 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.4 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.3 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.2 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.1 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.0 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.0.rc.1 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.3.0.beta.1 spec/views/my_accounts/show.html.erb_spec.rb
enju_circulation-0.2.5 spec/views/my_accounts/show.html.erb_spec.rb