diff options
author | drew cimino <dcimino@gitlab.com> | 2019-04-11 14:25:10 +0300 |
---|---|---|
committer | drew cimino <dcimino@gitlab.com> | 2019-04-12 19:10:42 +0300 |
commit | fdc602e40e6593acee41fbd2c819de77aac37651 (patch) | |
tree | 4b993fbe0b67a2aee6b6169fe70ce5b64fec5f23 /spec/views | |
parent | 34243489af3e52ca87d6f1bc578bd9ba4e9d565e (diff) |
use cleaner expectation matchers from Capybara
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/tags/index.html.haml_spec.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb index 32e90e222d9..34355e27544 100644 --- a/spec/views/projects/tags/index.html.haml_spec.rb +++ b/spec/views/projects/tags/index.html.haml_spec.rb @@ -7,9 +7,6 @@ describe 'projects/tags/index' do let(:release) { create(:release, project: project, sha: git_tag.target_commit.sha) } let(:pipeline) { create(:ci_pipeline, :success, project: project, ref: git_tag.name, sha: release.sha) } - let(:artifacts_download_header_regex) { %r(<li class="dropdown-bold-header">Download artifacts<\/li>) } - let(:artifacts_download_link_selector) { 'a[href="' + latest_succeeded_project_artifacts_path(project, "#{pipeline.ref}/download", job: 'test') + '"]' } - before do assign(:project, project) assign(:repository, project.repository) @@ -31,12 +28,12 @@ describe 'projects/tags/index' do it 'renders the Artifacts section in the download list' do render - expect(rendered).to match(artifacts_download_header_regex) + expect(rendered).to have_selector('li', text: 'Artifacts') end it 'renders artifact download links' do render - expect(rendered).to have_selector(artifacts_download_link_selector) + expect(rendered).to have_link(href: latest_succeeded_project_artifacts_path(project, "#{pipeline.ref}/download", job: 'test')) end end @@ -45,12 +42,12 @@ describe 'projects/tags/index' do it 'does not render the Artifacts section in the download list' do render - expect(rendered).not_to match(artifacts_download_header_regex) + expect(rendered).not_to have_selector('li', text: 'Artifacts') end - it 'renders artifact download links' do + it 'does not render artifact download links' do render - expect(rendered).not_to have_selector(artifacts_download_link_selector) + expect(rendered).not_to have_link(href: latest_succeeded_project_artifacts_path(project, "#{pipeline.ref}/download", job: 'test')) end end end |