Sha256: 2b15c8b3420d4e727a62160afefd15600008d959d50e32dc71e4903dd7e259f0

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

require 'test_helper'

describe Lotus::Presenter do
  subject do
    MapPresenter.new(map)
  end

  let(:map) { Map.new(['Rome']) }

  it 'forwards methods to the wrapped object' do
    subject.locations.must_equal map.locations
  end

  it 'uses concrete methods' do
    subject.count.must_equal map.locations.count
  end

  it 'uses super to access object implementation' do
    subject.location_names.must_equal map.locations.map {|l| l.upcase }.join(', ')
  end

  it 'has a direct access to the object' do
    subject.inspect_object.must_match '#<Map'
  end

  it "raises error when the requested method can't be satisfied" do
    -> {
      subject.unknown_method
    }.must_raise NoMethodError
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lotus-view-0.1.0 test/presenter_test.rb