mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
Simplified the specs around pluralized decorated classes
This commit is contained in:
parent
67d4dadc4f
commit
4ba89563ec
1 changed files with 11 additions and 18 deletions
|
@ -5,23 +5,6 @@ describe Draper::Base do
|
|||
subject{ Draper::Base.new(source) }
|
||||
let(:source){ Product.new }
|
||||
|
||||
context("classify_vs_camelize") do
|
||||
it "should create 'Busines' when using classify" do
|
||||
:business.to_s.classify.should == 'Busines'
|
||||
end
|
||||
|
||||
it "should create 'Business' when using camelize" do
|
||||
:business.to_s.camelize.should == 'Business'
|
||||
end
|
||||
|
||||
it "should fail for 'decorates :business'" do
|
||||
class Business; end
|
||||
lambda do
|
||||
Draper::Base.decorates(:business)
|
||||
end.should_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context(".lazy_helpers") do
|
||||
it "makes Rails helpers available without using the h. proxy" do
|
||||
Draper::Base.lazy_helpers
|
||||
|
@ -37,7 +20,17 @@ describe Draper::Base do
|
|||
|
||||
context(".decorates") do
|
||||
it "sets the model class for the decorator" do
|
||||
ProductDecorator.new(source).model_class == Product
|
||||
ProductDecorator.new(source).model_class.should == Product
|
||||
end
|
||||
|
||||
it "should handle plural-like words properly'" do
|
||||
class Business; end
|
||||
expect do
|
||||
class BusinessDecorator < Draper::Base
|
||||
decorates:business
|
||||
end
|
||||
BusinessDecorator.model_class.should == Business
|
||||
end.should_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue