Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ build-iPhoneSimulator/

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*

.DS_Store
Binary file removed providers/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ def fetch_from_sources(default_value:, &blk)
successful_details = providers.each do |provider|
details = yield(provider)

details = SDK::Provider::ResolutionDetails.new(
value: details.value,
reason: details.reason,
variant: details.variant,
error_code: details.error_code,
error_message: details.error_message,
flag_metadata: (details.flag_metadata || {}).merge("matched_provider" => provider.metadata.name)
)

break details if details.error_code.nil?
rescue
next
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,31 @@
let(:flag_key) { "first_match_#{type}" }

it "returns from first" do
expected_result = OpenFeature::SDK::Provider::ResolutionDetails.new(
value: first_matched_value,
reason: OpenFeature::SDK::Provider::Reason::STATIC,
flag_metadata: {"matched_provider" => "In-memory Provider"}
)

result = meta_provider.send(:"fetch_#{type}_value", flag_key:, default_value:)

expect(result).to eq(OpenFeature::SDK::Provider::ResolutionDetails.new(value: first_matched_value, reason: OpenFeature::SDK::Provider::Reason::STATIC))
expect(result).to eq(expected_result)
end
end

context "and second provider matches" do
let(:flag_key) { "second_match_#{type}" }

it "returns from second" do
expected_result = OpenFeature::SDK::Provider::ResolutionDetails.new(
value: second_matched_value,
reason: OpenFeature::SDK::Provider::Reason::STATIC,
flag_metadata: {"matched_provider" => "In-memory Provider"}
)

result = meta_provider.send(:"fetch_#{type}_value", flag_key:, default_value:)

expect(result).to eq(OpenFeature::SDK::Provider::ResolutionDetails.new(value: second_matched_value, reason: OpenFeature::SDK::Provider::Reason::STATIC))
expect(result).to eq(expected_result)
end
end

Expand Down