Sha256: 41efc1f001da245a6b86cecce87817e611931d9685b96c348fd95955018c04b5

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe ApplicationHelper do

  let(:dummy_model) { DummyModel.new }

  describe "for DummyModel object" do
    it "should initialize presenter with properly template" do
      helper.present(dummy_model).get_template.should be_an(ActionView::Base)
    end

    it "should initialize presenter with properly object model" do
      present(dummy_model).get_object.should eq dummy_model
    end

    it "should valid presenter method using block without variable" do
      result = ""
      present(dummy_model) do
        result += dummy_name
      end
      result.should eq "DUMMY"
    end

    it "should valid presenter method using block with variable" do
      result = ""
      present(dummy_model) do |dummy_presenter|
        result += dummy_presenter.dummy_name
      end
      result.should eq "DUMMY"
    end
  end

  describe "for DummyModel class" do
    it "should initialize presenter with properly template" do
      helper.present(DummyModel).get_template.should be_an(ActionView::Base)
    end

    it "should initialize presenter with properly object model" do
      present(DummyModel).get_object.should eq DummyModel
    end

    it "should valid presenter method using block" do
      expect do
        helper.present(DummyModel) do |dummy_presenter|

        end
      end.to_not raise_error
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
base_presenter-0.0.10 spec/helpers/application_helper_spec.rb