Sha256: 7e9b72be1220801312528d7285d09851966bfbdf8d3f1cad5f6dabec52b07c7d

Contents?: true

Size: 815 Bytes

Versions: 4

Compression:

Stored size: 815 Bytes

Contents

require 'active_support/all'
require 'action_controller'
require 'action_dispatch'

#
# Re-define the Rails module
#
module Rails
  #
  # Fake Rails application
  #
  class App
    def env_config
      {}
    end

    # Required in order to have `rake routes` working
    def config
      OpenStruct.new(assets: OpenStruct.new(prefix: nil))
    end

    def routes
      return @routes if defined?(@routes)
      @routes = ActionDispatch::Routing::RouteSet.new
      @routes.draw do
        root 'home#index'
        resources :guitars
        resources :concerts, only: :index
        # Represents an external controller
        resources :stages
      end
      @routes
    end
  end

  def self.application
    @app ||= App.new
  end
end

Rails.application.routes.default_url_options[:host] = 'http://test.host'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fortress-0.2.3 spec/fixtures/application.rb
fortress-0.2.2 spec/fixtures/application.rb
fortress-0.2.1 spec/fixtures/application.rb
fortress-0.2.0 spec/fixtures/application.rb