summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-05-16 15:58:20 -0500
committerMayra Cabrera <mcabrera@gitlab.com>2018-05-16 15:59:51 -0500
commitf494f2711a5a19b751c50832d8ae15c01ce3c3ee (patch)
tree17818ce6c92cb0af8be4b45e313c47c2e7fd1ae7 /spec
parent86ef8221778d2aff630feecfa15ba70514983dbc (diff)
downloadgitlab-ce-f494f2711a5a19b751c50832d8ae15c01ce3c3ee.tar.gz
Respect the inheritance chain between Ci::Build and CommitStatus46177-fix-present-on-generic-commit-status
Also moves the assertions were they belong
Diffstat (limited to 'spec')
-rw-r--r--spec/models/commit_status_spec.rb7
-rw-r--r--spec/models/generic_commit_status_spec.rb6
-rw-r--r--spec/presenters/ci/build_presenter_spec.rb2
-rw-r--r--spec/presenters/commit_status_presenter_spec.rb15
4 files changed, 24 insertions, 6 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index eddcf616b53..f3f2bc28d2c 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -567,11 +567,8 @@ describe CommitStatus do
end
describe '#present' do
- let(:generic_commit_status) { create(:generic_commit_status) }
+ subject { commit_status.present }
- it 'returns a presenter' do
- expect(commit_status.present).to be_a(Ci::BuildPresenter)
- expect(generic_commit_status.present).to be_a(Ci::BuildPresenter)
- end
+ it { is_expected.to be_a(CommitStatusPresenter) }
end
end
diff --git a/spec/models/generic_commit_status_spec.rb b/spec/models/generic_commit_status_spec.rb
index 673049d1cc4..a3e68d2e646 100644
--- a/spec/models/generic_commit_status_spec.rb
+++ b/spec/models/generic_commit_status_spec.rb
@@ -78,4 +78,10 @@ describe GenericCommitStatus do
it { is_expected.not_to be_nil }
end
end
+
+ describe '#present' do
+ subject { generic_commit_status.present }
+
+ it { is_expected.to be_a(GenericCommitStatusPresenter) }
+ end
end
diff --git a/spec/presenters/ci/build_presenter_spec.rb b/spec/presenters/ci/build_presenter_spec.rb
index 4bc005df2fc..efd175247b5 100644
--- a/spec/presenters/ci/build_presenter_spec.rb
+++ b/spec/presenters/ci/build_presenter_spec.rb
@@ -10,7 +10,7 @@ describe Ci::BuildPresenter do
end
it 'inherits from Gitlab::View::Presenter::Delegated' do
- expect(described_class.superclass).to eq(Gitlab::View::Presenter::Delegated)
+ expect(described_class.ancestors).to include(Gitlab::View::Presenter::Delegated)
end
describe '#initialize' do
diff --git a/spec/presenters/commit_status_presenter_spec.rb b/spec/presenters/commit_status_presenter_spec.rb
new file mode 100644
index 00000000000..f81ee44e371
--- /dev/null
+++ b/spec/presenters/commit_status_presenter_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+describe CommitStatusPresenter do
+ let(:project) { create(:project) }
+ let(:pipeline) { create(:ci_pipeline, project: project) }
+ let(:build) { create(:ci_build, pipeline: pipeline) }
+
+ subject(:presenter) do
+ described_class.new(build)
+ end
+
+ it 'inherits from Gitlab::View::Presenter::Delegated' do
+ expect(described_class.superclass).to eq(Gitlab::View::Presenter::Delegated)
+ end
+end