Fix warning already initialized constant LABEL_TITLES

spec/features/projects/labels/user_views_labels_spec.rb:7: warning: already initialized constant LABEL_TITLES
spec/features/issues/user_creates_issue_spec.rb:67: warning: previous definition of LABEL_TITLES was here
This commit is contained in:
Semyon Pupkov 2018-12-13 11:54:30 +05:00
parent 4d19a84b88
commit f955054159
2 changed files with 11 additions and 7 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe "User creates issue" do describe "User creates issue" do
@ -64,10 +66,10 @@ describe "User creates issue" do
end end
context "with labels" do context "with labels" do
LABEL_TITLES = %w(bug feature enhancement).freeze let(:label_titles) { %w(bug feature enhancement) }
before do before do
LABEL_TITLES.each do |title| label_titles.each do |title|
create(:label, project: project, title: title) create(:label, project: project, title: title)
end end
end end
@ -77,13 +79,13 @@ describe "User creates issue" do
fill_in("Title", with: issue_title) fill_in("Title", with: issue_title)
click_button("Label") click_button("Label")
click_link(LABEL_TITLES.first) click_link(label_titles.first)
click_button("Submit issue") click_button("Submit issue")
expect(page).to have_content(issue_title) expect(page).to have_content(issue_title)
.and have_content(user.name) .and have_content(user.name)
.and have_content(project.name) .and have_content(project.name)
.and have_content(LABEL_TITLES.first) .and have_content(label_titles.first)
end end
end end
end end

View file

@ -1,13 +1,15 @@
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe "User views labels" do describe "User views labels" do
set(:project) { create(:project_empty_repo, :public) } set(:project) { create(:project_empty_repo, :public) }
set(:user) { create(:user) } set(:user) { create(:user) }
LABEL_TITLES = %w[bug enhancement feature].freeze let(:label_titles) { %w[bug enhancement feature] }
before do before do
LABEL_TITLES.each { |title| create(:label, project: project, title: title) } label_titles.each { |title| create(:label, project: project, title: title) }
project.add_guest(user) project.add_guest(user)
sign_in(user) sign_in(user)
@ -17,7 +19,7 @@ describe "User views labels" do
it "shows all labels" do it "shows all labels" do
page.within('.other-labels .manage-labels-list') do page.within('.other-labels .manage-labels-list') do
LABEL_TITLES.each { |title| expect(page).to have_content(title) } label_titles.each { |title| expect(page).to have_content(title) }
end end
end end
end end