growthbook 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/growthbook/context.rb +7 -3
- data/lib/growthbook/inline_experiment_result.rb +7 -0
- data/spec/cases.json +105 -0
- data/spec/context_spec.rb +2 -0
- data/spec/json_spec.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28649218e25654a513fd965aeed205a4208341c265ea9e06d1b2f6efe9a4b1eb
|
4
|
+
data.tar.gz: 165ef4c260ec96a6c77b47acdfdd218039a7067156b0669d7b44adbf4c30382b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa1bd7678e81a58d64a51a4f9d035c76cb9ee75ae91584b17c6ff92338e543be58935da3542f77c6e3c6d1cc5fcf030eb804a09d547fd8533511474d6c638f4a
|
7
|
+
data.tar.gz: 9600cc883324faa2c7dcbbf4aa26e8469f0952057f3cf4b449c38cb59c0e6cd37eea246943f99750f3d54a1259fdebb622a14ec4b951a957cecf8bd924d107c0
|
data/lib/growthbook/context.rb
CHANGED
@@ -187,13 +187,17 @@ module Growthbook
|
|
187
187
|
Growthbook::Conditions.eval_condition(@attributes, condition)
|
188
188
|
end
|
189
189
|
|
190
|
-
def get_experiment_result(experiment, variation_index =
|
191
|
-
|
190
|
+
def get_experiment_result(experiment, variation_index = -1, hash_used = false)
|
191
|
+
in_experiment = true
|
192
|
+
if variation_index.negative? || variation_index >= experiment.variations.length
|
193
|
+
variation_index = 0
|
194
|
+
in_experiment = false
|
195
|
+
end
|
192
196
|
|
193
197
|
hash_attribute = experiment.hash_attribute || 'id'
|
194
198
|
hash_value = get_attribute(hash_attribute)
|
195
199
|
|
196
|
-
Growthbook::InlineExperimentResult.new(in_experiment, variation_index,
|
200
|
+
Growthbook::InlineExperimentResult.new(hash_used, in_experiment, variation_index,
|
197
201
|
experiment.variations[variation_index], hash_attribute, hash_value)
|
198
202
|
end
|
199
203
|
|
@@ -14,6 +14,10 @@ module Growthbook
|
|
14
14
|
# @return [Any]
|
15
15
|
attr_reader :value
|
16
16
|
|
17
|
+
# If the variation was randomly assigned based on user attribute hashes
|
18
|
+
# @return [Bool]
|
19
|
+
attr_reader :hash_used
|
20
|
+
|
17
21
|
# The attribute used to split traffic
|
18
22
|
# @return [String]
|
19
23
|
attr_reader :hash_attribute
|
@@ -23,6 +27,7 @@ module Growthbook
|
|
23
27
|
attr_reader :hash_value
|
24
28
|
|
25
29
|
def initialize(
|
30
|
+
hash_used,
|
26
31
|
in_experiment,
|
27
32
|
variation_id,
|
28
33
|
value,
|
@@ -30,6 +35,7 @@ module Growthbook
|
|
30
35
|
hash_value
|
31
36
|
)
|
32
37
|
|
38
|
+
@hash_used = hash_used
|
33
39
|
@in_experiment = in_experiment
|
34
40
|
@variation_id = variation_id
|
35
41
|
@value = value
|
@@ -40,6 +46,7 @@ module Growthbook
|
|
40
46
|
def to_json(*_args)
|
41
47
|
res = {}
|
42
48
|
res['inExperiment'] = @in_experiment
|
49
|
+
res['hashUsed'] = @hash_used
|
43
50
|
res['variationId'] = @variation_id
|
44
51
|
res['value'] = @value
|
45
52
|
res['hashAttribute'] = @hash_attribute
|
data/spec/cases.json
CHANGED
@@ -1707,6 +1707,7 @@
|
|
1707
1707
|
"value": "c",
|
1708
1708
|
"variationId": 2,
|
1709
1709
|
"inExperiment": true,
|
1710
|
+
"hashUsed": true,
|
1710
1711
|
"hashAttribute": "id",
|
1711
1712
|
"hashValue": "123"
|
1712
1713
|
},
|
@@ -1742,6 +1743,7 @@
|
|
1742
1743
|
"value": "a",
|
1743
1744
|
"variationId": 0,
|
1744
1745
|
"inExperiment": true,
|
1746
|
+
"hashUsed": true,
|
1745
1747
|
"hashAttribute": "id",
|
1746
1748
|
"hashValue": "456"
|
1747
1749
|
},
|
@@ -1777,6 +1779,7 @@
|
|
1777
1779
|
"value": "b",
|
1778
1780
|
"variationId": 1,
|
1779
1781
|
"inExperiment": true,
|
1782
|
+
"hashUsed": true,
|
1780
1783
|
"hashAttribute": "id",
|
1781
1784
|
"hashValue": "fds"
|
1782
1785
|
},
|
@@ -1824,6 +1827,7 @@
|
|
1824
1827
|
"value": false,
|
1825
1828
|
"variationId": 1,
|
1826
1829
|
"inExperiment": true,
|
1830
|
+
"hashUsed": true,
|
1827
1831
|
"hashAttribute": "anonId",
|
1828
1832
|
"hashValue": "123"
|
1829
1833
|
}
|
@@ -2011,6 +2015,47 @@
|
|
2011
2015
|
"off": false,
|
2012
2016
|
"source": "force"
|
2013
2017
|
}
|
2018
|
+
],
|
2019
|
+
[
|
2020
|
+
"include experiments when forced",
|
2021
|
+
{
|
2022
|
+
"attributes": { "id": "123" },
|
2023
|
+
"forcedVariations": {
|
2024
|
+
"feature": 1
|
2025
|
+
},
|
2026
|
+
"features": {
|
2027
|
+
"feature": {
|
2028
|
+
"defaultValue": 0,
|
2029
|
+
"rules": [
|
2030
|
+
{
|
2031
|
+
"variations": [0, 1, 2, 3]
|
2032
|
+
},
|
2033
|
+
{
|
2034
|
+
"force": 3
|
2035
|
+
}
|
2036
|
+
]
|
2037
|
+
}
|
2038
|
+
}
|
2039
|
+
},
|
2040
|
+
"feature",
|
2041
|
+
{
|
2042
|
+
"value": 1,
|
2043
|
+
"on": true,
|
2044
|
+
"off": false,
|
2045
|
+
"source": "experiment",
|
2046
|
+
"experiment": {
|
2047
|
+
"key": "feature",
|
2048
|
+
"variations": [0, 1, 2, 3]
|
2049
|
+
},
|
2050
|
+
"experimentResult": {
|
2051
|
+
"value": 1,
|
2052
|
+
"variationId": 1,
|
2053
|
+
"inExperiment": true,
|
2054
|
+
"hashUsed": false,
|
2055
|
+
"hashAttribute": "id",
|
2056
|
+
"hashValue": "123"
|
2057
|
+
}
|
2058
|
+
}
|
2014
2059
|
]
|
2015
2060
|
],
|
2016
2061
|
"run": [
|
@@ -2019,6 +2064,7 @@
|
|
2019
2064
|
{ "attributes": { "id": "1" } },
|
2020
2065
|
{ "key": "my-test", "variations": [0, 1] },
|
2021
2066
|
1,
|
2067
|
+
true,
|
2022
2068
|
true
|
2023
2069
|
],
|
2024
2070
|
[
|
@@ -2026,6 +2072,7 @@
|
|
2026
2072
|
{ "attributes": { "id": "2" } },
|
2027
2073
|
{ "key": "my-test", "variations": [0, 1] },
|
2028
2074
|
0,
|
2075
|
+
true,
|
2029
2076
|
true
|
2030
2077
|
],
|
2031
2078
|
[
|
@@ -2033,6 +2080,7 @@
|
|
2033
2080
|
{ "attributes": { "id": "3" } },
|
2034
2081
|
{ "key": "my-test", "variations": [0, 1] },
|
2035
2082
|
0,
|
2083
|
+
true,
|
2036
2084
|
true
|
2037
2085
|
],
|
2038
2086
|
[
|
@@ -2040,6 +2088,7 @@
|
|
2040
2088
|
{ "attributes": { "id": "4" } },
|
2041
2089
|
{ "key": "my-test", "variations": [0, 1] },
|
2042
2090
|
1,
|
2091
|
+
true,
|
2043
2092
|
true
|
2044
2093
|
],
|
2045
2094
|
[
|
@@ -2047,6 +2096,7 @@
|
|
2047
2096
|
{ "attributes": { "id": "5" } },
|
2048
2097
|
{ "key": "my-test", "variations": [0, 1] },
|
2049
2098
|
1,
|
2099
|
+
true,
|
2050
2100
|
true
|
2051
2101
|
],
|
2052
2102
|
[
|
@@ -2054,6 +2104,7 @@
|
|
2054
2104
|
{ "attributes": { "id": "6" } },
|
2055
2105
|
{ "key": "my-test", "variations": [0, 1] },
|
2056
2106
|
1,
|
2107
|
+
true,
|
2057
2108
|
true
|
2058
2109
|
],
|
2059
2110
|
[
|
@@ -2061,6 +2112,7 @@
|
|
2061
2112
|
{ "attributes": { "id": "7" } },
|
2062
2113
|
{ "key": "my-test", "variations": [0, 1] },
|
2063
2114
|
0,
|
2115
|
+
true,
|
2064
2116
|
true
|
2065
2117
|
],
|
2066
2118
|
[
|
@@ -2068,6 +2120,7 @@
|
|
2068
2120
|
{ "attributes": { "id": "8" } },
|
2069
2121
|
{ "key": "my-test", "variations": [0, 1] },
|
2070
2122
|
1,
|
2123
|
+
true,
|
2071
2124
|
true
|
2072
2125
|
],
|
2073
2126
|
[
|
@@ -2075,6 +2128,7 @@
|
|
2075
2128
|
{ "attributes": { "id": "9" } },
|
2076
2129
|
{ "key": "my-test", "variations": [0, 1] },
|
2077
2130
|
0,
|
2131
|
+
true,
|
2078
2132
|
true
|
2079
2133
|
],
|
2080
2134
|
[
|
@@ -2082,6 +2136,7 @@
|
|
2082
2136
|
{ "attributes": { "id": "1" } },
|
2083
2137
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2084
2138
|
1,
|
2139
|
+
true,
|
2085
2140
|
true
|
2086
2141
|
],
|
2087
2142
|
[
|
@@ -2089,6 +2144,7 @@
|
|
2089
2144
|
{ "attributes": { "id": "2" } },
|
2090
2145
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2091
2146
|
1,
|
2147
|
+
true,
|
2092
2148
|
true
|
2093
2149
|
],
|
2094
2150
|
[
|
@@ -2096,6 +2152,7 @@
|
|
2096
2152
|
{ "attributes": { "id": "3" } },
|
2097
2153
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2098
2154
|
0,
|
2155
|
+
true,
|
2099
2156
|
true
|
2100
2157
|
],
|
2101
2158
|
[
|
@@ -2103,6 +2160,7 @@
|
|
2103
2160
|
{ "attributes": { "id": "4" } },
|
2104
2161
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2105
2162
|
1,
|
2163
|
+
true,
|
2106
2164
|
true
|
2107
2165
|
],
|
2108
2166
|
[
|
@@ -2110,6 +2168,7 @@
|
|
2110
2168
|
{ "attributes": { "id": "5" } },
|
2111
2169
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2112
2170
|
1,
|
2171
|
+
true,
|
2113
2172
|
true
|
2114
2173
|
],
|
2115
2174
|
[
|
@@ -2117,6 +2176,7 @@
|
|
2117
2176
|
{ "attributes": { "id": "6" } },
|
2118
2177
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2119
2178
|
1,
|
2179
|
+
true,
|
2120
2180
|
true
|
2121
2181
|
],
|
2122
2182
|
[
|
@@ -2124,6 +2184,7 @@
|
|
2124
2184
|
{ "attributes": { "id": "7" } },
|
2125
2185
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2126
2186
|
0,
|
2187
|
+
true,
|
2127
2188
|
true
|
2128
2189
|
],
|
2129
2190
|
[
|
@@ -2131,6 +2192,7 @@
|
|
2131
2192
|
{ "attributes": { "id": "8" } },
|
2132
2193
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2133
2194
|
1,
|
2195
|
+
true,
|
2134
2196
|
true
|
2135
2197
|
],
|
2136
2198
|
[
|
@@ -2138,6 +2200,7 @@
|
|
2138
2200
|
{ "attributes": { "id": "9" } },
|
2139
2201
|
{ "key": "my-test", "variations": [0, 1], "weights": [0.1, 0.9] },
|
2140
2202
|
1,
|
2203
|
+
true,
|
2141
2204
|
true
|
2142
2205
|
],
|
2143
2206
|
[
|
@@ -2145,6 +2208,7 @@
|
|
2145
2208
|
{ "attributes": { "id": "1" } },
|
2146
2209
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2147
2210
|
0,
|
2211
|
+
false,
|
2148
2212
|
false
|
2149
2213
|
],
|
2150
2214
|
[
|
@@ -2152,6 +2216,7 @@
|
|
2152
2216
|
{ "attributes": { "id": "2" } },
|
2153
2217
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2154
2218
|
0,
|
2219
|
+
true,
|
2155
2220
|
true
|
2156
2221
|
],
|
2157
2222
|
[
|
@@ -2159,6 +2224,7 @@
|
|
2159
2224
|
{ "attributes": { "id": "3" } },
|
2160
2225
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2161
2226
|
0,
|
2227
|
+
true,
|
2162
2228
|
true
|
2163
2229
|
],
|
2164
2230
|
[
|
@@ -2166,6 +2232,7 @@
|
|
2166
2232
|
{ "attributes": { "id": "4" } },
|
2167
2233
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2168
2234
|
0,
|
2235
|
+
false,
|
2169
2236
|
false
|
2170
2237
|
],
|
2171
2238
|
[
|
@@ -2173,6 +2240,7 @@
|
|
2173
2240
|
{ "attributes": { "id": "5" } },
|
2174
2241
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2175
2242
|
1,
|
2243
|
+
true,
|
2176
2244
|
true
|
2177
2245
|
],
|
2178
2246
|
[
|
@@ -2180,6 +2248,7 @@
|
|
2180
2248
|
{ "attributes": { "id": "6" } },
|
2181
2249
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2182
2250
|
0,
|
2251
|
+
false,
|
2183
2252
|
false
|
2184
2253
|
],
|
2185
2254
|
[
|
@@ -2187,6 +2256,7 @@
|
|
2187
2256
|
{ "attributes": { "id": "7" } },
|
2188
2257
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2189
2258
|
0,
|
2259
|
+
true,
|
2190
2260
|
true
|
2191
2261
|
],
|
2192
2262
|
[
|
@@ -2194,6 +2264,7 @@
|
|
2194
2264
|
{ "attributes": { "id": "8" } },
|
2195
2265
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2196
2266
|
1,
|
2267
|
+
true,
|
2197
2268
|
true
|
2198
2269
|
],
|
2199
2270
|
[
|
@@ -2201,6 +2272,7 @@
|
|
2201
2272
|
{ "attributes": { "id": "9" } },
|
2202
2273
|
{ "key": "my-test", "variations": [0, 1], "coverage": 0.4 },
|
2203
2274
|
0,
|
2275
|
+
false,
|
2204
2276
|
false
|
2205
2277
|
],
|
2206
2278
|
[
|
@@ -2208,6 +2280,7 @@
|
|
2208
2280
|
{ "attributes": { "id": "1" } },
|
2209
2281
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2210
2282
|
2,
|
2283
|
+
true,
|
2211
2284
|
true
|
2212
2285
|
],
|
2213
2286
|
[
|
@@ -2215,6 +2288,7 @@
|
|
2215
2288
|
{ "attributes": { "id": "2" } },
|
2216
2289
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2217
2290
|
0,
|
2291
|
+
true,
|
2218
2292
|
true
|
2219
2293
|
],
|
2220
2294
|
[
|
@@ -2222,6 +2296,7 @@
|
|
2222
2296
|
{ "attributes": { "id": "3" } },
|
2223
2297
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2224
2298
|
0,
|
2299
|
+
true,
|
2225
2300
|
true
|
2226
2301
|
],
|
2227
2302
|
[
|
@@ -2229,6 +2304,7 @@
|
|
2229
2304
|
{ "attributes": { "id": "4" } },
|
2230
2305
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2231
2306
|
2,
|
2307
|
+
true,
|
2232
2308
|
true
|
2233
2309
|
],
|
2234
2310
|
[
|
@@ -2236,6 +2312,7 @@
|
|
2236
2312
|
{ "attributes": { "id": "5" } },
|
2237
2313
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2238
2314
|
1,
|
2315
|
+
true,
|
2239
2316
|
true
|
2240
2317
|
],
|
2241
2318
|
[
|
@@ -2243,6 +2320,7 @@
|
|
2243
2320
|
{ "attributes": { "id": "6" } },
|
2244
2321
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2245
2322
|
2,
|
2323
|
+
true,
|
2246
2324
|
true
|
2247
2325
|
],
|
2248
2326
|
[
|
@@ -2250,6 +2328,7 @@
|
|
2250
2328
|
{ "attributes": { "id": "7" } },
|
2251
2329
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2252
2330
|
0,
|
2331
|
+
true,
|
2253
2332
|
true
|
2254
2333
|
],
|
2255
2334
|
[
|
@@ -2257,6 +2336,7 @@
|
|
2257
2336
|
{ "attributes": { "id": "8" } },
|
2258
2337
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2259
2338
|
1,
|
2339
|
+
true,
|
2260
2340
|
true
|
2261
2341
|
],
|
2262
2342
|
[
|
@@ -2264,6 +2344,7 @@
|
|
2264
2344
|
{ "attributes": { "id": "9" } },
|
2265
2345
|
{ "key": "my-test", "variations": [0, 1, 2] },
|
2266
2346
|
0,
|
2347
|
+
true,
|
2267
2348
|
true
|
2268
2349
|
],
|
2269
2350
|
[
|
@@ -2271,6 +2352,7 @@
|
|
2271
2352
|
{ "attributes": { "id": "1" } },
|
2272
2353
|
{ "key": "my-test", "variations": [0, 1] },
|
2273
2354
|
1,
|
2355
|
+
true,
|
2274
2356
|
true
|
2275
2357
|
],
|
2276
2358
|
[
|
@@ -2278,6 +2360,7 @@
|
|
2278
2360
|
{ "attributes": { "id": "1" } },
|
2279
2361
|
{ "key": "my-test-3", "variations": [0, 1] },
|
2280
2362
|
0,
|
2363
|
+
true,
|
2281
2364
|
true
|
2282
2365
|
],
|
2283
2366
|
[
|
@@ -2285,6 +2368,7 @@
|
|
2285
2368
|
{ "attributes": { "id": "" } },
|
2286
2369
|
{ "key": "my-test", "variations": [0, 1] },
|
2287
2370
|
0,
|
2371
|
+
false,
|
2288
2372
|
false
|
2289
2373
|
],
|
2290
2374
|
[
|
@@ -2292,6 +2376,7 @@
|
|
2292
2376
|
{ "attributes": {} },
|
2293
2377
|
{ "key": "my-test", "variations": [0, 1] },
|
2294
2378
|
0,
|
2379
|
+
false,
|
2295
2380
|
false
|
2296
2381
|
],
|
2297
2382
|
[
|
@@ -2299,6 +2384,7 @@
|
|
2299
2384
|
{},
|
2300
2385
|
{ "key": "my-test", "variations": [0, 1] },
|
2301
2386
|
0,
|
2387
|
+
false,
|
2302
2388
|
false
|
2303
2389
|
],
|
2304
2390
|
[
|
@@ -2306,6 +2392,7 @@
|
|
2306
2392
|
{ "attributes": { "id": "1" } },
|
2307
2393
|
{ "key": "my-test", "variations": [0] },
|
2308
2394
|
0,
|
2395
|
+
false,
|
2309
2396
|
false
|
2310
2397
|
],
|
2311
2398
|
[
|
@@ -2313,6 +2400,7 @@
|
|
2313
2400
|
{ "attributes": { "id": "1" } },
|
2314
2401
|
{ "key": "my-test", "variations": [0, 1], "force": -8 },
|
2315
2402
|
0,
|
2403
|
+
false,
|
2316
2404
|
false
|
2317
2405
|
],
|
2318
2406
|
[
|
@@ -2320,6 +2408,7 @@
|
|
2320
2408
|
{ "attributes": { "id": "1" } },
|
2321
2409
|
{ "key": "my-test", "variations": [0, 1], "force": 25 },
|
2322
2410
|
0,
|
2411
|
+
false,
|
2323
2412
|
false
|
2324
2413
|
],
|
2325
2414
|
[
|
@@ -2338,6 +2427,7 @@
|
|
2338
2427
|
}
|
2339
2428
|
},
|
2340
2429
|
1,
|
2430
|
+
true,
|
2341
2431
|
true
|
2342
2432
|
],
|
2343
2433
|
[
|
@@ -2356,6 +2446,7 @@
|
|
2356
2446
|
}
|
2357
2447
|
},
|
2358
2448
|
0,
|
2449
|
+
false,
|
2359
2450
|
false
|
2360
2451
|
],
|
2361
2452
|
[
|
@@ -2372,6 +2463,7 @@
|
|
2372
2463
|
"hashAttribute": "companyId"
|
2373
2464
|
},
|
2374
2465
|
1,
|
2466
|
+
true,
|
2375
2467
|
true
|
2376
2468
|
],
|
2377
2469
|
[
|
@@ -2387,6 +2479,7 @@
|
|
2387
2479
|
"variations": [0, 1]
|
2388
2480
|
},
|
2389
2481
|
0,
|
2482
|
+
false,
|
2390
2483
|
false
|
2391
2484
|
],
|
2392
2485
|
[
|
@@ -2402,6 +2495,7 @@
|
|
2402
2495
|
"variations": [0, 1]
|
2403
2496
|
},
|
2404
2497
|
1,
|
2498
|
+
true,
|
2405
2499
|
false
|
2406
2500
|
],
|
2407
2501
|
[
|
@@ -2417,6 +2511,7 @@
|
|
2417
2511
|
"variations": [0, 1]
|
2418
2512
|
},
|
2419
2513
|
1,
|
2514
|
+
true,
|
2420
2515
|
true
|
2421
2516
|
],
|
2422
2517
|
[
|
@@ -2432,6 +2527,7 @@
|
|
2432
2527
|
"variations": [0, 1]
|
2433
2528
|
},
|
2434
2529
|
0,
|
2530
|
+
false,
|
2435
2531
|
false
|
2436
2532
|
],
|
2437
2533
|
[
|
@@ -2448,6 +2544,7 @@
|
|
2448
2544
|
"variations": [0, 1]
|
2449
2545
|
},
|
2450
2546
|
1,
|
2547
|
+
true,
|
2451
2548
|
false
|
2452
2549
|
],
|
2453
2550
|
[
|
@@ -2464,6 +2561,7 @@
|
|
2464
2561
|
"variations": [0, 1]
|
2465
2562
|
},
|
2466
2563
|
0,
|
2564
|
+
false,
|
2467
2565
|
false
|
2468
2566
|
],
|
2469
2567
|
[
|
@@ -2490,6 +2588,7 @@
|
|
2490
2588
|
"color": "green",
|
2491
2589
|
"size": "large"
|
2492
2590
|
},
|
2591
|
+
true,
|
2493
2592
|
true
|
2494
2593
|
],
|
2495
2594
|
[
|
@@ -2503,6 +2602,7 @@
|
|
2503
2602
|
"variations": [0, 1]
|
2504
2603
|
},
|
2505
2604
|
0,
|
2605
|
+
true,
|
2506
2606
|
false
|
2507
2607
|
],
|
2508
2608
|
[
|
@@ -2516,6 +2616,7 @@
|
|
2516
2616
|
"variations": [0, 1]
|
2517
2617
|
},
|
2518
2618
|
0,
|
2619
|
+
false,
|
2519
2620
|
false
|
2520
2621
|
],
|
2521
2622
|
[
|
@@ -2530,6 +2631,7 @@
|
|
2530
2631
|
"variations": [0, 1]
|
2531
2632
|
},
|
2532
2633
|
1,
|
2634
|
+
true,
|
2533
2635
|
false
|
2534
2636
|
],
|
2535
2637
|
[
|
@@ -2544,6 +2646,7 @@
|
|
2544
2646
|
"force": 1
|
2545
2647
|
},
|
2546
2648
|
1,
|
2649
|
+
true,
|
2547
2650
|
false
|
2548
2651
|
],
|
2549
2652
|
[
|
@@ -2559,6 +2662,7 @@
|
|
2559
2662
|
"namespace": ["namespace", 0.1, 1]
|
2560
2663
|
},
|
2561
2664
|
1,
|
2665
|
+
true,
|
2562
2666
|
true
|
2563
2667
|
],
|
2564
2668
|
[
|
@@ -2574,6 +2678,7 @@
|
|
2574
2678
|
"namespace": ["namespace", 0, 0.1]
|
2575
2679
|
},
|
2576
2680
|
0,
|
2681
|
+
false,
|
2577
2682
|
false
|
2578
2683
|
]
|
2579
2684
|
],
|
data/spec/context_spec.rb
CHANGED
@@ -98,6 +98,7 @@ describe 'context' do
|
|
98
98
|
"hashAttribute" => "id",
|
99
99
|
"hashValue" => "123",
|
100
100
|
"inExperiment" => true,
|
101
|
+
"hashUsed" => true,
|
101
102
|
"value" => 2,
|
102
103
|
"variationId" => 0,
|
103
104
|
})
|
@@ -111,6 +112,7 @@ describe 'context' do
|
|
111
112
|
"hashAttribute" => "id",
|
112
113
|
"hashValue" => "123",
|
113
114
|
"inExperiment" => true,
|
115
|
+
"hashUsed" => true,
|
114
116
|
"value" => 2,
|
115
117
|
"variationId" => 0,
|
116
118
|
}
|
data/spec/json_spec.rb
CHANGED
@@ -144,7 +144,7 @@ describe 'test suite' do
|
|
144
144
|
# Loop through each test case in the JSON file
|
145
145
|
test_cases['run'].each do |test_case|
|
146
146
|
# Extract data about the test case
|
147
|
-
test_name, context, experiment, value, in_experiment = test_case
|
147
|
+
test_name, context, experiment, value, in_experiment, hash_used = test_case
|
148
148
|
|
149
149
|
# Run the actual test case
|
150
150
|
it test_name do
|
@@ -153,6 +153,7 @@ describe 'test suite' do
|
|
153
153
|
result = gb.run(exp)
|
154
154
|
expect(result.value).to eq(value)
|
155
155
|
expect(result.in_experiment).to eq(in_experiment)
|
156
|
+
expect(result.hash_used).to eq(hash_used)
|
156
157
|
end
|
157
158
|
end
|
158
159
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: growthbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GrowthBook
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|