I'm loading it in my spec_helper before everything:

# frozen_string_literal: true

# Set RACK_ENV to test.
ENV['RACK_ENV'] = 'test'

require 'rack/test'
require 'fabrication'

require_relative '../app'

# Require all files in spec/support folder.
root_path = Pathname.new(File.expand_path('..', __dir__))
Dir[root_path.join('spec/support/**/*.rb')].sort.each { |f| require f }

RSpec.configure do |config|
  config.include Rack::Test::Methods, type: :request
  config.include ApiHelpers,          type: :request

  config.include(Module.new do
    def app
      App.freeze.app
    end
  end)

  # Configuration for database cleaning strategy using Sequel.
  config.around do |example|
    DB.transaction(rollback: :always, auto_savepoint: true) { example.run }
  end
end



środa, 6 stycznia 2021 o 00:47:16 UTC+1 Jeremy Evans napisał(a):

> On Tue, Jan 5, 2021 at 1:41 PM Mateusz Urbanski <
> [email protected]> wrote:
>
>> When I use Fabrication I receive the following error:
>>
>>      FrozenError:
>>
>>        can't modify frozen Array: [Sequel::Model, 
>> Sequel::Model::Associations, Sequel::Plugins::AutoValidations, 
>> Sequel::Plugins::ValidationHelpers, Sequel::Plugins::PreparedStatements, 
>> Sequel::Plugins::Subclasses, Sequel::Plugins::Timestamps]
>>
>>
>> This is because I use:
>>
>> Sequel::Model.freeze_descendents
>>
>
> While I don't have experience with Fabrication, I assume you want to load 
> Fabrication before freezing.
>
> Thanks,
> Jeremy 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/2fb96f65-9cb8-413e-a7bd-da9b145089f1n%40googlegroups.com.

Reply via email to