2019-07-25 01:21:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-14 08:27:26 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe Constraints::FeatureConstrainer do
|
2018-12-14 08:27:26 -05:00
|
|
|
describe '#matches' do
|
|
|
|
it 'calls Feature.enabled? with the correct arguments' do
|
2020-05-29 14:08:26 -04:00
|
|
|
gate = stub_feature_flag_gate("an object")
|
2018-12-14 08:27:26 -05:00
|
|
|
|
2020-05-29 14:08:26 -04:00
|
|
|
expect(Feature).to receive(:enabled?)
|
|
|
|
.with(:feature_name, gate, default_enabled: true)
|
|
|
|
|
|
|
|
described_class.new(:feature_name, gate, default_enabled: true).matches?(double('request'))
|
2018-12-14 08:27:26 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|