Created
May 24, 2012 00:26
-
-
Save ryanjosephking/2778599 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| module CanCan | |
| class AccessDenied < Exception; end | |
| end | |
| describe "StaticPages" do | |
| before :each do | |
| def @this.do_create | |
| # … | |
| fail CanCan::AccessDenied.new | |
| end | |
| end | |
| shared_examples "an access controlled action" do |action_proc| | |
| it "denies access if the post is not verified" do | |
| expect(&action_proc).to raise_error(CanCan::AccessDenied) | |
| end | |
| end | |
| describe "#create" do | |
| it_behaves_like "an access controlled action", proc { @this.do_create } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment