Sha256: 28c3ae30fbe5347034ef480c259da74e2b773fddf1ea51be258826c2a3b47bdd
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require File.expand_path("../lib/redstream", __dir__) require "active_record" require "factory_bot" require "database_cleaner" require "timecop" require "concurrent" require "rspec/instafail" ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: "/tmp/redstream.sqlite3") ActiveRecord::Base.connection.execute "DROP TABLE IF EXISTS products" ActiveRecord::Base.connection.create_table :products do |t| t.string :title t.timestamps null: false end class Product < ActiveRecord::Base include Redstream::Model redstream_callbacks def redstream_payload { id: id } end end FactoryBot.define do factory :product do title { "title" } end end module SpecHelper def redis @redis ||= Redis.new end end RSpec.configure do |config| config.add_formatter(RSpec::Instafail) config.add_formatter(:progress) config.include SpecHelper config.include FactoryBot::Syntax::Methods config.before(:suite) do DatabaseCleaner.strategy = :truncation end config.around do |example| DatabaseCleaner.cleaning { example.run } end config.after do Redis.new.flushdb end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redstream-0.6.1 | spec/spec_helper.rb |
redstream-0.6.0 | spec/spec_helper.rb |