diff options
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 21 | ||||
-rw-r--r-- | spec/features/builds_spec.rb | 89 | ||||
-rw-r--r-- | spec/features/ci/admin/builds_spec.rb | 11 | ||||
-rw-r--r-- | spec/features/ci/admin/runners_spec.rb | 27 | ||||
-rw-r--r-- | spec/features/ci/builds_spec.rb | 60 | ||||
-rw-r--r-- | spec/features/ci/commits_spec.rb | 69 | ||||
-rw-r--r-- | spec/features/ci/projects_spec.rb | 38 | ||||
-rw-r--r-- | spec/features/ci_settings_spec.rb | 22 | ||||
-rw-r--r-- | spec/features/ci_web_hooks_spec.rb | 27 | ||||
-rw-r--r-- | spec/features/commits_spec.rb | 61 | ||||
-rw-r--r-- | spec/features/login_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/markdown_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/password_reset_spec.rb | 62 | ||||
-rw-r--r-- | spec/features/projects_spec.rb | 29 | ||||
-rw-r--r-- | spec/features/runners_spec.rb (renamed from spec/features/ci/runners_spec.rb) | 25 | ||||
-rw-r--r-- | spec/features/triggers_spec.rb (renamed from spec/features/ci/triggers_spec.rb) | 9 | ||||
-rw-r--r-- | spec/features/users_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/variables_spec.rb (renamed from spec/features/ci/variables_spec.rb) | 15 |
18 files changed, 312 insertions, 261 deletions
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index 86717761582..c2c7364f6c5 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -111,6 +111,27 @@ describe "Admin::Users", feature: true do expect(page).to have_content(@user.name) end + describe 'Login as another user' do + it 'should show login button for other users and check that it works' do + another_user = create(:user) + + visit admin_user_path(another_user) + + click_link 'Log in as this user' + + expect(page).to have_content("Logged in as #{another_user.username}") + + page.within '.sidebar-user .username' do + expect(page).to have_content(another_user.username) + end + end + + it 'should not show login button for admin itself' do + visit admin_user_path(@user) + expect(page).not_to have_content('Log in as this user') + end + end + describe 'Two-factor Authentication status' do it 'shows when enabled' do @user.update_attribute(:two_factor_enabled, true) diff --git a/spec/features/builds_spec.rb b/spec/features/builds_spec.rb new file mode 100644 index 00000000000..154857e77fe --- /dev/null +++ b/spec/features/builds_spec.rb @@ -0,0 +1,89 @@ +require 'spec_helper' + +describe "Builds" do + before do + login_as(:user) + @commit = FactoryGirl.create :ci_commit + @build = FactoryGirl.create :ci_build, commit: @commit + @gl_project = @commit.project.gl_project + @gl_project.team << [@user, :master] + end + + describe "GET /:project/builds" do + context "Running scope" do + before do + @build.run! + visit namespace_project_builds_path(@gl_project.namespace, @gl_project) + end + + it { expect(page).to have_content 'Running' } + it { expect(page).to have_content 'Cancel all' } + it { expect(page).to have_content @build.short_sha } + it { expect(page).to have_content @build.ref } + it { expect(page).to have_content @build.name } + end + + context "Finished scope" do + before do + @build.run! + visit namespace_project_builds_path(@gl_project.namespace, @gl_project, scope: :finished) + end + + it { expect(page).to have_content 'No builds to show' } + it { expect(page).to have_content 'Cancel all' } + end + + context "All builds" do + before do + @gl_project.ci_builds.running_or_pending.each(&:success) + visit namespace_project_builds_path(@gl_project.namespace, @gl_project, scope: :all) + end + + it { expect(page).to have_content 'All' } + it { expect(page).to have_content @build.short_sha } + it { expect(page).to have_content @build.ref } + it { expect(page).to have_content @build.name } + it { expect(page).to_not have_content 'Cancel all' } + end + end + + describe "GET /:project/builds/:id/cancel_all" do + before do + @build.run! + visit cancel_all_namespace_project_builds_path(@gl_project.namespace, @gl_project) + end + + it { expect(page).to have_content 'No builds to show' } + it { expect(page).to_not have_content 'Cancel all' } + end + + describe "GET /:project/builds/:id" do + before do + visit namespace_project_build_path(@gl_project.namespace, @gl_project, @build) + end + + it { expect(page).to have_content @commit.sha[0..7] } + it { expect(page).to have_content @commit.git_commit_message } + it { expect(page).to have_content @commit.git_author_name } + end + + describe "GET /:project/builds/:id/cancel" do + before do + @build.run! + visit cancel_namespace_project_build_path(@gl_project.namespace, @gl_project, @build) + end + + it { expect(page).to have_content 'canceled' } + it { expect(page).to have_content 'Retry' } + end + + describe "POST /:project/builds/:id/retry" do + before do + visit cancel_namespace_project_build_path(@gl_project.namespace, @gl_project, @build) + click_link 'Retry' + end + + it { expect(page).to have_content 'pending' } + it { expect(page).to have_content 'Cancel' } + end +end diff --git a/spec/features/ci/admin/builds_spec.rb b/spec/features/ci/admin/builds_spec.rb index 88ef9c144af..623d466c67b 100644 --- a/spec/features/ci/admin/builds_spec.rb +++ b/spec/features/ci/admin/builds_spec.rb @@ -1,8 +1,7 @@ require 'spec_helper' describe "Admin Builds" do - let(:project) { FactoryGirl.create :ci_project } - let(:commit) { FactoryGirl.create :ci_commit, project: project } + let(:commit) { FactoryGirl.create :ci_commit } let(:build) { FactoryGirl.create :ci_build, commit: commit } before do @@ -22,10 +21,10 @@ describe "Admin Builds" do describe "Tabs" do it "shows all builds" do - build = FactoryGirl.create :ci_build, commit: commit, status: "pending" - build1 = FactoryGirl.create :ci_build, commit: commit, status: "running" - build2 = FactoryGirl.create :ci_build, commit: commit, status: "success" - build3 = FactoryGirl.create :ci_build, commit: commit, status: "failed" + FactoryGirl.create :ci_build, commit: commit, status: "pending" + FactoryGirl.create :ci_build, commit: commit, status: "running" + FactoryGirl.create :ci_build, commit: commit, status: "success" + FactoryGirl.create :ci_build, commit: commit, status: "failed" visit ci_admin_builds_path diff --git a/spec/features/ci/admin/runners_spec.rb b/spec/features/ci/admin/runners_spec.rb index b25121f0806..b83744f53a8 100644 --- a/spec/features/ci/admin/runners_spec.rb +++ b/spec/features/ci/admin/runners_spec.rb @@ -2,8 +2,7 @@ require 'spec_helper' describe "Admin Runners" do before do - skip_ci_admin_auth - login_as :user + login_as :admin end describe "Runners page" do @@ -20,16 +19,16 @@ describe "Admin Runners" do describe 'search' do before do - FactoryGirl.create :ci_runner, description: 'foo' - FactoryGirl.create :ci_runner, description: 'bar' + FactoryGirl.create :ci_runner, description: 'runner-foo' + FactoryGirl.create :ci_runner, description: 'runner-bar' search_form = find('#runners-search') - search_form.fill_in 'search', with: 'foo' + search_form.fill_in 'search', with: 'runner-foo' search_form.click_button 'Search' end - it { expect(page).to have_content("foo") } - it { expect(page).not_to have_content("bar") } + it { expect(page).to have_content("runner-foo") } + it { expect(page).not_to have_content("runner-bar") } end end @@ -37,8 +36,8 @@ describe "Admin Runners" do let(:runner) { FactoryGirl.create :ci_runner } before do - FactoryGirl.create(:ci_project, name: "foo") - FactoryGirl.create(:ci_project, name: "bar") + @project1 = FactoryGirl.create(:ci_project) + @project2 = FactoryGirl.create(:ci_project) visit ci_admin_runner_path(runner) end @@ -47,19 +46,19 @@ describe "Admin Runners" do end describe 'projects' do - it { expect(page).to have_content("foo") } - it { expect(page).to have_content("bar") } + it { expect(page).to have_content(@project1.name_with_namespace) } + it { expect(page).to have_content(@project2.name_with_namespace) } end describe 'search' do before do search_form = find('#runner-projects-search') - search_form.fill_in 'search', with: 'foo' + search_form.fill_in 'search', with: @project1.gl_project.name search_form.click_button 'Search' end - it { expect(page).to have_content("foo") } - it { expect(page).not_to have_content("bar") } + it { expect(page).to have_content(@project1.name_with_namespace) } + it { expect(page).not_to have_content(@project2.name_with_namespace) } end end end diff --git a/spec/features/ci/builds_spec.rb b/spec/features/ci/builds_spec.rb deleted file mode 100644 index 2f020e524e2..00000000000 --- a/spec/features/ci/builds_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'spec_helper' - -describe "Builds" do - context :private_project do - before do - @project = FactoryGirl.create :ci_project - @commit = FactoryGirl.create :ci_commit, project: @project - @build = FactoryGirl.create :ci_build, commit: @commit - login_as :user - @project.gl_project.team << [@user, :master] - end - - describe "GET /:project/builds/:id" do - before do - visit ci_project_build_path(@project, @build) - end - - it { expect(page).to have_content @commit.sha[0..7] } - it { expect(page).to have_content @commit.git_commit_message } - it { expect(page).to have_content @commit.git_author_name } - end - - describe "GET /:project/builds/:id/cancel" do - before do - @build.run! - visit cancel_ci_project_build_path(@project, @build) - end - - it { expect(page).to have_content 'canceled' } - it { expect(page).to have_content 'Retry' } - end - - describe "POST /:project/builds/:id/retry" do - before do - @build.cancel! - visit ci_project_build_path(@project, @build) - click_link 'Retry' - end - - it { expect(page).to have_content 'pending' } - it { expect(page).to have_content 'Cancel' } - end - end - - context :public_project do - describe "Show page public accessible" do - before do - @project = FactoryGirl.create :ci_public_project - @commit = FactoryGirl.create :ci_commit, project: @project - @runner = FactoryGirl.create :ci_specific_runner - @build = FactoryGirl.create :ci_build, commit: @commit, runner: @runner - - stub_gitlab_calls - visit ci_project_build_path(@project, @build) - end - - it { expect(page).to have_content @commit.sha[0..7] } - end - end -end diff --git a/spec/features/ci/commits_spec.rb b/spec/features/ci/commits_spec.rb deleted file mode 100644 index 40a62ca4574..00000000000 --- a/spec/features/ci/commits_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'spec_helper' - -describe "Commits" do - include Ci::CommitsHelper - - context "Authenticated user" do - before do - @project = FactoryGirl.create :ci_project - @commit = FactoryGirl.create :ci_commit, project: @project - @build = FactoryGirl.create :ci_build, commit: @commit - login_as :user - @project.gl_project.team << [@user, :master] - end - - describe "GET /:project/commits/:sha" do - before do - visit ci_commit_path(@commit) - end - - it { expect(page).to have_content @commit.sha[0..7] } - it { expect(page).to have_content @commit.git_commit_message } - it { expect(page).to have_content @commit.git_author_name } - end - - describe "Cancel commit" do - it "cancels commit" do - visit ci_commit_path(@commit) - click_on "Cancel" - - expect(page).to have_content "canceled" - end - end - - describe ".gitlab-ci.yml not found warning" do - it "does not show warning" do - visit ci_commit_path(@commit) - - expect(page).not_to have_content ".gitlab-ci.yml not found in this commit" - end - - it "shows warning" do - @commit.push_data[:ci_yaml_file] = nil - @commit.save - - visit ci_commit_path(@commit) - - expect(page).to have_content ".gitlab-ci.yml not found in this commit" - end - end - end - - context "Public pages" do - before do - @project = FactoryGirl.create :ci_public_project - @commit = FactoryGirl.create :ci_commit, project: @project - @build = FactoryGirl.create :ci_build, commit: @commit - end - - describe "GET /:project/commits/:sha" do - before do - visit ci_commit_path(@commit) - end - - it { expect(page).to have_content @commit.sha[0..7] } - it { expect(page).to have_content @commit.git_commit_message } - it { expect(page).to have_content @commit.git_author_name } - end - end -end diff --git a/spec/features/ci/projects_spec.rb b/spec/features/ci/projects_spec.rb deleted file mode 100644 index 7c8cd1ce5c7..00000000000 --- a/spec/features/ci/projects_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'spec_helper' - -describe "Projects" do - let(:user) { create(:user) } - - before do - login_as(user) - @project = FactoryGirl.create :ci_project, name: "GitLab / gitlab-shell" - @project.gl_project.team << [user, :master] - end - - describe "GET /ci/projects/:id" do - before do - visit ci_project_path(@project) - end - - it { expect(page).to have_content @project.name } - it { expect(page).to have_content 'All commits' } - end - - describe "GET /ci/projects/:id/edit" do - before do - visit edit_ci_project_path(@project) - end - - it { expect(page).to have_content @project.name } - it { expect(page).to have_content 'Build Schedule' } - - it "updates configuration" do - fill_in 'Timeout', with: '70' - click_button 'Save changes' - - expect(page).to have_content 'was successfully updated' - - expect(find_field('Timeout').value).to eq '70' - end - end -end diff --git a/spec/features/ci_settings_spec.rb b/spec/features/ci_settings_spec.rb new file mode 100644 index 00000000000..7e25e883018 --- /dev/null +++ b/spec/features/ci_settings_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "CI settings" do + let(:user) { create(:user) } + before { login_as(user) } + + before do + @project = FactoryGirl.create :ci_project + @gl_project = @project.gl_project + @gl_project.team << [user, :master] + visit edit_namespace_project_ci_settings_path(@gl_project.namespace, @gl_project) + end + + it { expect(page).to have_content 'Build Schedule' } + + it "updates configuration" do + fill_in 'Timeout', with: '70' + click_button 'Save changes' + expect(page).to have_content 'was successfully updated' + expect(find_field('Timeout').value).to eq '70' + end +end diff --git a/spec/features/ci_web_hooks_spec.rb b/spec/features/ci_web_hooks_spec.rb new file mode 100644 index 00000000000..efae0a42c1e --- /dev/null +++ b/spec/features/ci_web_hooks_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe 'CI web hooks' do + let(:user) { create(:user) } + before { login_as(user) } + + before do + @project = FactoryGirl.create :ci_project + @gl_project = @project.gl_project + @gl_project.team << [user, :master] + visit namespace_project_ci_web_hooks_path(@gl_project.namespace, @gl_project) + end + + context 'create a trigger' do + before do + fill_in 'web_hook_url', with: 'http://example.com' + click_on 'Add Web Hook' + end + + it { expect(@project.web_hooks.count).to eq(1) } + + it 'revokes the trigger' do + click_on 'Remove' + expect(@project.web_hooks.count).to eq(0) + end + end +end diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb new file mode 100644 index 00000000000..1adc2cdf70a --- /dev/null +++ b/spec/features/commits_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +describe "Commits" do + include CiStatusHelper + + let(:project) { create(:project) } + + describe "CI" do + before do + login_as :user + project.team << [@user, :master] + @ci_project = project.ensure_gitlab_ci_project + @commit = FactoryGirl.create :ci_commit, gl_project: project, sha: project.commit.sha + @build = FactoryGirl.create :ci_build, commit: @commit + @generic_status = FactoryGirl.create :generic_commit_status, commit: @commit + end + + before do + stub_ci_commit_to_return_yaml_file + end + + describe "GET /:project/commits/:sha" do + before do + visit ci_status_path(@commit) + end + + it { expect(page).to have_content @commit.sha[0..7] } + it { expect(page).to have_content @commit.git_commit_message } + it { expect(page).to have_content @commit.git_author_name } + end + + describe "Cancel all builds" do + it "cancels commit" do + visit ci_status_path(@commit) + click_on "Cancel all" + expect(page).to have_content "canceled" + end + end + + describe "Cancel build" do + it "cancels build" do + visit ci_status_path(@commit) + click_on "Cancel" + expect(page).to have_content "canceled" + end + end + + describe ".gitlab-ci.yml not found warning" do + it "does not show warning" do + visit ci_status_path(@commit) + expect(page).not_to have_content ".gitlab-ci.yml not found in this commit" + end + + it "shows warning" do + stub_ci_commit_yaml_file(nil) + visit ci_status_path(@commit) + expect(page).to have_content ".gitlab-ci.yml not found in this commit" + end + end + end +end diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb index cef432e512b..922c76285d1 100644 --- a/spec/features/login_spec.rb +++ b/spec/features/login_spec.rb @@ -95,7 +95,7 @@ feature 'Login', feature: true do user = create(:user, password: 'not-the-default') login_with(user) - expect(page).to have_content('Invalid email or password.') + expect(page).to have_content('Invalid login or password.') end end end diff --git a/spec/features/markdown_spec.rb b/spec/features/markdown_spec.rb index c557a1061af..fdd8cf07b12 100644 --- a/spec/features/markdown_spec.rb +++ b/spec/features/markdown_spec.rb @@ -220,7 +220,7 @@ describe 'GitLab Markdown', feature: true do end end - # `markdown` calls these two methods + # Fake a `current_user` helper def current_user @feat.user end diff --git a/spec/features/password_reset_spec.rb b/spec/features/password_reset_spec.rb index 2b6311e4fd7..85e70b4d47f 100644 --- a/spec/features/password_reset_spec.rb +++ b/spec/features/password_reset_spec.rb @@ -1,53 +1,43 @@ require 'spec_helper' feature 'Password reset', feature: true do - def forgot_password - click_on 'Forgot your password?' - fill_in 'Email', with: user.email - click_button 'Reset password' - user.reload - end - - def get_reset_token - mail = ActionMailer::Base.deliveries.last - body = mail.body.encoded - body.scan(/reset_password_token=(.+)\"/).flatten.first - end - - def reset_password(password = 'password') - visit edit_user_password_path(reset_password_token: get_reset_token) + describe 'throttling' do + it 'sends reset instructions when not previously sent' do + visit root_path + forgot_password(create(:user)) - fill_in 'New password', with: password - fill_in 'Confirm new password', with: password - click_button 'Change your password' - end + expect(page).to have_content(I18n.t('devise.passwords.send_instructions')) + expect(current_path).to eq new_user_session_path + end - describe 'with two-factor authentication' do - let(:user) { create(:user, :two_factor) } + it 'sends reset instructions when previously sent more than a minute ago' do + user = create(:user) + user.send_reset_password_instructions + user.update_attribute(:reset_password_sent_at, 5.minutes.ago) - it 'requires login after password reset' do visit root_path + forgot_password(user) - forgot_password - reset_password - - expect(page).to have_content("Your password was changed successfully.") - expect(page).not_to have_content("You are now signed in.") + expect(page).to have_content(I18n.t('devise.passwords.send_instructions')) expect(current_path).to eq new_user_session_path end - end - describe 'without two-factor authentication' do - let(:user) { create(:user) } + it "throttles multiple resets in a short timespan" do + user = create(:user) + user.send_reset_password_instructions - it 'automatically logs in after password reset' do visit root_path + forgot_password(user) - forgot_password - reset_password - - expect(current_path).to eq root_path - expect(page).to have_content("Your password was changed successfully. You are now signed in.") + expect(page).to have_content(I18n.t('devise.passwords.recently_reset')) + expect(current_path).to eq new_user_password_path end end + + def forgot_password(user) + click_on 'Forgot your password?' + fill_in 'Email', with: user.email + click_button 'Reset password' + user.reload + end end diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index a362c54b9ad..09fcff2444a 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -34,6 +34,27 @@ feature 'Project', feature: true do end end + describe 'remove forked relationship', js: true do + let(:user) { create(:user) } + let(:project) { create(:project, namespace: user.namespace) } + + before do + login_with user + create(:forked_project_link, forked_to_project: project) + visit edit_namespace_project_path(project.namespace, project) + end + + it 'should remove fork' do + expect(page).to have_content 'Remove fork relationship' + + remove_with_confirm('Remove fork relationship', project.path) + + expect(page).to have_content 'The fork relationship has been removed.' + expect(project.forked?).to be_falsey + expect(page).not_to have_content 'Remove fork relationship' + end + end + describe 'removal', js: true do let(:user) { create(:user) } let(:project) { create(:project, namespace: user.namespace) } @@ -45,13 +66,13 @@ feature 'Project', feature: true do end it 'should remove project' do - expect { remove_project }.to change {Project.count}.by(-1) + expect { remove_with_confirm('Remove project', project.path) }.to change {Project.count}.by(-1) end end - def remove_project - click_link "Remove project" - fill_in 'confirm_name_input', with: project.path + def remove_with_confirm(button_text, confirm_with) + click_button button_text + fill_in 'confirm_name_input', with: confirm_with click_button 'Confirm' end end diff --git a/spec/features/ci/runners_spec.rb b/spec/features/runners_spec.rb index 15147f15eb3..06adb7633b2 100644 --- a/spec/features/ci/runners_spec.rb +++ b/spec/features/runners_spec.rb @@ -1,11 +1,10 @@ require 'spec_helper' describe "Runners" do - let(:user) { create(:user) } + include GitlabRoutingHelper - before do - login_as(user) - end + let(:user) { create(:user) } + before { login_as(user) } describe "specific runners" do before do @@ -20,18 +19,17 @@ describe "Runners" do @specific_runner2 = FactoryGirl.create :ci_specific_runner @project.runners << @specific_runner @project2.runners << @specific_runner2 + + visit runners_path(@project.gl_project) end it "places runners in right places" do - visit ci_project_runners_path(@project) expect(page.find(".available-specific-runners")).to have_content(@specific_runner2.display_name) expect(page.find(".activated-specific-runners")).to have_content(@specific_runner.display_name) expect(page.find(".available-shared-runners")).to have_content(@shared_runner.display_name) end it "enables specific runner for project" do - visit ci_project_runners_path(@project) - within ".available-specific-runners" do click_on "Enable for this project" end @@ -41,8 +39,7 @@ describe "Runners" do it "disables specific runner for project" do @project2.runners << @specific_runner - - visit ci_project_runners_path(@project) + visit runners_path(@project.gl_project) within ".activated-specific-runners" do click_on "Disable for this project" @@ -52,8 +49,6 @@ describe "Runners" do end it "removes specific runner for project if this is last project for that runners" do - visit ci_project_runners_path(@project) - within ".activated-specific-runners" do click_on "Remove runner" end @@ -66,13 +61,11 @@ describe "Runners" do before do @project = FactoryGirl.create :ci_project @project.gl_project.team << [user, :master] + visit runners_path(@project.gl_project) end it "enables shared runners" do - visit ci_project_runners_path(@project) - click_on "Enable shared runners" - expect(@project.reload.shared_runners_enabled).to be_truthy end end @@ -83,13 +76,11 @@ describe "Runners" do @project.gl_project.team << [user, :master] @specific_runner = FactoryGirl.create :ci_specific_runner @project.runners << @specific_runner + visit runners_path(@project.gl_project) end it "shows runner information" do - visit ci_project_runners_path(@project) - click_on @specific_runner.short_sha - expect(page).to have_content(@specific_runner.platform) end end diff --git a/spec/features/ci/triggers_spec.rb b/spec/features/triggers_spec.rb index c6afeb74628..69492d58878 100644 --- a/spec/features/ci/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -1,13 +1,14 @@ require 'spec_helper' describe 'Triggers' do - let(:user) { create(:user) } + let(:user) { create(:user) } + before { login_as(user) } before do - login_as(user) @project = FactoryGirl.create :ci_project - @project.gl_project.team << [user, :master] - visit ci_project_triggers_path(@project) + @gl_project = @project.gl_project + @gl_project.team << [user, :master] + visit namespace_project_triggers_path(@gl_project.namespace, @gl_project) end context 'create a trigger' do diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index efcb8a31abe..c1248162031 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' feature 'Users', feature: true do + let(:user) { create(:user, username: 'user1', name: 'User 1', email: 'user1@gitlab.com') } + scenario 'GET /users/sign_in creates a new user account' do visit new_user_session_path fill_in 'user_name', with: 'Name Surname' @@ -11,7 +13,6 @@ feature 'Users', feature: true do end scenario 'Successful user signin invalidates password reset token' do - user = create(:user) expect(user.reset_password_token).to be_nil visit new_user_password_path @@ -28,7 +29,6 @@ feature 'Users', feature: true do expect(user.reset_password_token).to be_nil end - let!(:user) { create(:user, username: 'user1', name: 'User 1', email: 'user1@gitlab.com') } scenario 'Should show one error if email is already taken' do visit new_user_session_path fill_in 'user_name', with: 'Another user name' diff --git a/spec/features/ci/variables_spec.rb b/spec/features/variables_spec.rb index e387b3be555..adb602f3edd 100644 --- a/spec/features/ci/variables_spec.rb +++ b/spec/features/variables_spec.rb @@ -1,28 +1,25 @@ require 'spec_helper' describe "Variables" do - let(:user) { create(:user) } - - before do - login_as(user) - end + let(:user) { create(:user) } + before { login_as(user) } describe "specific runners" do before do @project = FactoryGirl.create :ci_project - @project.gl_project.team << [user, :master] + @gl_project = @project.gl_project + @gl_project.team << [user, :master] end it "creates variable", js: true do - visit ci_project_variables_path(@project) + visit namespace_project_variables_path(@gl_project.namespace, @gl_project) click_on "Add a variable" fill_in "Key", with: "SECRET_KEY" fill_in "Value", with: "SECRET_VALUE" click_on "Save changes" - + expect(page).to have_content("Variables were successfully updated.") expect(@project.variables.count).to eq(1) end - end end |