Sha256: 37076b0547ca786eda24e31d8cfb9f735bdf57f2c875f1b4b89990f31cc5fd48
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' RSpec.describe OptimizelyServerSide::DatafileFetcher do describe '#fetch' do context 'when 200 response' do before do stub_request(:get, "https://cdn.optimizely.com/json/5960232316.json") .to_return(body: '{"experiments": [{"status": "running"}]}',status: 200) end it 'should fetch the config' do expect(described_class.fetch.content).to eq('{"experiments": [{"status": "running"}]}') end it 'should return stringified datafile' do expect(described_class.datafile.content).to eq('{"experiments": [{"status": "running"}]}') end end context 'when 500 response' do before do stub_request(:get, "https://cdn.optimizely.com/json/5960232316.json") .to_return(body: '{"experiments": [{"status": "running"}]}',status: 500) end it 'should fetch the config' do expect(described_class.fetch.content).to eq('{"experiments": [],"version": "2","audiences": [],"attributes": [],"groups": [],"projectId": "5960232316","accountId": "5955320306","events": [],"revision": "30"}') end it 'should return stringified datafile' do expect(described_class.datafile.content).to eq('{"experiments": [],"version": "2","audiences": [],"attributes": [],"groups": [],"projectId": "5960232316","accountId": "5955320306","events": [],"revision": "30"}') end end end end
Version data entries
4 entries across 4 versions & 1 rubygems