Sha256: 378ddb2a3e7c39400ba72309d707b67ba3a764211c0f3522757f0061de814462

Contents?: true

Size: 1001 Bytes

Versions: 2

Compression:

Stored size: 1001 Bytes

Contents

require 'minitest/autorun'
require 'minitest/pride'
require 'oprah'
require 'oprah/railtie'
require 'oprah/test_helpers'
require 'dummy/init'

class Minitest::Test
  include Oprah::TestHelpers

  def setup
    super
    Oprah::Presenter.cache.clear
  end
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.2.1 test/helper.rb
oprah-0.2.0 test/helper.rb