Sha256: a9837a35de98589d7f7362d0ade13fb567f542c1f3924132a706f38b268c3d7f

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

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

describe ViewModels::Helpers::Mapping::Collection do
  include ViewModels::Helpers::Mapping
  
  before(:each) do
    @collection = stub :collection
    @context    = stub :context
    @collection_view_model = ViewModels::Helpers::Mapping::Collection.new @collection, @context
  end
  
  describe "render_partial" do
    it "should call instance eval on the context" do
      @context.should_receive(:instance_eval).once
      
      @collection_view_model.send :render_partial, :some_name, :some_params
    end
    it "should render the partial in the 'context' context" do
      @context.should_receive(:render).once
      
      @collection_view_model.send :render_partial, :some_name, :some_params
    end
    it "should call render partial on context with the passed through parameters" do
      @context.should_receive(:render).once.with(:partial => 'view_models/collection/some_name', :locals => { :a => :b })
      
      @collection_view_model.send :render_partial, :some_name, { :a => :b }
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
view_models-2.0.1 spec/rails2/lib/helpers/collection_spec.rb