|
927 | 927 | "Variation mapped to experiment '#{@valid_experiment[:key]}' has been removed for user '#{@user_id}'.")
|
928 | 928 | end
|
929 | 929 | # Variation key is an empty string
|
930 |
| - it 'should delete forced varaition maping, log a message and return true when variation_key is passed as empty string' do |
931 |
| - expect(config.set_forced_variation(@valid_experiment[:key], @user_id, '')).to eq(true) |
| 930 | + it 'should persist forced variation mapping, log a message and return false when variation_key is passed as empty string' do |
| 931 | + expect(config.set_forced_variation(@valid_experiment[:key], @user_id, '')).to eq(false) |
932 | 932 | expect(spy_logger).to have_received(:log).with(Logger::DEBUG,
|
933 |
| - "Variation mapped to experiment '#{@valid_experiment[:key]}' has been removed for user '#{@user_id}'.") |
| 933 | + 'Variation key is invalid') |
| 934 | + expect(config.get_forced_variation(@valid_experiment[:key], @user_id)).to eq(nil) |
934 | 935 | end
|
935 | 936 | # Variation key does not exist in the datafile
|
936 | 937 | it 'return false when variation_key is not in datafile' do
|
|
958 | 959 | expect(Optimizely::Helpers::Validator).to receive(:inputs_valid?).with(
|
959 | 960 | {
|
960 | 961 | user_id: @user_id,
|
961 |
| - experiment_key: @valid_experiment[:key] |
| 962 | + experiment_key: @valid_experiment[:key], |
| 963 | + variation_key: @valid_variation[:key] |
962 | 964 | }, spy_logger, Logger::DEBUG
|
963 | 965 | )
|
964 | 966 | config.set_forced_variation(@valid_experiment[:key], @user_id, @valid_variation[:key])
|
|
985 | 987 | variation = config.get_forced_variation(@valid_experiment[:key], @user_id)
|
986 | 988 | expect(variation['id']).to eq(@valid_variation_2[:id])
|
987 | 989 | expect(variation['key']).to eq(@valid_variation_2[:key])
|
988 |
| - |
989 |
| - expect(config.set_forced_variation(@valid_experiment[:key], @user_id, '')).to eq(true) |
990 |
| - expect(config.get_forced_variation(@valid_experiment[:key], @user_id)).to eq(nil) |
991 | 990 | end
|
992 | 991 |
|
993 | 992 | # Set variation on multiple experiments for one user.
|
|
0 commit comments