@ -49,8 +49,8 @@ describe 'api/v3/work_packages/index.api.rabl' do
let ( :column_names ) { [ ] }
let ( :custom_field_column_names ) { [ ] }
it { should have_json_path ( 'work_packages' ) }
it { should have_json_size ( 0 ) . at_path ( 'work_packages' ) }
it { is_expected . to have_json_path ( 'work_packages' ) }
it { is_expected . to have_json_size ( 0 ) . at_path ( 'work_packages' ) }
end
describe 'with 3 work packages but no columns' do
@ -62,10 +62,10 @@ describe 'api/v3/work_packages/index.api.rabl' do
let ( :column_names ) { [ ] }
let ( :custom_field_column_names ) { [ ] }
it { should have_json_path ( 'work_packages' ) }
it { should have_json_size ( 3 ) . at_path ( 'work_packages' ) }
it { is_expected . to have_json_path ( 'work_packages' ) }
it { is_expected . to have_json_size ( 3 ) . at_path ( 'work_packages' ) }
it { should have_json_type ( Object ) . at_path ( 'work_packages/2' ) }
it { is_expected . to have_json_type ( Object ) . at_path ( 'work_packages/2' ) }
end
describe 'with 2 work packages and columns' do
@ -76,13 +76,13 @@ describe 'api/v3/work_packages/index.api.rabl' do
let ( :column_names ) { %w( subject description due_date ) }
let ( :custom_field_column_names ) { [ ] }
it { should have_json_path ( 'work_packages' ) }
it { should have_json_size ( 2 ) . at_path ( 'work_packages' ) }
it { is_expected . to have_json_path ( 'work_packages' ) }
it { is_expected . to have_json_size ( 2 ) . at_path ( 'work_packages' ) }
it { should have_json_type ( Object ) . at_path ( 'work_packages/1' ) }
it { should have_json_path ( 'work_packages/1/subject' ) }
it { should have_json_path ( 'work_packages/1/description' ) }
it { should have_json_path ( 'work_packages/1/due_date' ) }
it { is_expected . to have_json_type ( Object ) . at_path ( 'work_packages/1' ) }
it { is_expected . to have_json_path ( 'work_packages/1/subject' ) }
it { is_expected . to have_json_path ( 'work_packages/1/description' ) }
it { is_expected . to have_json_path ( 'work_packages/1/due_date' ) }
end
describe 'with project column' do
@ -90,8 +90,8 @@ describe 'api/v3/work_packages/index.api.rabl' do
let ( :column_names ) { %w( subject project ) }
let ( :custom_field_column_names ) { [ ] }
it { should have_json_path ( 'work_packages/0/project' ) }
it { should have_json_path ( 'work_packages/0/project/identifier' ) }
it { is_expected . to have_json_path ( 'work_packages/0/project' ) }
it { is_expected . to have_json_path ( 'work_packages/0/project/identifier' ) }
end
context 'with actions, links based on permissions' do
@ -100,13 +100,13 @@ describe 'api/v3/work_packages/index.api.rabl' do
let ( :custom_field_column_names ) { [ ] }
context 'with no actions' do
it { should have_json_path ( 'work_packages/0/_actions' ) }
it { should have_json_type ( Array ) . at_path ( 'work_packages/0/_actions' ) }
it { should have_json_size ( 0 ) . at_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_type ( Array ) . at_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_size ( 0 ) . at_path ( 'work_packages/0/_actions' ) }
it { should have_json_path ( 'work_packages/0/_links' ) }
it { should have_json_type ( Hash ) . at_path ( 'work_packages/0/_links' ) }
it { should have_json_size ( 0 ) . at_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_type ( Hash ) . at_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_size ( 0 ) . at_path ( 'work_packages/0/_links' ) }
end
context 'with some actions' do
@ -120,13 +120,13 @@ describe 'api/v3/work_packages/index.api.rabl' do
}
}
it { should have_json_path ( 'work_packages/0/_actions' ) }
it { should have_json_type ( Array ) . at_path ( 'work_packages/0/_actions' ) }
it { should have_json_size ( 2 ) . at_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_type ( Array ) . at_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_size ( 2 ) . at_path ( 'work_packages/0/_actions' ) }
it { should have_json_path ( 'work_packages/0/_links' ) }
it { should have_json_type ( Hash ) . at_path ( 'work_packages/0/_links' ) }
it { should have_json_size ( 2 ) . at_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_type ( Hash ) . at_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_size ( 2 ) . at_path ( 'work_packages/0/_links' ) }
specify {
expect ( parse_json ( subject , 'work_packages/0/_links/log_time' ) ) . to match ( %r{ /work_packages/( \ d+)/time_entries/new } )
@ -144,10 +144,10 @@ describe 'api/v3/work_packages/index.api.rabl' do
}
}
it { should have_json_path ( 'work_packages/0/_actions' ) }
it { should have_json_type ( Array ) . at_path ( 'work_packages/0/_actions' ) }
it { should have_json_size ( 7 ) . at_path ( 'work_packages/0/_actions' ) }
it { should have_json_path ( 'work_packages/0/_actions/' ) }
it { is_expected . to have_json_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_type ( Array ) . at_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_size ( 7 ) . at_path ( 'work_packages/0/_actions' ) }
it { is_expected . to have_json_path ( 'work_packages/0/_actions/' ) }
specify {
expect ( parse_json ( subject , 'work_packages/0/_actions/5' ) ) . to match ( %r{ copy } )
@ -156,11 +156,11 @@ describe 'api/v3/work_packages/index.api.rabl' do
expect ( parse_json ( subject , 'work_packages/0/_actions/6' ) ) . to match ( %r{ duplicate } )
}
it { should have_json_path ( 'work_packages/0/_links' ) }
it { should have_json_type ( Hash ) . at_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_type ( Hash ) . at_path ( 'work_packages/0/_links' ) }
# FIXME: check missing permission
it { should have_json_size ( 6 ) . at_path ( 'work_packages/0/_links' ) }
it { is_expected . to have_json_size ( 6 ) . at_path ( 'work_packages/0/_links' ) }
specify {
expect ( parse_json ( subject , 'work_packages/0/_links/copy' ) ) . to match ( %r{ /work_packages/move/new \ ?copy \ =true } )
@ -174,7 +174,7 @@ describe 'api/v3/work_packages/index.api.rabl' do
expect ( parse_json ( subject , 'work_packages/0/_links/delete' ) ) . to match ( %r{ /work_packages/bulk \ ?ids(.+)method \ =delete } )
}
it { should have_json_size ( 4 ) . at_path ( '_bulk_links' ) }
it { is_expected . to have_json_size ( 4 ) . at_path ( '_bulk_links' ) }
specify {
expect ( parse_json ( subject , '_bulk_links/edit' ) ) . to match ( %r{ /work_packages/bulk/edit } )