mirror of
https://github.com/redmine/redmine.git
synced 2025-11-07 05:45:49 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user