diff options
Diffstat (limited to 'spec/lib/gitlab/release_blog_post_spec.rb')
-rw-r--r-- | spec/lib/gitlab/release_blog_post_spec.rb | 68 |
1 files changed, 16 insertions, 52 deletions
diff --git a/spec/lib/gitlab/release_blog_post_spec.rb b/spec/lib/gitlab/release_blog_post_spec.rb index 7a5dce63165..d5fd6418afe 100644 --- a/spec/lib/gitlab/release_blog_post_spec.rb +++ b/spec/lib/gitlab/release_blog_post_spec.rb @@ -36,97 +36,61 @@ describe Gitlab::ReleaseBlogPost do around do |example| release_post_url = described_class.instance.instance_variable_get(:@url) described_class.instance.instance_variable_set(:@url, nil) + example.run + described_class.instance.instance_variable_set(:@url, release_post_url) end - context 'major pre release' do - before do + context 'matches GitLab version to blog post url' do + it 'returns the correct url for major pre release' do stub_const('Gitlab::VERSION', '11.0.0-pre') - end - - it 'returns the blog post url' do expect(subject).to eql('https://about.gitlab.com/2018/05/22/gitlab-10-8-released/') end - end - context 'major release candidate' do - before do + it 'returns the correct url for major release candidate' do stub_const('Gitlab::VERSION', '11.0.0-rc3') - end - - it 'returns the blog post url' do expect(subject).to eql('https://about.gitlab.com/2018/05/22/gitlab-10-8-released/') end - end - context 'major release' do - before do + it 'returns the correct url for major release' do stub_const('Gitlab::VERSION', '11.0.0') - end - - it 'returns the blog post url' do expect(subject).to eql('https://about.gitlab.com/2018/06/22/gitlab-11-0-released/') end - end - context 'minor pre release' do - before do + it 'returns the correct url for minor pre release' do stub_const('Gitlab::VERSION', '11.2.0-pre') - end - - it 'returns the blog post url' do expect(subject).to eql('https://about.gitlab.com/2018/07/22/gitlab-11-1-released/') end - end - context 'minor release candidate' do - before do + it 'returns the correct url for minor release candidate' do stub_const('Gitlab::VERSION', '11.2.0-rc3') - end - - it 'returns the blog post url' do expect(subject).to eql('https://about.gitlab.com/2018/07/22/gitlab-11-1-released/') end - end - context 'minor release' do - before do + it 'returns the correct url for minor release' do stub_const('Gitlab::VERSION', '11.2.0') - end - - it 'returns the blog post url' do expect(subject).to eql('https://about.gitlab.com/2018/08/22/gitlab-11-2-released/') end - end - context 'patch pre release' do - before do + it 'returns the correct url for patch pre release' do stub_const('Gitlab::VERSION', '11.2.1-pre') - end - - it 'returns the blog post url' do expect(subject).to eql('https://about.gitlab.com/2018/08/22/gitlab-11-2-released/') end - end - context 'patch release candidate' do - before do + it 'returns the correct url for patch release candidate' do stub_const('Gitlab::VERSION', '11.2.1-rc3') - end - - it 'returns the blog post url' do expect(subject).to eql('https://about.gitlab.com/2018/08/22/gitlab-11-2-released/') end - end - context 'patch release' do - before do + it 'returns the correct url for patch release' do stub_const('Gitlab::VERSION', '11.2.1') + expect(subject).to eql('https://about.gitlab.com/2018/08/22/gitlab-11-2-released/') end - it 'returns the blog post url' do - expect(subject).to eql('https://about.gitlab.com/2018/08/22/gitlab-11-2-released/') + it 'returns nil when no blog post is matched' do + stub_const('Gitlab::VERSION', '9.0.0') + expect(subject).to be(nil) end end end |