Add controller tests
Co-authored-by: viehlieb <pf@pragma-shift.net> Co-authored-by: Tobias Kneuker <tk@pragma-shift.net> seperate expects refactor login user calls add more articles to test sorting with fix: fix test for rails upgrade
This commit is contained in:
parent
f2965e6673
commit
d3d7acc7ce
13 changed files with 932 additions and 16 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module SpecTestHelper
|
||||
def login(user)
|
||||
user = User.find_by_nick(user.nick)
|
||||
user = User.where(:nick => user.nick).first if user.is_a?(Symbol)
|
||||
session[:user_id] = user.id
|
||||
session[:scope] = FoodsoftConfig[:default_scope] # Save scope in session to not allow switching between foodcoops with one account
|
||||
session[:locale] = user.locale
|
||||
|
|
@ -16,8 +16,13 @@ module SpecTestHelper
|
|||
params['foodcoop'] = FoodsoftConfig[:default_scope]
|
||||
get action, params: params, xhr: xhr, format: format
|
||||
end
|
||||
|
||||
def post_with_defaults(action, params: {}, xhr: false, format: nil)
|
||||
params['foodcoop'] = FoodsoftConfig[:default_scope]
|
||||
post action, params: params, xhr: xhr, format: format
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.include SpecTestHelper, type: :controller
|
||||
config.include SpecTestHelper, :type => :controller
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue