Sha256: cd4a31493db1ffa99834fb921b47fd4b274d3459e47e450027f225f2986ac86e

Contents?: true

Size: 723 Bytes

Versions: 16

Compression:

Stored size: 723 Bytes

Contents

require 'test_helper'
require 'camping'

Camping.goes :Helpers

module Helpers::Helpers
  def frontpage
    R(Index)
  end

  def current_user
    User.new
  end
end

module Helpers::Models
  class User
    def name
      'Bob'
    end
  end
end

module Helpers::Controllers
  class Index
    def get
      URL('/').to_s
    end
  end

  class Model
    def get
      current_user.name
    end
  end

  class Users
    def get
      frontpage
    end
  end
end

class Helpers::Test < TestCase
  def test_models
    get '/model'
    assert_body "Bob"
  end

  def test_controllers
    get '/users'
    assert_body "/"
  end

  def test_url
    get '/', {}, 'PATH_INFO' => ''
    assert_body "http://example.org/"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
camping-3.2.6 test/app_helpers.rb
camping-3.2.5 test/app_helpers.rb
camping-3.2.4 test/app_helpers.rb
camping-3.2.3 test/app_helpers.rb
camping-3.2.2 test/app_helpers.rb
camping-3.2.1 test/app_helpers.rb
camping-3.2.0 test/app_helpers.rb
camping-3.1.3 test/app_helpers.rb
camping-3.1.2 test/app_helpers.rb
camping-3.1.0 test/app_helpers.rb
camping-3.0.2 test/app_helpers.rb
camping-3.0.1 test/app_helpers.rb
camping-3.0.0 test/app_helpers.rb
camping-2.1.532 test/app_helpers.rb
camping-2.1.531 test/app_helpers.rb
camping-2.1.523 test/app_helpers.rb