This repository was archived by the owner on Mar 1, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathtest_helper.rb
More file actions
60 lines (49 loc) · 1.55 KB
/
Copy pathtest_helper.rb
File metadata and controls
60 lines (49 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
ENV['RAILS_ENV'] ||= 'test'
if ["manual", "travis"].include?(ENV["RUN_COVERAGE"])
require 'simplecov'
require 'codeclimate-test-reporter' if ENV["RUN_COVERAGE"] == "travis"
SimpleCov.add_filter 'vendor/'
SimpleCov.add_filter 'app/mailers/mail_preview.rb'
if ENV["RUN_COVERAGE"] == "travis"
SimpleCov.formatters = []
SimpleCov.start CodeClimate::TestReporter.configuration.profile
else
SimpleCov.start 'rails'
end
end
# This must be AFTER SimpleCov is required, or it won't work
require_relative '../config/environment'
require 'rails/test_help'
require "strip_attributes/matchers"
require "minitest/reporters"
require "valid_attribute"
require "factory_bot_rails"
require "sidekiq/testing"
require "webmock/minitest"
require_relative './matchers'
Minitest::Reporters.use!
def sample_file(filename = "sample_pdf.pdf")
File.new("test/fixtures/#{filename}")
end
# Clean up Paperclip uploads generated during tests
Minitest.after_run do
FileUtils.rm_rf(Dir["#{Rails.root}/public/system/"])
end
class ActiveSupport::TestCase
extend StripAttributes::Matchers
include ValidAttribute::Method
include FactoryBot::Syntax::Methods
extend HackathonManager::Shoulda::Matchers
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
class ActionController::TestCase
include Devise::Test::ControllerHelpers
end
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :minitest
with.library :rails
end
end