Sha256: 92a07c46d1dffcf4d1f51d4e381efc2745b60e74c147faed415711ae8152f88a

Contents?: true

Size: 1.18 KB

Versions: 21

Compression:

Stored size: 1.18 KB

Contents

require 'sequel'

Sequel::Model.db = Sequel.sqlite(':memory:')
Sequel.extension :migration, :core_extensions

require 'flipper/adapters/sequel'
require 'generators/flipper/templates/sequel_migration'

RSpec.describe Flipper::Adapters::Sequel do
  subject do
    described_class.new(feature_class: feature_class,
                        gate_class: gate_class)
  end

  let(:feature_class) { Flipper::Adapters::Sequel::Feature }
  let(:gate_class) { Flipper::Adapters::Sequel::Gate }

  before(:each) do
    CreateFlipperTablesSequel.new(Sequel::Model.db).up
    feature_class.dataset = feature_class.dataset
    gate_class.dataset = gate_class.dataset
  end

  after(:each) do
    CreateFlipperTablesSequel.new(Sequel::Model.db).down
  end

  it_should_behave_like 'a flipper adapter'

  context 'requiring "flipper-sequel"' do
    before do
      Flipper.configuration = nil
      Flipper.instance = nil

      load 'flipper/adapters/sequel.rb'
    end

    it 'configures itself' do
      expect(Flipper.adapter.adapter).to be_a(Flipper::Adapters::Sequel)
    end

    it "defines #flipper_id on Sequel::Model" do
      expect(Sequel::Model.ancestors).to include(Flipper::Identifier)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
flipper-sequel-1.0.0 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-1.0.0.pre spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.28.3 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.28.2 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.28.1 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.28.0 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.27.1 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.27.0 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.26.2 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.26.0 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.26.0.rc2 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.26.0.rc1 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.25.4 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.25.3 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.25.2 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.25.1 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.25.0 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.24.1 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.24.0 spec/flipper/adapters/sequel_spec.rb
flipper-sequel-0.23.1 spec/flipper/adapters/sequel_spec.rb