Sha256: 58658215fe20da47547a7d30a48b119b76c7050bdc0e7e41f26a5fbd683721ee

Contents?: true

Size: 1017 Bytes

Versions: 16

Compression:

Stored size: 1017 Bytes

Contents

module Adhoq
  RSpec.describe GlobalVariable, type: :model do
    def reset_storage_config(*storage_config)
      Adhoq.instance_variable_set('@current_storage', nil)
      Adhoq.config.storage = storage_config
    end

    around(:each) do |example|
      begin
        original_config = Adhoq.config.storage
        example.run
      ensure
        reset_storage_config(*original_config)
      end
    end

    context 'config.storage = [:local_file, ....]' do
      before do
        reset_storage_config(:local_file, Rails.root + "/tmp/adhoq/#{Rails.env}")
      end

      specify do
        expect(Adhoq.current_storage).to be_instance_of Adhoq::Storage::LocalFile
      end
    end

    context 'config.storage = [:s3, ....]' do
      before do
        reset_storage_config(:s3, 'my-bucket-name', aws_access_key_id: 'key-id', aws_secret_access_key: 'secret', region: 'paris-01')
      end

      specify do
        expect(Adhoq.current_storage).to be_instance_of Adhoq::Storage::S3
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
adhoq-1.0.2 spec/adhoq/global_variable_spec.rb
adhoq-1.0.1 spec/adhoq/global_variable_spec.rb
adhoq-1.0.0 spec/adhoq/global_variable_spec.rb
adhoq-0.5.0 spec/adhoq/global_variable_spec.rb
adhoq-0.5.0.beta1 spec/adhoq/global_variable_spec.rb
adhoq-0.4.0 spec/adhoq/global_variable_spec.rb
adhoq-0.3.0 spec/adhoq/global_variable_spec.rb
adhoq-0.2.0 spec/adhoq/global_variable_spec.rb
adhoq-0.1.2 spec/adhoq/global_variable_spec.rb
adhoq-0.1.1 spec/adhoq/global_variable_spec.rb
adhoq-0.1.0 spec/adhoq/global_variable_spec.rb
adhoq-0.0.7 spec/adhoq/global_variable_spec.rb
adhoq-0.0.6 spec/adhoq/global_variable_spec.rb
adhoq-0.0.5 spec/adhoq/global_variable_spec.rb
adhoq-0.0.4 spec/adhoq/global_variable_spec.rb
adhoq-0.0.3 spec/adhoq/global_variable_spec.rb