Sha256: 53ce510adb0bddb6d4340f64e7c94252c3523f213e4c454aac760e1dbf8af820

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe "my_accounts/show" do
  fixtures :all

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

  describe "when logged in as Librarian" do
    before(:each) do
      @profile = assign(:profile, profiles(: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(: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

3 entries across 3 versions & 2 rubygems

Version Path
enju_seed-0.2.0.beta.3 spec/views/my_accounts/show.html.erb_spec.rb
enju_seed-0.2.0.beta.2 spec/views/my_accounts/show.html.erb_spec.rb
enju_leaf-1.2.0.beta.1 spec/views/my_accounts/show.html.erb_spec.rb