Sha256: 332655a2c6661fbf501032e6a97957b0ea9b165e188d3fb68276ddadad8d1f91
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' describe Draper::ModelSupport do subject { Product.new } describe '#decorator' do its(:decorator) { should be_kind_of(ProductDecorator) } its(:decorator) { should be(subject.decorator) } it 'should have abillity to pass block' do a = Product.new.decorator { |d| d.awesome_title } a.should eql "Awesome Title" end it 'should be aliased to .decorate' do subject.decorator.model.should == subject.decorate.model end end describe '#decorate - decorate collections of AR objects' do subject { Product.limit } its(:decorate) { should be_kind_of(Draper::DecoratedEnumerableProxy) } it "should decorate the collection" do subject.decorate.size.should == 1 subject.decorate.to_ary[0].model.should be_a(Product) end end describe '#decorate - decorate collections of namespaced AR objects' do subject { Namespace::Product.limit } its(:decorate) { should be_kind_of(Draper::DecoratedEnumerableProxy) } it "should decorate the collection" do subject.decorate.size.should == 1 subject.decorate.to_ary[0].model.should be_a(Namespace::Product) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
draper-0.10.0 | spec/draper/model_support_spec.rb |