Sha256: 04c09502b0c39f8c38fa4da79fd8950bdbb6a1c283c572b83bd5248cee7b6a94

Contents?: true

Size: 598 Bytes

Versions: 7

Compression:

Stored size: 598 Bytes

Contents

module <%= model_class_name %>AuthenticatedTestHelper 
  # Sets the current <%= file_name %> in the session from the <%= file_name %> fixtures.
  def login_as(<%= file_name %>)
    @request.session[:<%= file_name %>_id] = <%= file_name %> ? (<%= file_name %>.is_a?(<%= file_name.camelize %>) ? <%= file_name %>.id : <%= table_name %>(<%= file_name %>).id) : nil
  end

  def authorize_as(<%= file_name %>)
    @request.env["HTTP_AUTHORIZATION"] = <%= file_name %> ? ActionController::HttpAuthentication::Basic.encode_credentials(<%= table_name %>(<%= file_name %>).login, 'monkey') : nil
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
somatics3-generators-0.0.9 lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb
somatics3-generators-0.0.8 lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb
somatics3-generators-0.0.7 lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb
somatics3-generators-0.0.6 lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb
somatics3-generators-0.0.5 lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb
somatics3-generators-0.0.4 lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb
somatics3-generators-0.0.2 lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb