Sha256: b81bb13cf743de097d7c7f91ed504555d0d2a5f3397dc107c18da689fae2c91b

Contents?: true

Size: 671 Bytes

Versions: 6

Compression:

Stored size: 671 Bytes

Contents

require 'spec_helper'

describe Fierce::ViewModel do
  let(:presenter) { Struct.new(:foo).new('bar') }
  let(:context)   { double('template context', content_for: '<h1>layout here</h1>') }
  let(:controller_presenter) { Fierce::DelegateGenerator::Controller.new(controller).generate }
  
  let(:view_model) {
    Fierce::ViewModel.new(presenter, controller_presenter, context)
  }

  it "responds to methods on any of the passed in presenters" do
    view_model.available.should == 'im for you!'
    view_model.foo.should == 'bar'
  end

  it "resonds to yield in a traditional erb layout type of a way" do
    view_model.yield.should ==  '<h1>layout here</h1>'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fierce-0.2.0 spec/view_model_spec.rb
fierce-0.1.4 spec/view_model_spec.rb
fierce-0.1.3 spec/view_model_spec.rb
fierce-0.1.2 spec/view_model_spec.rb
fierce-0.1.1 spec/view_model_spec.rb
fierce-0.1.0 spec/view_model_spec.rb