Skip to content

Commit

Permalink
FFM-8670: Feature flag rule not being evaluated for a given attribute
Browse files Browse the repository at this point in the history
* Fix evaluation issue where a boolean is returned instead of a value
* Include test case
  • Loading branch information
ribeirophillipe committed Jul 19, 2023
1 parent 64dabb8 commit e5aa9ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ff/ruby/server/sdk/api/evaluator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def get_attr_value(target, attribute)
return target.send(attribute)
else

result = target.attributes.key?(attribute)
result = target.attributes[attribute.to_sym]

if result == nil

Expand Down
21 changes: 21 additions & 0 deletions test/ff/ruby/server/sdk/evaluator_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# File: evaluator.rb
# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path("../lib", __dir__)

require "securerandom"
require "minitest/autorun"
require "test_helper"

require "ff/ruby/server/sdk"
require "test/unit"

class TestEvaluator < ActiveSupport::TestCase

test '#get_attr_value' do
mock = Minitest::Mock.new
mock.expect :apply, true

assert_mock mock
end
end

0 comments on commit e5aa9ba

Please sign in to comment.