summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-11-02 12:02:51 +0100
committerRémy Coutable <remy@rymai.me>2017-11-02 12:02:51 +0100
commit0364e074479ac8204365fa6b6109011042431575 (patch)
tree78ec519957920fe37325140587c26fa4026e394b
parent1c17ddba662872bf6ad9a9fe04137023476df50c (diff)
downloadgitlab-ce-0364e074479ac8204365fa6b6109011042431575.tar.gz
Address Douwe's feedback
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--doc/development/testing_guide/best_practices.md2
-rw-r--r--spec/support/live_debugger.rb5
-rw-r--r--spec/support/login_helpers.rb8
3 files changed, 12 insertions, 3 deletions
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md
index bbdeee05579..a165a17f5db 100644
--- a/doc/development/testing_guide/best_practices.md
+++ b/doc/development/testing_guide/best_practices.md
@@ -72,7 +72,7 @@ To resume the test run, press any key.
For example:
-```ruby
+```
$ bin/rspec spec/features/auto_deploy_spec.rb:34
Running via Spring preloader in process 8999
Run options: include {:locations=>{"./spec/features/auto_deploy_spec.rb"=>[34]}}
diff --git a/spec/support/live_debugger.rb b/spec/support/live_debugger.rb
index 8359a81059b..911eb48a8ca 100644
--- a/spec/support/live_debugger.rb
+++ b/spec/support/live_debugger.rb
@@ -2,9 +2,10 @@ require 'io/console'
module LiveDebugger
def live_debug
- puts "\nCurrent example is paused for live debugging."
+ puts
+ puts "Current example is paused for live debugging."
puts "Opening #{current_url} in your default browser..."
- puts "The current user credentials are: #{@current_user.username} / 12345678" if @current_user
+ puts "The current user credentials are: #{@current_user.username} / #{@current_user.password}" if @current_user
puts "Press any key to resume the execution of the example!!"
`open #{current_url}`
diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb
index 2ca05bb1778..de46d2ebf29 100644
--- a/spec/support/login_helpers.rb
+++ b/spec/support/login_helpers.rb
@@ -11,6 +11,13 @@ module LoginHelpers
@current_user = resource
end
+ # Overriding Devise::Test::IntegrationHelpers#sign_out to clear @current_user.
+ def sign_out(resource_or_scope)
+ super
+
+ @current_user = nil
+ end
+
# Internal: Log in as a specific user or a new user of a specific role
#
# user_or_role - User object, or a role to create (e.g., :admin, :user)
@@ -49,6 +56,7 @@ module LoginHelpers
def gitlab_sign_out
find(".header-user-dropdown-toggle").click
click_link "Sign out"
+ @current_user = nil
expect(page).to have_button('Sign in')
end