|
|
|
@ -32,19 +32,43 @@ describe ::API::V3::Priorities::PriorityRepresenter do |
|
|
|
|
let(:priority) { FactoryGirl.build(:priority) } |
|
|
|
|
let(:representer) { described_class.new(priority) } |
|
|
|
|
|
|
|
|
|
include API::V3::Utilities::PathHelper |
|
|
|
|
|
|
|
|
|
context 'generation' do |
|
|
|
|
subject(:generated) { representer.to_json } |
|
|
|
|
subject { representer.to_json } |
|
|
|
|
|
|
|
|
|
it 'should indicate its type' do |
|
|
|
|
should include_json('Priority'.to_json).at_path('_type') |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it { should include_json('Priority'.to_json).at_path('_type') } |
|
|
|
|
describe 'links' do |
|
|
|
|
it { should have_json_type(Object).at_path('_links') } |
|
|
|
|
it 'should link to self' do |
|
|
|
|
path = api_v3_paths.priority(priority.id) |
|
|
|
|
|
|
|
|
|
xit { should have_json_type(Object).at_path('_links') } |
|
|
|
|
xit 'should link to self' do |
|
|
|
|
expect(subject).to have_json_path('_links/self/href') |
|
|
|
|
should be_json_eql(path.to_json).at_path('_links/self/href') |
|
|
|
|
end |
|
|
|
|
it 'should display its name as title in self' do |
|
|
|
|
should be_json_eql(priority.name.to_json).at_path('_links/self/title') |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'priority' do |
|
|
|
|
it { should have_json_path('id') } |
|
|
|
|
it { should have_json_path('name') } |
|
|
|
|
it 'should have an id' do |
|
|
|
|
should have_json_path('id') |
|
|
|
|
end |
|
|
|
|
it 'should have a name' do |
|
|
|
|
should have_json_path('name') |
|
|
|
|
end |
|
|
|
|
it 'should have a position' do |
|
|
|
|
should have_json_path('position') |
|
|
|
|
end |
|
|
|
|
it 'should have a default flag' do |
|
|
|
|
should have_json_path('isDefault') |
|
|
|
|
end |
|
|
|
|
it 'should have an active flag' do |
|
|
|
|
should have_json_path('isActive') |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|