Sha256: 2bb5a9499368a4f819a1401d51fcc777e41372c312f46f94a59643f0b8f94afb

Contents?: true

Size: 1.4 KB

Versions: 20

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

RSpec.describe OptimizelyServerSide::Variation do

  describe '#primary' do

    context 'when no primary is passed' do

      subject { described_class.new }

      it 'defaults to false' do
        expect(subject.primary).to be(false)
      end

    end

    context 'when primary is passed' do

      subject { described_class.new(primary: true) }

      it 'is as per passed' do
        expect(subject.primary).to be(true)
      end

    end
  end


  describe '#content' do

    context 'when no content is passed' do

      subject { described_class.new }

      it 'defaults to nil' do
        expect(subject.instance_variable_get(:@content)).to be_nil
      end

    end

    context 'when content is passed' do

      let(:some_proc) { Proc.new { |n| "Hello #{n} world!"} }

      subject { described_class.new(content: some_proc) }

      it 'is as per passed' do
        expect(subject.instance_variable_get(:@content)).to be(some_proc)
      end

    end
  end

  describe '#key' do

    context 'when no key is passed' do

      subject { described_class.new }

      it 'defaults to nil' do
        expect(subject.instance_variable_get(:@key)).to be_nil
      end
    end

    context 'when key is passed' do


      subject { described_class.new(key: 'ankit_test') }

      it 'is as per passed' do
        expect(subject.instance_variable_get(:@key)).to eq('ankit_test')
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
optimizely_server_side-2.0.1 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-2.0.0 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-1.2.2 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-1.2.1 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-1.2.0 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-1.0.1 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-1.0.0 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.18 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.17 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.16 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.15 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.14 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.13 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.12 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.11 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.10 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.9 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.8 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.7 spec/optimizely_server_side/variation_spec.rb
optimizely_server_side-0.0.6 spec/optimizely_server_side/variation_spec.rb