1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

Additional specs for denies_all

This commit is contained in:
Andy Ogzewalla 2012-08-11 20:40:25 -05:00
parent 45bb8ab832
commit 7259279ba5
2 changed files with 15 additions and 19 deletions

View file

@ -693,27 +693,25 @@ describe Draper::Base do
end
end
describe "a sample usage with denies_all" do
let(:subject_with_denies_all){ DecoratorWithDeniesAll.new(source) }
# it{ puts "\nInstance Methods: #{source.instance_methods.inspect}"}
# it "echo the allowed method" do
# subject_with_allows.should respond_to(:goodnight_moon)
# end
[:goodnight_moon, :hello_world, :title].each do |method|
it "does echo #{method} method" do
subject_with_denies_all.should_not respond_to(method)
end
end
# it "echo _only_ the allowed method" do
# subject_with_allows.should_not respond_to(:hello_world)
# end
let(:using_denies_all_then_denies_all) {
class DecoratorWithDeniesAllAndDeniesAll < Draper::Base
denies_all
denies_all
end
}
# it "echo the combined allowed methods" do
# subject_with_multiple_allows.should respond_to(:goodnight_moon)
# subject_with_multiple_allows.should respond_to(:hello_world)
# end
# it "echo _only_ the combined allowed methods" do
# subject_with_multiple_allows.should_not respond_to(:title)
# end
it "allows multple calls to .denies_all" do
expect { using_denies_all_then_denies_all }.to_not raise_error(ArgumentError)
end
end
describe "invalid usages of denies_all" do
@ -741,7 +739,6 @@ describe Draper::Base do
denies :goodnight_moon
end
}
it "raises an exception when calling allows then denies_all" do
expect {using_allows_then_denies_all}.to raise_error(ArgumentError)
end
@ -759,8 +756,6 @@ describe Draper::Base do
end
end
context "in a Rails application" do
let(:decorator){ DecoratorWithApplicationHelper.decorate(Object.new) }

View file

@ -15,6 +15,7 @@ require './spec/support/samples/decorator_with_allows'
require './spec/support/samples/decorator_with_multiple_allows'
require './spec/support/samples/decorator_with_application_helper'
require './spec/support/samples/decorator_with_denies'
require './spec/support/samples/decorator_with_denies_all'
require './spec/support/samples/decorator_with_special_methods'
require './spec/support/samples/namespaced_product'
require './spec/support/samples/namespaced_product_decorator'