File tree Expand file tree Collapse file tree 6 files changed +16
-16
lines changed Expand file tree Collapse file tree 6 files changed +16
-16
lines changed Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- flagsmith (3.0.1 )
4+ flagsmith (3.0.2 )
55 faraday
66 faraday-retry
77 faraday_middleware
4040 faraday (~> 1.0 )
4141 gem-release (2.2.0 )
4242 method_source (1.0.0 )
43- multipart-post (2.2.0 )
43+ multipart-post (2.2.3 )
4444 parallel (1.20.1 )
4545 parser (3.0.0.0 )
4646 ast (~> 2.4.1 )
5050 rainbow (3.0.0 )
5151 rake (13.0.3 )
5252 regexp_parser (2.0.3 )
53- rexml (3.2.4 )
53+ rexml (3.2.5 )
5454 rspec (3.10.0 )
5555 rspec-core (~> 3.10.0 )
5656 rspec-expectations (~> 3.10.0 )
Original file line number Diff line number Diff line change 172172 public_suffix (4.0.7 )
173173 puma (5.6.4 )
174174 nio4r (~> 2.0 )
175- rack (2.2.3 )
175+ rack (2.2.3.1 )
176176 rack-test (1.1.0 )
177177 rack (>= 1.0 , < 3 )
178178 rainbow (3.1.1 )
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ def flush
3131 @last_flushed = Time . now
3232 end
3333
34- def track_feature ( feature_id )
35- @analytics_data [ feature_id ] = @analytics_data . fetch ( feature_id , 0 ) + 1
34+ def track_feature ( feature_name )
35+ @analytics_data [ feature_name ] = @analytics_data . fetch ( feature_name , 0 ) + 1
3636 flush if ( Time . now - @last_flushed ) > TIMER * 1000
3737 end
3838 end
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ def feature_value(feature_name)
122122 def get_flag ( feature_name )
123123 key = Flagsmith ::Flags ::Collection . normalize_key ( feature_name )
124124 flag = flags . fetch ( key )
125- @analytics_processor . track_feature ( flag . feature_id ) if @analytics_processor && flag . feature_id
125+ @analytics_processor . track_feature ( flag . feature_name ) if @analytics_processor && flag . feature_id
126126 flag
127127 rescue KeyError
128128 return @default_flag_handler . call ( feature_name ) if @default_flag_handler
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module Flagsmith
4- VERSION = '3.0.1 '
4+ VERSION = '3.0.2 '
55end
Original file line number Diff line number Diff line change 1919 end
2020
2121 it 'test_analytics_processor_track_feature_updates_analytics_data' do
22- subject . track_feature ( 1 )
23- expect ( subject . analytics_data [ 1 ] ) . to eq ( 1 )
22+ subject . track_feature ( "my_feature" )
23+ expect ( subject . analytics_data [ "my_feature" ] ) . to eq ( 1 )
2424
25- subject . track_feature ( 1 )
26- expect ( subject . analytics_data [ 1 ] ) . to eq ( 2 )
25+ subject . track_feature ( "my_feature" )
26+ expect ( subject . analytics_data [ "my_feature" ] ) . to eq ( 2 )
2727 end
2828
2929 it 'test_analytics_processor_flush_clears_analytics_data' do
30- subject . track_feature ( 1 )
30+ subject . track_feature ( "my_feature" )
3131 subject . flush
3232 expect ( subject . analytics_data ) . to eql ( { } )
3333 end
3434
3535 it 'test_analytics_processor_flush_post_request_data_match_ananlytics_data' do
36- subject . track_feature ( 1 )
37- subject . track_feature ( 2 )
36+ subject . track_feature ( "my_feature_1" )
37+ subject . track_feature ( "my_feature_2" )
3838 expect ( flagsmith . api_client ) . to receive ( :post ) . exactly ( 1 ) . times do |uri_path , body |
3939 expect ( uri_path ) . to eq ( 'analytics/flags/' )
40- expect ( body ) . to eq ( { 1 => 1 , 2 => 1 } . to_json )
40+ expect ( body ) . to eq ( { "my_feature_1" => 1 , "my_feature_2" => 1 } . to_json )
4141 end
4242 subject . flush
4343 end
You can’t perform that action at this time.
0 commit comments