From: Toshi MARUYAMA Date: Fri, 23 Dec 2011 10:08:28 +0000 (+0000) Subject: code layout clean up test/integration/api_test/users_test.rb X-Git-Tag: 1.4.0~965 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=260bc487aa17dbae38e29c3ff44c33fd127dad3a;p=redmine.git code layout clean up test/integration/api_test/users_test.rb git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8322 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 1c737a5fe..d5c15c128 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -71,13 +71,22 @@ class ApiTest::UsersTest < ActionController::IntegrationTest context "POST /users" do context "with valid parameters" do setup do - @parameters = {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net', :password => 'secret', :mail_notification => 'only_assigned'}} + @parameters = { + :user => { + :login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', + :mail => 'foo@example.net', :password => 'secret', + :mail_notification => 'only_assigned' + } + } end context ".xml" do should_allow_api_authentication(:post, '/users.xml', - {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net', :password => 'secret'}}, + {:user => { + :login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', + :mail => 'foo@example.net', :password => 'secret' + }}, {:success_code => :created}) should "create a user with the attributes" do @@ -103,7 +112,10 @@ class ApiTest::UsersTest < ActionController::IntegrationTest context ".json" do should_allow_api_authentication(:post, '/users.json', - {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net'}}, + {:user => { + :login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', + :mail => 'foo@example.net' + }}, {:success_code => :created}) should "create a user with the attributes" do @@ -141,7 +153,10 @@ class ApiTest::UsersTest < ActionController::IntegrationTest assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type - assert_tag 'errors', :child => {:tag => 'error', :content => "First name can't be blank"} + assert_tag 'errors', :child => { + :tag => 'error', + :content => "First name can't be blank" + } end end @@ -165,13 +180,21 @@ class ApiTest::UsersTest < ActionController::IntegrationTest context "PUT /users/2" do context "with valid parameters" do setup do - @parameters = {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}} + @parameters = { + :user => { + :login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', + :mail => 'jsmith@somenet.foo' + } + } end context ".xml" do should_allow_api_authentication(:put, '/users/2.xml', - {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}}, + {:user => { + :login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', + :mail => 'jsmith@somenet.foo' + }}, {:success_code => :ok}) should "update user with the attributes" do @@ -193,7 +216,10 @@ class ApiTest::UsersTest < ActionController::IntegrationTest context ".json" do should_allow_api_authentication(:put, '/users/2.json', - {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}}, + {:user => { + :login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', + :mail => 'jsmith@somenet.foo' + }}, {:success_code => :ok}) should "update user with the attributes" do @@ -215,7 +241,12 @@ class ApiTest::UsersTest < ActionController::IntegrationTest context "with invalid parameters" do setup do - @parameters = {:user => {:login => 'jsmith', :firstname => '', :lastname => 'Lastname', :mail => 'foo'}} + @parameters = { + :user => { + :login => 'jsmith', :firstname => '', :lastname => 'Lastname', + :mail => 'foo' + } + } end context ".xml" do @@ -226,7 +257,10 @@ class ApiTest::UsersTest < ActionController::IntegrationTest assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type - assert_tag 'errors', :child => {:tag => 'error', :content => "First name can't be blank"} + assert_tag 'errors', :child => { + :tag => 'error', + :content => "First name can't be blank" + } end end