Sha256: 3bfd86ba455d37647c715d0ff037fe2da27739ad586718813065c019692fb8ac

Contents?: true

Size: 982 Bytes

Versions: 32

Compression:

Stored size: 982 Bytes

Contents

require 'spec_helper'

describe Cuboid::State::Options do

    subject { described_class.new }
    let(:dump_directory) do
        "#{Dir.tmpdir}/options-#{Cuboid::Utilities.generate_token}"
    end

    it { is_expected.to respond_to :clear}

    describe '#statistics' do
        let(:statistics) { subject.statistics }
    end

    describe '#dump' do
        it 'stores to disk' do
            Cuboid::Options.datastore.my_custom_option = 'my value'
            subject.dump( dump_directory )

            expect(Cuboid::Options.load( "#{dump_directory}/options" ).
                datastore.my_custom_option).to eq('my value')
        end
    end

    describe '.load' do
        it 'restores from disk' do
            Cuboid::Options.datastore.my_custom_option = 'my value'
            subject.dump( dump_directory )

            described_class.load( dump_directory )

            expect(Cuboid::Options.datastore.my_custom_option).to eq('my value')
        end
    end

end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
cuboid-0.1.5 spec/cuboid/state/options_spec.rb
cuboid-0.1.4 spec/cuboid/state/options_spec.rb
cuboid-0.1.3 spec/cuboid/state/options_spec.rb
cuboid-0.1.2 spec/cuboid/state/options_spec.rb
cuboid-0.1.1 spec/cuboid/state/options_spec.rb
cuboid-0.1.0 spec/cuboid/state/options_spec.rb
cuboid-0.0.5 spec/cuboid/state/options_spec.rb
cuboid-0.0.4 spec/cuboid/state/options_spec.rb
cuboid-0.0.3 spec/cuboid/state/options_spec.rb
cuboid-0.0.3alpha spec/cuboid/state/options_spec.rb
cuboid-0.0.2alpha spec/cuboid/state/options_spec.rb
cuboid-0.0.1alpha spec/cuboid/state/options_spec.rb