Skip to content

Commit

Permalink
[ci] Fix authentification helper methods inclusion on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Moises Deniz Aleman authored and hennevogel committed Feb 4, 2016
1 parent 8dfed31 commit 545ecd6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/api/spec/browser_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
require 'support/capybara'
require 'capybara/poltergeist'

# support log in/log out...
require 'support/functional/authentification'
# helper methods for authentification in features tests
require 'support/features/features_authentification'
4 changes: 2 additions & 2 deletions src/api/spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
# support Suse::backend
require 'support/backend'

# support controllers authentification
require 'support/controllers/authentification'
# helper methods for authentification in controllers tests
require 'support/controllers/controllers_authentification'
7 changes: 0 additions & 7 deletions src/api/spec/support/controllers/authentification.rb

This file was deleted.

13 changes: 13 additions & 0 deletions src/api/spec/support/controllers/controllers_authentification.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module ControllersAuthentification
def login(user)
request.session[:login] = user.login
end

def logout
request.session[:login] = nil
end
end

RSpec.configure do |c|
c.include ControllersAuthentification, type: :controller
end
16 changes: 16 additions & 0 deletions src/api/spec/support/features/features_authentification.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module FeaturesAuthentification
def login(user, password = 'buildservice')
visit user_login_path
fill_in 'Username', with: user.login
fill_in 'Password', with: password
click_button 'Log In'
end

def logout
visit user_logout_path
end
end

RSpec.configure do |c|
c.include FeaturesAuthentification, type: :feature
end
10 changes: 0 additions & 10 deletions src/api/spec/support/functional/authentification.rb

This file was deleted.

0 comments on commit 545ecd6

Please sign in to comment.