Skip to content

Commit

Permalink
more Current #499
Browse files Browse the repository at this point in the history
  • Loading branch information
mjy committed Oct 4, 2018
1 parent 41f5dfb commit 7af9d5a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions spec/support/models.rb
Expand Up @@ -36,13 +36,13 @@ def find_or_create_root_taxon_name
# @return [Integer, nil]
# accessor to the global
def user_id
$user_id
Current.user_id || $user_id
end

# @return [Integer, nil]
# accessor to the global
def project_id
$project_id
Current.project_id || $project_id
end
end

Expand Down
11 changes: 8 additions & 3 deletions spec/support/projects_and_users.rb
Expand Up @@ -7,17 +7,22 @@ def self.clean_slate
ProjectMember.delete_all
Project.delete_all
User.delete_all
$user_id = nil
$user_id = nil
Current.user_id = nil
$project_id = nil
Current.project_id = nil
end

# This is used before all tests of type :model, :controller, :helper
def self.spin_up_projects_users_and_housekeeping
# Order matters
FactoryBot.create(:valid_user, id: 1, self_created: true)
$user_id = 1
$user_id = 1 # TODO: remove
Current.user_id = 1

FactoryBot.create(:valid_project, id: 1, without_root_taxon_name: true)
$project_id = 1
Current.project_id = 1
$project_id = 1 # TODO: remove
FactoryBot.create(:project_member, user_id: 1, project_id: 1)

# TODO: Not sure why this is required, perhaps Spring related?!
Expand Down

0 comments on commit 7af9d5a

Please sign in to comment.