Sha256: b9a2e04577161d46e0d67833ebd5deaf08146df9247a78acdf39727fb91cc5e4
Contents?: true
Size: 837 Bytes
Versions: 21
Compression:
Stored size: 837 Bytes
Contents
module 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 %> ? <%= 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 <% if options[:rspec] -%> # rspec def mock_<%= file_name %> <%= file_name %> = mock_model(<%= class_name %>, :id => 1, :login => 'user_name', :name => 'U. Surname', :to_xml => "<%= class_name %>-in-XML", :to_json => "<%= class_name %>-in-JSON", :errors => []) <%= file_name %> end <% end -%> end
Version data entries
21 entries across 21 versions & 5 rubygems