Sha256: 7e56848450a9f1249b1de4fb491910e924b380fa9781b499427212395a858f88

Contents?: true

Size: 894 Bytes

Versions: 2

Compression:

Stored size: 894 Bytes

Contents

require 'minitest/autorun'
require 'minitest/pride'
require 'oprah'
require 'oprah/test_helpers'

class Minitest::Test
  include Oprah::TestHelpers
end

module Fixtures
  module Entity
  end

  class EntityPresenter < Oprah::Presenter
    def foo
      "foo"
    end
  end

  class User
    include Entity

    def first_name
      "Foo"
    end

    def last_name
      "Bar"
    end

    private

    def password
      "baz"
    end
  end

  class UserPresenter < Oprah::Presenter
    def name
      [first_name, last_name].join(' ')
    end

    def foo
      super + "bar"
    end
  end

  class Comment
  end

  class CommentPresenter < Oprah::Presenter
  end

  class Project
    def comments
      Array.new(3) { Comment.new }
    end

    def owner
      User.new
    end
  end

  class ProjectPresenter < Oprah::Presenter
    presents_many :comments
    presents_one :owner
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oprah-0.1.3 test/helper.rb
oprah-0.1.2 test/helper.rb