Skip to content

Commit e1ae8b5

Browse files
committed
Fix failed tests
1 parent 6d0245e commit e1ae8b5

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

lib/optimizely/config/datafile_project_config.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def initialize(datafile, logger, error_handler)
6868
@rollouts = config.fetch('rollouts', [])
6969
@send_flag_decisions = config.fetch('sendFlagDecisions', false)
7070
@integrations = config.fetch('integrations', [])
71+
@region = config.fetch('region', 'US')
72+
73+
# Default to US region if not specified
7174
@region = 'US' if @region.nil? || @region.empty?
7275

7376
# Json type is represented in datafile as a subtype of string for the sake of backwards compatibility.

spec/optimizely_user_context_spec.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@
224224
type: 'custom',
225225
value: true
226226
}]
227-
}]
227+
}],
228+
region: 'US'
228229
}
229230
stub_request(:post, impression_log_url)
230231
expect(forced_decision_project_instance.notification_center).to receive(:send_notifications)
@@ -323,7 +324,8 @@
323324
type: 'custom',
324325
value: true
325326
}]
326-
}]
327+
}],
328+
region: 'US'
327329
}
328330

329331
expect(forced_decision_project_instance.notification_center).to receive(:send_notifications)
@@ -442,7 +444,8 @@
442444
type: 'custom',
443445
value: true
444446
}]
445-
}]
447+
}],
448+
region: 'US'
446449
}
447450
stub_request(:post, impression_log_url)
448451
expect(forced_decision_project_instance.notification_center).to receive(:send_notifications)

spec/project_spec.rb

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ class InvalidErrorHandler; end # rubocop:disable Lint/ConstantDefinitionInBlock
274274
revision: '42',
275275
client_name: Optimizely::CLIENT_ENGINE,
276276
enrich_decisions: true,
277-
client_version: Optimizely::VERSION
277+
client_version: Optimizely::VERSION,
278+
region: 'US'
278279
}
279280
end
280281

@@ -393,7 +394,8 @@ class InvalidErrorHandler; end # rubocop:disable Lint/ConstantDefinitionInBlock
393394
revision: '3',
394395
client_name: Optimizely::CLIENT_ENGINE,
395396
enrich_decisions: true,
396-
client_version: Optimizely::VERSION
397+
client_version: Optimizely::VERSION,
398+
region: 'US'
397399
}
398400
end
399401

@@ -1079,7 +1081,8 @@ def callback(_args); end
10791081
revision: '42',
10801082
client_name: Optimizely::CLIENT_ENGINE,
10811083
enrich_decisions: true,
1082-
client_version: Optimizely::VERSION
1084+
client_version: Optimizely::VERSION,
1085+
region: 'US'
10831086
}
10841087
end
10851088

@@ -1251,7 +1254,8 @@ def callback(_args); end
12511254
revision: '3',
12521255
client_name: Optimizely::CLIENT_ENGINE,
12531256
enrich_decisions: true,
1254-
client_version: Optimizely::VERSION
1257+
client_version: Optimizely::VERSION,
1258+
region: 'US'
12551259
}
12561260
end
12571261
after(:example) do
@@ -1615,7 +1619,8 @@ def callback(_args); end
16151619
revision: '42',
16161620
client_name: Optimizely::CLIENT_ENGINE,
16171621
enrich_decisions: true,
1618-
client_version: Optimizely::VERSION
1622+
client_version: Optimizely::VERSION,
1623+
region: 'US'
16191624
}
16201625
end
16211626

@@ -3867,7 +3872,8 @@ def callback(_args); end
38673872
type: 'custom',
38683873
value: true
38693874
}]
3870-
}]
3875+
}],
3876+
region: 'US'
38713877
}
38723878
expect(project_instance.event_dispatcher).to have_received(:dispatch_event).with(Optimizely::Event.new(:post, impression_log_url, expected_params, post_headers))
38733879
end
@@ -4024,7 +4030,8 @@ def callback(_args); end
40244030
type: 'custom',
40254031
value: true
40264032
}]
4027-
}]
4033+
}],
4034+
region: 'US'
40284035
}
40294036
expect(project_instance.event_dispatcher).to have_received(:dispatch_event).with(Optimizely::Event.new(:post, impression_log_url, expected_params, post_headers))
40304037
end

0 commit comments

Comments
 (0)