Sha256: 11a9099934ac25746e2dbcfd4f33c544e918919e369fcb1deb45fdf7a023f2bc

Contents?: true

Size: 781 Bytes

Versions: 6

Compression:

Stored size: 781 Bytes

Contents

require File.join(File.dirname(__FILE__), '../../spec_helper')

describe ViewModels::Extensions::ActiveRecord do
  
  describe "to_param" do
    before(:each) do
      @model      = stub :model
      @view_model = ViewModels::Base.new @model, nil
      @view_model.extend ViewModels::Extensions::ActiveRecord
    end
    it "should delegate to_param to the model" do
      @model.should_receive(:to_param).once
      
      @view_model.to_param
    end
    
    it "should delegate id to the model" do
      @model.should_receive(:id).once
      
      @view_model.id
    end
    
    it "should delegate dom_id to ActionController::RecordIdentifier" do
      ActionController::RecordIdentifier.should_receive(:dom_id).once
      
      @view_model.dom_id
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
view_models-1.5.7 spec/lib/extensions/active_record_spec.rb
view_models-1.5.6 spec/lib/extensions/active_record_spec.rb
view_models-1.5.5 spec/lib/extensions/active_record_spec.rb
view_models-1.5.4 spec/lib/extensions/active_record_spec.rb
view_models-1.5.3 spec/lib/extensions/active_record_spec.rb
view_models-1.5.2 spec/lib/extensions/active_record_spec.rb