diff --git a/lib/ldclient-rb/integrations/test_data_v2/flag_builder_v2.rb b/lib/ldclient-rb/integrations/test_data_v2/flag_builder_v2.rb index 26919a54..a5c980f9 100644 --- a/lib/ldclient-rb/integrations/test_data_v2/flag_builder_v2.rb +++ b/lib/ldclient-rb/integrations/test_data_v2/flag_builder_v2.rb @@ -179,7 +179,7 @@ def variation_for_all(variation) # @return [FlagBuilderV2] the flag builder # def value_for_all(value) - variations(value).variation_for_all(0) + variations(value).variation_for_all(0).off_variation(0) end # diff --git a/spec/integrations/test_data_v2_spec.rb b/spec/integrations/test_data_v2_spec.rb index d157df40..54f74919 100644 --- a/spec/integrations/test_data_v2_spec.rb +++ b/spec/integrations/test_data_v2_spec.rb @@ -51,6 +51,17 @@ module Integrations expect(init_data[:segments][:mysegment][:included]).to eq(['user2']) end + it 'returns the value_for_all value whether targeting is on or off' do + td = TestDataV2.data_source + flag = td.flag('myflag').value_for_all('x').build(1) + expect(flag[:variations]).to eq(['x']) + expect(flag[:fallthrough]).to eq({ variation: 0 }) + expect(flag[:offVariation]).to eq(0) + + off_flag = td.flag('myflag').value_for_all('x').on(false).build(1) + expect(off_flag[:offVariation]).to eq(0) + end + describe 'TestDataSourceV2' do it 'includes both flags and segments in fetch' do td = TestDataV2.data_source