Skip to content

Commit

Permalink
Facilitate testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Clemens Kofler authored and Tyler Mauthe committed Dec 24, 2017
1 parent 4e2b7f4 commit 3051934
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/dashing/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def authenticated?(token)
set :auth_token, nil
set :template_languages, %i[html erb]

if File.exists?(settings.history_file)
if File.exist?(settings.history_file)
set :history, YAML.load_file(settings.history_file)
else
set :history, {}
Expand Down Expand Up @@ -171,7 +171,7 @@ def require_glob(relative_glob)
end

settings_file = File.join(settings.root, 'config/settings.rb')
require settings_file if File.exists?(settings_file)
require settings_file if File.exist?(settings_file)

{}.to_json # Forces your json codec to initialize (in the event that it is lazily loaded). Does this before job threads start.
job_path = ENV["JOB_PATH"] || 'jobs'
Expand Down
5 changes: 5 additions & 0 deletions test/app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ def with_generated_project
app.settings.public_folder = File.join(dir, 'new_project/public')
app.settings.views = File.join(dir, 'new_project/dashboards')
app.settings.root = File.join(dir, 'new_project')

app.settings.raise_errors = true
app.settings.dump_errors = false
app.settings.show_exceptions = false

yield app.settings.root
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def temp
yield path
ensure
Dir.chdir WORKING_DIRECTORY
FileUtils.rm_rf(path) if File.exists?(path)
FileUtils.rm_rf(path) if File.exist?(path)
end

module Dashing
Expand Down

0 comments on commit 3051934

Please sign in to comment.