diff --git a/spec/draper/base_spec.rb b/spec/draper/base_spec.rb index 3b251af..37b1615 100755 --- a/spec/draper/base_spec.rb +++ b/spec/draper/base_spec.rb @@ -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) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0ed9d89..3af778f 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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'