mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-02 14:11:46 +01:00
move to strong_parameters of rails4.
This commit is contained in:
parent
049296fd33
commit
671f64b419
24 changed files with 153 additions and 61 deletions
|
|
@ -2,13 +2,45 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|||
|
||||
class NotesControllerTest < ActionController::TestCase
|
||||
|
||||
def setup
|
||||
end
|
||||
|
||||
def test_get_notes_page
|
||||
login_as :admin_user
|
||||
get :index
|
||||
assert_response 200
|
||||
end
|
||||
|
||||
def test_create_new_note
|
||||
login_as :admin_user
|
||||
project = users(:admin_user).projects.first
|
||||
count = users(:admin_user).notes.count
|
||||
|
||||
post :create, note: {body: "test note", project_id: project.id}, format: :js
|
||||
|
||||
assert_response 200
|
||||
assert assigns['saved'], "@saved should be true"
|
||||
assert count+1, users(:admin_user).notes.reload.count
|
||||
end
|
||||
|
||||
def test_update_note
|
||||
login_as :admin_user
|
||||
|
||||
note = users(:admin_user).notes.first
|
||||
|
||||
assert_not_equal "test", note.body
|
||||
post :update, id: note.id, note: {body: "test"}, format: :js
|
||||
assert_equal "test", note.reload.body
|
||||
end
|
||||
|
||||
def test_destroy_note
|
||||
login_as :admin_user
|
||||
|
||||
note = users(:admin_user).notes.first
|
||||
count = users(:admin_user).notes.count
|
||||
|
||||
post :destroy, id: note.id, format: :js
|
||||
|
||||
old_note = users(:admin_user).notes.where(id: note.id).first
|
||||
assert_nil old_note
|
||||
assert count-1, users(:admin_user).notes.reload.count
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class ContextXmlApiTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_fails_gracefully_with_invalid_xml_format
|
||||
authenticated_post_xml_to_context_create "<context_name></context_name>"
|
||||
authenticated_post_xml_to_context_create "<context><name></name></context>"
|
||||
assert_responses_with_error 'Name context must have a name'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ProjectXmlApiTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_fails_with_invalid_xml_format2
|
||||
authenticated_post_xml_to_project_create "<request><project></project></request>"
|
||||
authenticated_post_xml_to_project_create "<project><name></name></project>"
|
||||
assert_responses_with_error 'Name project must have a name'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class TodoXmlApiTest < ActionDispatch::IntegrationTest
|
|||
assert_response :success
|
||||
todo = @user.todos.where(:description => "this will succeed 2.0").first
|
||||
assert_not_nil todo
|
||||
assert !todo.uncompleted_predecessors.empty?
|
||||
assert !todo.uncompleted_predecessors.empty?, "should have predecessors"
|
||||
end
|
||||
|
||||
def test_post_create_todo_with_single_dependency
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue