Sha256: e53ba7fd3938dade9af3a78f8a50b4e3dc555e3305b59e1973f06fe23ea6ad32

Contents?: true

Size: 988 Bytes

Versions: 1

Compression:

Stored size: 988 Bytes

Contents

class MockRequest
  include HttpAcceptLanguage

  attr_accessor :env, :cookies, :cookie_jar

  def initialize
    @env = {'HTTP_ACCEPT_LANGUAGE' => ''}
    @cookies = {}
    @cookie_jar = ActionDispatch::Cookies::CookieJar.build(self)
  end

  def host
    "localhost"
  end

  def ssl?
    false
  end

end

class MockUser
  attr_accessor :locale

  def initialize(locale)
    @locale = locale
  end
end

class MockController

  attr_accessor :request, :params, :default_url_options, :user

  def initialize(request)
    @request = request
    @default_url_options = @params = {}
  end

  def user_locale
    return user.locale if user
  end

  class << self
    attr_reader :before_filters
  end

  def self.before_filter(*args)
    @before_filters ||= []
    @before_filters << args
  end

  def self.append_before_filter(*args)
    @before_filters ||= []
    @before_filters << args
  end

  include RailsLocaleDetection::ControllerMethods
  include HttpAcceptLanguage::EasyAccess
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_locale_detection-2.0.0 spec/support/mocks.rb