@@ -49,6 +49,46 @@ def event_processor
49
49
client . instance_variable_get ( :@event_processor )
50
50
end
51
51
52
+ describe "constructor requirement of non-nil sdk key" do
53
+ it "is not enforced when offline" do
54
+ subject . new ( nil , offline_config )
55
+ end
56
+
57
+ it "is not enforced if use_ldd is true and send_events is false" do
58
+ subject . new ( nil , LaunchDarkly ::Config . new ( { use_ldd : true , send_events : false } ) )
59
+ end
60
+
61
+ it "is not enforced if using file data and send_events is false" do
62
+ source = LaunchDarkly ::FileDataSource . factory ( { } )
63
+ subject . new ( nil , LaunchDarkly ::Config . new ( { data_source : source , send_events : false } ) )
64
+ end
65
+
66
+ it "is enforced in streaming mode even if send_events is false" do
67
+ expect {
68
+ subject . new ( nil , LaunchDarkly ::Config . new ( { send_events : false } ) )
69
+ } . to raise_error ( ArgumentError )
70
+ end
71
+
72
+ it "is enforced in polling mode even if send_events is false" do
73
+ expect {
74
+ subject . new ( nil , LaunchDarkly ::Config . new ( { stream : false , send_events : false } ) )
75
+ } . to raise_error ( ArgumentError )
76
+ end
77
+
78
+ it "is enforced if use_ldd is true and send_events is true" do
79
+ expect {
80
+ subject . new ( nil , LaunchDarkly ::Config . new ( { use_ldd : true } ) )
81
+ } . to raise_error ( ArgumentError )
82
+ end
83
+
84
+ it "is enforced if using file data and send_events is true" do
85
+ source = LaunchDarkly ::FileDataSource . factory ( { } )
86
+ expect {
87
+ subject . new ( nil , LaunchDarkly ::Config . new ( { data_source : source } ) )
88
+ } . to raise_error ( ArgumentError )
89
+ end
90
+ end
91
+
52
92
describe '#variation' do
53
93
feature_with_value = { key : "key" , on : false , offVariation : 0 , variations : [ "value" ] , version : 100 ,
54
94
trackEvents : true , debugEventsUntilDate : 1000 }
0 commit comments