Skip to content

Commit

Permalink
Fix tests [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
falusi94 committed Oct 29, 2019
1 parent 14cb4ff commit 5bf40d4
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 22 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -55,6 +55,7 @@ group :test do
gem 'factory_bot_rails'

gem 'mocha'
gem 'rails-controller-testing'
gem 'shoulda-matchers'
gem 'timecop'
end
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Expand Up @@ -177,6 +177,10 @@ GEM
bundler (>= 1.3.0)
railties (= 5.0.7.2)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
actionview (>= 5.0.1.x)
activesupport (>= 5.0.1.x)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -288,6 +292,7 @@ DEPENDENCIES
pg
puma
rails (~> 5.0.7.2)
rails-controller-testing
render_anywhere
rollbar
rspec-rails (~> 3.8)
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/admin/svie_controller_test.rb
@@ -1,7 +1,7 @@
require 'test_helper'

module Admin
class SvieControllerTest < ActionController::TestCase
class SvieControllerTest < ActionDispatch::IntegrationTest
test 'applications page enabled for rvt members' do
login_as_user(:rvt_member)
get :index
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/auth_sch_services_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class AuthSchServicesControllerTest < ActionController::TestCase
class AuthSchServicesControllerTest < ActionDispatch::IntegrationTest
test 'basic data with invalid id' do
get :sync, id: 'invalidid'

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/evaluations_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class EvaluationsControllerTest < ActionController::TestCase
class EvaluationsControllerTest < ActionDispatch::IntegrationTest
setup do
login_as_user(:evaluation_giver)
end
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/groups_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class GroupsControllerTest < ActionController::TestCase
class GroupsControllerTest < ActionDispatch::IntegrationTest
setup do
login_as_user(:sanyi)
end
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/membership_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class MembershipsControllerTest < ActionController::TestCase
class MembershipsControllerTest < ActionDispatch::IntegrationTest
setup do
login_as_user(:babhamozo_leader)
request.env['HTTP_REFERER'] = 'http://test.host/groups/1'
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/post_types_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class PostTypesControllerTest < ActionController::TestCase
class PostTypesControllerTest < ActionDispatch::IntegrationTest
setup do
login_as_user(:babhamozo_leader)
request.env['HTTP_REFERER'] = 'http://test.host/groups/1'
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/profiles_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class ProfilesControllerTest < ActionController::TestCase
class ProfilesControllerTest < ActionDispatch::IntegrationTest
setup do
login_as_user(:sanyi)
end
Expand Down
14 changes: 7 additions & 7 deletions test/controllers/registration_controller_test.rb
@@ -1,13 +1,13 @@
require 'test_helper'

class RegistrationControllerTest < ActionController::TestCase
class RegistrationControllerTest < ActionDispatch::IntegrationTest
setup do
session[:oauth_data] = {
'internal_id' => 'abc',
'mail' => 'abc@def.gh',
'givenName' => 'Károly',
'sn' => 'Alma'
}
# session[:oauth_data] = {
# 'internal_id' => 'abc',
# 'mail' => 'abc@def.gh',
# 'givenName' => 'Károly',
# 'sn' => 'Alma'
# }
end

test 'show registration page' do
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/search_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class SearchControllerTest < ActionController::TestCase
class SearchControllerTest < ActionDispatch::IntegrationTest
setup do
login_as_user(:sanyi)
end
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/svie_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class SvieControllerTest < ActionController::TestCase
class SvieControllerTest < ActionDispatch::IntegrationTest
setup do
login_as_user(:user_with_primary_membership)
end
Expand Down
2 changes: 1 addition & 1 deletion test/integration/point_history_calculation_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class PointHistoryCalculationTest < ActionController::TestCase
class PointHistoryCalculationTest < ActionDispatch::IntegrationTest
test 'calculate point history at changing to offseason' do
point_history_count = PointHistory.count

Expand Down
2 changes: 1 addition & 1 deletion test/models/group_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class GroupTest < ActionController::TestCase
class GroupTest < ActionDispatch::IntegrationTest
test 'group is active when newly founded' do
group = create(:group, :with_additional_info)
time = Time.new(group.founded)
Expand Down
2 changes: 1 addition & 1 deletion test/models/membership_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class MembershipTest < ActionController::TestCase
class MembershipTest < ActionDispatch::IntegrationTest
test 'delegation became false when archive' do
user = create(:user, :who_delegated)
membership = user.primary_membership
Expand Down
2 changes: 1 addition & 1 deletion test/models/point_detail_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class PointDetailTest < ActionController::TestCase
class PointDetailTest < ActionDispatch::IntegrationTest
test 'save point less then zero will be zero' do
point_detail = create(:point_detail)

Expand Down
2 changes: 1 addition & 1 deletion test/models/semester_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class SemesterTest < ActionController::TestCase
class SemesterTest < ActionDispatch::IntegrationTest
test 'converting from and to string' do
assert_equal '201620171', Semester.new('201620171').to_s
end
Expand Down
2 changes: 1 addition & 1 deletion test/models/user_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class UserTest < ActionController::TestCase
class UserTest < ActionDispatch::IntegrationTest
# test 'test cellphone format invalid' do
# user = users(:sanyi)
# user.cell_phone = 'asdf'
Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Expand Up @@ -2,6 +2,7 @@
require File.expand_path('../config/environment', __dir__)
require 'rails/test_help'
require 'mocha/minitest'
require_relative '../spec/support/authentication_helper.rb'

module ActiveSupport
class TestCase
Expand All @@ -15,6 +16,7 @@ class TestCase

# Add more helper methods to be used by all tests here...
def login_as_user(user_name)
# AuthenticationHelper.login_as(users(user_name))
session[:user_id] = users(user_name).id
end
end
Expand Down

0 comments on commit 5bf40d4

Please sign in to comment.