Sha256: 2cb1554f6beb0044f55d47b396ab7bf557f3fdc844bab1c2204afff2486d4b4e
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' module Alchemy describe ElementsController do let(:public_page) { FactoryGirl.create(:public_page) } let(:element) { FactoryGirl.create(:element, :page => public_page, :name => 'download') } let(:restricted_page) { FactoryGirl.create(:public_page, :restricted => true) } let(:restricted_element) { FactoryGirl.create(:element, :page => restricted_page, :name => 'download') } describe '#show' do it "should render available elements" do get :show, :id => element.id response.status.should == 200 end it "should raise ActiveRecord::RecordNotFound error for trashed elements" do element.trash! expect { get(:show, :id => element.id) }.to raise_error(ActiveRecord::RecordNotFound) end it "should raise ActiveRecord::RecordNotFound error for unpublished elements" do element.update_attributes(:public => false) expect { get(:show, :id => element.id) }.to raise_error(ActiveRecord::RecordNotFound) end context "for guest user" do it "should raise ActiveRecord::RecordNotFound error for elements of restricted pages" do expect { get(:show, :id => restricted_element.id) }.to raise_error(ActiveRecord::RecordNotFound) end end context "for registered user" do before do sign_in(registered_user) end it "should render elements of restricted pages" do get :show, :id => restricted_element.id response.status.should == 200 end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alchemy_cms-2.9.1 | spec/controllers/elements_controller_spec.rb |
alchemy_cms-2.9.0 | spec/controllers/elements_controller_spec.rb |