BigW Consortium Gitlab

feature_spec.rb 623 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe Feature do
4 5 6 7 8
  describe '.get' do
    let(:feature) { double(:feature) }
    let(:key) { 'my_feature' }

    it 'returns the Flipper feature' do
9 10
      expect_any_instance_of(Flipper::DSL).to receive(:feature).with(key)
        .and_return(feature)
11 12 13 14 15 16 17 18 19

      expect(described_class.get(key)).to be(feature)
    end
  end

  describe '.all' do
    let(:features) { Set.new }

    it 'returns the Flipper features as an array' do
20 21
      expect_any_instance_of(Flipper::DSL).to receive(:features)
        .and_return(features)
22 23 24 25 26

      expect(described_class.all).to eq(features.to_a)
    end
  end
end