Removed some shoulda context.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11863 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-05-18 08:57:27 +00:00
parent 0d4bb7558f
commit 8f7b69f77e
8 changed files with 683 additions and 870 deletions

View File

@@ -24,66 +24,52 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base
Setting.rest_api_enabled = '1'
end
context "/roles" do
context "GET" do
context "xml" do
should "return the roles" do
get '/roles.xml'
test "GET /roles.xml should return the roles" do
get '/roles.xml'
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_equal 3, assigns(:roles).size
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_equal 3, assigns(:roles).size
assert_tag :tag => 'roles',
:attributes => {:type => 'array'},
:child => {
:tag => 'role',
:child => {
:tag => 'id',
:content => '2',
:sibling => {
:tag => 'name',
:content => 'Developer'
}
}
}
end
end
context "json" do
should "return the roles" do
get '/roles.json'
assert_response :success
assert_equal 'application/json', @response.content_type
assert_equal 3, assigns(:roles).size
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Hash, json
assert_kind_of Array, json['roles']
assert_include({'id' => 2, 'name' => 'Developer'}, json['roles'])
end
end
end
assert_tag :tag => 'roles',
:attributes => {:type => 'array'},
:child => {
:tag => 'role',
:child => {
:tag => 'id',
:content => '2',
:sibling => {
:tag => 'name',
:content => 'Developer'
}
}
}
end
context "/roles/:id" do
context "GET" do
context "xml" do
should "return the role" do
get '/roles/1.xml'
test "GET /roles.json should return the roles" do
get '/roles.json'
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_response :success
assert_equal 'application/json', @response.content_type
assert_equal 3, assigns(:roles).size
assert_select 'role' do
assert_select 'name', :text => 'Manager'
assert_select 'role permissions[type=array]' do
assert_select 'permission', Role.find(1).permissions.size
assert_select 'permission', :text => 'view_issues'
end
end
end
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Hash, json
assert_kind_of Array, json['roles']
assert_include({'id' => 2, 'name' => 'Developer'}, json['roles'])
end
test "GET /roles/:id.xml should return the role" do
get '/roles/1.xml'
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_select 'role' do
assert_select 'name', :text => 'Manager'
assert_select 'role permissions[type=array]' do
assert_select 'permission', Role.find(1).permissions.size
assert_select 'permission', :text => 'view_issues'
end
end
end