2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Constraints::FeatureConstrainer do
|
2019-02-15 15:39:39 +05:30
|
|
|
describe '#matches' do
|
|
|
|
it 'calls Feature.enabled? with the correct arguments' do
|
2020-06-23 00:09:42 +05:30
|
|
|
gate = stub_feature_flag_gate("an object")
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(Feature).to receive(:enabled?)
|
|
|
|
.with(:feature_name, gate, default_enabled: true)
|
|
|
|
|
|
|
|
described_class.new(:feature_name, gate, default_enabled: true).matches?(double('request'))
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|