Sha256: 056815a6b593b4530fa489d311fce7fa8d788d107c8d88b7a14d556040246ad8

Contents?: true

Size: 1006 Bytes

Versions: 6

Compression:

Stored size: 1006 Bytes

Contents

require 'action_view'

class DummyView < ActionView::Base
  module FakeRequest
    class Request
      attr_accessor :path, :fullpath, :protocol, :host_with_port
      def get?
        true
      end
    end
    def request
      @request ||= Request.new
    end
    def params
      @params ||= {}
    end
  end

  include FakeRequest
  include ActionView::Helpers::UrlHelper
  include Loaf::ViewExtensions

  attr_reader :_breadcrumbs

  routes = ActionDispatch::Routing::RouteSet.new
  routes.draw do
    get "/" => "foo#bar", :as => :home
    get "/posts" => "foo#posts"
    get "/posts/:title" => "foo#posts"
    get "/post/:id" => "foo#post", :as => :post
    get "/post/:title" => "foo#title"
    get "/post/:id/comments" => "foo#comments"

    namespace :blog do
      get "/" => "foo#bar"
    end
  end

  include routes.url_helpers

  def set_path(path)
    request.path = path
    request.fullpath = path
    request.protocol = 'http://'
    request.host_with_port = 'www.example.com'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
loaf-0.8.1 spec/support/dummy_view.rb
loaf-0.8.0 spec/support/dummy_view.rb
loaf-0.7.0 spec/support/dummy_view.rb
loaf-0.6.2 spec/support/dummy_view.rb
loaf-0.6.1 spec/support/dummy_view.rb
loaf-0.6.0 spec/support/dummy_view.rb