Sha256: 9ef8d2cbc25dfc0e70f764b35b446cdc77aef031c69272a338ec9ac169621c29

Contents?: true

Size: 956 Bytes

Versions: 1

Compression:

Stored size: 956 Bytes

Contents

class MockRequest
  include HttpAcceptLanguage

  attr_accessor :env

  def initialize
    @env = {'HTTP_ACCEPT_LANGUAGE' => ''}
  end
  
  def host
    "localhost"
  end
    
  def ssl?
    false
  end
    
  def cookies
    {}
  end  
end

class MockUser
  attr_accessor :locale

  def initialize(locale)
    @locale = locale
  end
end

class MockController

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

  def initialize(request)
    @request = request
    @cookies = ActionDispatch::Cookies::CookieJar.build(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

end

Version data entries

1 entries across 1 versions & 1 rubygems

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