Commit 8dfd9eee authored by Etienne Baqué's avatar Etienne Baqué

Added Evidences namespace for related entity files

Moved evidence entity files to a evidences folder.
Adjusted location of rspec files accordingly.
parent cdae31c3
# frozen_string_literal: true
class EvidenceAuthorEntity < Grape::Entity
expose :id
expose :name
expose :email
end
# frozen_string_literal: true
class EvidenceIssueEntity < Grape::Entity
expose :id
expose :title
expose :description
expose :author, using: EvidenceAuthorEntity
expose :state
expose :iid
expose :confidential
expose :created_at
expose :due_date
end
# frozen_string_literal: true
class EvidenceMilestoneEntity < Grape::Entity
expose :id
expose :title
expose :description
expose :state
expose :iid
expose :created_at
expose :due_date
expose :issues, using: EvidenceIssueEntity
end
# frozen_string_literal: true
class EvidenceProjectEntity < Grape::Entity
expose :id
expose :name
expose :description
expose :created_at
end
# frozen_string_literal: true
class EvidenceReleaseEntity < Grape::Entity
expose :id
expose :tag, as: :tag_name
expose :name
expose :description
expose :created_at
expose :project, using: EvidenceProjectEntity
expose :milestones, using: EvidenceMilestoneEntity
end
# frozen_string_literal: true
class EvidenceReleaseSerializer < BaseSerializer
entity EvidenceReleaseEntity
end
# frozen_string_literal: true
module Evidences
class AuthorEntity < Grape::Entity
expose :id
expose :name
expose :email
end
end
# frozen_string_literal: true
module Evidences
class IssueEntity < Grape::Entity
expose :id
expose :title
expose :description
expose :author, using: AuthorEntity
expose :state
expose :iid
expose :confidential
expose :created_at
expose :due_date
end
end
# frozen_string_literal: true
module Evidences
class MilestoneEntity < Grape::Entity
expose :id
expose :title
expose :description
expose :state
expose :iid
expose :created_at
expose :due_date
expose :issues, using: IssueEntity
end
end
# frozen_string_literal: true
module Evidences
class ProjectEntity < Grape::Entity
expose :id
expose :name
expose :description
expose :created_at
end
end
# frozen_string_literal: true
module Evidences
class ReleaseEntity < Grape::Entity
expose :id
expose :tag, as: :tag_name
expose :name
expose :description
expose :created_at
expose :project, using: ProjectEntity
expose :milestones, using: MilestoneEntity
end
end
# frozen_string_literal: true
module Evidences
class ReleaseSerializer < BaseSerializer
entity ReleaseEntity
end
end
# frozen_string_literal: true
require 'spec_helper'
describe EvidenceReleaseSerializer do
it 'represents an EvidenceReleaseEntity entity' do
expect(described_class.entity_class).to eq(EvidenceReleaseEntity)
end
end
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe EvidenceAuthorEntity do
describe Evidences::AuthorEntity do
let(:entity) { described_class.new(build(:author)) }
subject { entity.as_json }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe EvidenceIssueEntity do
describe Evidences::IssueEntity do
let(:entity) { described_class.new(build(:issue)) }
subject { entity.as_json }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe EvidenceMilestoneEntity do
describe Evidences::MilestoneEntity do
let(:milestone) { build(:milestone) }
let(:entity) { described_class.new(milestone) }
......@@ -19,8 +19,8 @@ describe EvidenceMilestoneEntity do
it 'exposes these issues' do
expect(subject[:issues]).to contain_exactly(
EvidenceIssueEntity.new(issue_1).as_json,
EvidenceIssueEntity.new(issue_2).as_json
Evidences::IssueEntity.new(issue_1).as_json,
Evidences::IssueEntity.new(issue_2).as_json
)
end
end
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe EvidenceProjectEntity do
describe Evidences::ProjectEntity do
let(:entity) { described_class.new(build(:project)) }
subject { entity.as_json }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe EvidenceReleaseEntity do
describe Evidences::ReleaseEntity do
let(:release) { build(:release) }
let(:entity) { described_class.new(release) }
......@@ -20,8 +20,8 @@ describe EvidenceReleaseEntity do
it 'exposes these milestones' do
expect(subject[:milestones]).to contain_exactly(
EvidenceMilestoneEntity.new(milestone_1).as_json,
EvidenceMilestoneEntity.new(milestone_2).as_json
Evidences::MilestoneEntity.new(milestone_1).as_json,
Evidences::MilestoneEntity.new(milestone_2).as_json
)
end
end
......
# frozen_string_literal: true
require 'spec_helper'
describe Evidences::ReleaseSerializer do
it 'represents an Evidence::ReleaseEntity entity' do
expect(described_class.entity_class).to eq(Evidences::ReleaseEntity)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment