mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-01 18:40:15 +01:00
Rename new_context and new_project actions to create to fit into the CRUD model, add tests for these methods, too.
Add a plugin to allow executing tests using an in-memory sqlite database. Faster! git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@318 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
3e22381187
commit
ba3757f29e
29 changed files with 416 additions and 114 deletions
|
|
@ -32,14 +32,14 @@ class BackendController < ApplicationController
|
|||
# Check whether the token in the URL matches the word in the User's table
|
||||
def check_token_against_user_word(username, token)
|
||||
@user = User.find_by_login( username )
|
||||
unless ( token == @user.word)
|
||||
raise (InvalidToken, "Sorry, you don't have permission to perform this action.")
|
||||
unless (token == @user.word)
|
||||
raise(InvalidToken, "Sorry, you don't have permission to perform this action.")
|
||||
end
|
||||
end
|
||||
|
||||
def check_context_belongs_to_user(context_id)
|
||||
unless @user.contexts.exists? context_id
|
||||
raise (CannotAccessContext, "Cannot access a context that does not belong to this user.")
|
||||
raise(CannotAccessContext, "Cannot access a context that does not belong to this user.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue