Sha256: d8ea550aaffc9c4a93c5782a239ad7770076aa92365ac5dfd0c86604e0dec58f

Contents?: true

Size: 1.34 KB

Versions: 34

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe Cuboid::Data do

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

    describe '#application' do
        it "returns an instance of #{described_class::Application}" do
            expect(subject.application).to be_kind_of described_class::Application
        end
    end

    describe '#statistics' do
        %w(application).each do |name|
            it "includes :#{name} statistics" do
                expect(subject.statistics[name.to_sym]).to eq(subject.send(name).statistics)
            end
        end
    end

    describe '.dump' do
        %w(application).each do |name|
            it "stores ##{name} to disk" do
                previous_instance = subject.send(name)

                subject.dump( dump_directory )

                new_instance = subject.load( dump_directory ).send(name)

                expect(new_instance).to be_kind_of subject.send(name).class
                expect(new_instance.object_id).not_to eq(previous_instance.object_id)
            end
        end
    end

    describe '#clear' do
        %w(application).each do |method|
            it "clears ##{method}" do
                expect(subject.send(method)).to receive(:clear).at_least(:once)
                subject.clear
            end
        end
    end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
cuboid-0.2.13 spec/cuboid/data_spec.rb
cuboid-0.2.12 spec/cuboid/data_spec.rb
cuboid-0.2.11 spec/cuboid/data_spec.rb
cuboid-0.2.10 spec/cuboid/data_spec.rb
cuboid-0.2.9 spec/cuboid/data_spec.rb
cuboid-0.2.8 spec/cuboid/data_spec.rb
cuboid-0.2.7 spec/cuboid/data_spec.rb
cuboid-0.2.6 spec/cuboid/data_spec.rb
cuboid-0.2.5 spec/cuboid/data_spec.rb
cuboid-0.2.4.2 spec/cuboid/data_spec.rb
cuboid-0.2.4.1 spec/cuboid/data_spec.rb
cuboid-0.2.4 spec/cuboid/data_spec.rb
cuboid-0.2.3 spec/cuboid/data_spec.rb
cuboid-0.2.2 spec/cuboid/data_spec.rb
cuboid-0.2.1 spec/cuboid/data_spec.rb
cuboid-0.2 spec/cuboid/data_spec.rb
cuboid-0.1.9.1 spec/cuboid/data_spec.rb
cuboid-0.1.9 spec/cuboid/data_spec.rb
cuboid-0.1.8 spec/cuboid/data_spec.rb
cuboid-0.1.7 spec/cuboid/data_spec.rb