added 260907 version of worker toolkit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
RSpec.configure do |config|
|
||||
config.include ActiveSupport::Testing::TimeHelpers
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
RSpec.configure do |config|
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner[:active_record].clean_with(:truncation)
|
||||
DatabaseCleaner[:mongoid].clean_with(:deletion)
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner[:active_record].strategy = :transaction
|
||||
end
|
||||
|
||||
config.before(:each, js: true) do
|
||||
DatabaseCleaner[:active_record].strategy = :truncation
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner[:active_record].start
|
||||
DatabaseCleaner[:mongoid].start
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
DatabaseCleaner[:active_record].clean
|
||||
DatabaseCleaner[:mongoid].clean
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
RSpec.configure do |config|
|
||||
config.before(:each, type: :controller) do
|
||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
end
|
||||
|
||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
RSpec.configure do |config|
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
module ForeignKeyChecks
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def disable_foreign_key_checks(table)
|
||||
ActiveRecord::Base.connection.execute("ALTER TABLE #{table} DISABLE TRIGGER ALL;")
|
||||
end
|
||||
|
||||
def enable_foreign_key_checks(table)
|
||||
ActiveRecord::Base.connection.execute("ALTER TABLE #{table} ENABLE TRIGGER ALL;")
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.include ForeignKeyChecks, type: :model
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
module ResponseHelpers
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def response_body
|
||||
@response_body ||= ActiveSupport::HashWithIndifferentAccess.new(
|
||||
(begin
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
rescue
|
||||
{}
|
||||
end)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.include ResponseHelpers, type: :controller
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
require "spec_helper"
|
||||
|
||||
shared_examples_for "fiveable" do
|
||||
include Mongoid::Matchers
|
||||
|
||||
it { is_expected.to respond_to(:value) }
|
||||
it { is_expected.to validate_inclusion_of(:value).to_allow(0..4) }
|
||||
end
|
||||
14
worker-toolkit-flaredown/repo/backend/spec/support/vcr.rb
Normal file
14
worker-toolkit-flaredown/repo/backend/spec/support/vcr.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
require "vcr"
|
||||
|
||||
VCR.configure do |c|
|
||||
c.cassette_library_dir = "spec/fixtures/vcr_cassettes"
|
||||
c.default_cassette_options = {allow_playback_repeats: true}
|
||||
# comment the following line when you want WebMock to suggest you to stub requests
|
||||
c.hook_into :webmock
|
||||
c.configure_rspec_metadata!
|
||||
c.allow_http_connections_when_no_cassette = true
|
||||
c.ignore_localhost = true
|
||||
|
||||
# Put placeholders instead of sensitive data in our cassettes
|
||||
c.filter_sensitive_data("<RECAPTCHA_SECRET_KEY>") { ENV["RECAPTCHA_SECRET_KEY"] }
|
||||
end
|
||||
Reference in New Issue
Block a user