Sha256: c943ffc3250dfbab5d715efb76b2293688cf24e96f988df753e1eeac5ae27f19

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'
require 'td/updater'

module TreasureData::Updater

  describe 'without the TD_TOOLBELT_UPDATE_ROOT environment variable defined' do
    let :default_toolbelt_url do
      "http://toolbelt.treasuredata.com"
    end

    describe 'endpoints methods' do
      it 'use the default root path' do
        TreasureData::Updater.endpoint_root.should == default_toolbelt_url
        TreasureData::Updater.version_endpoint.should =~ Regexp.new(default_toolbelt_url)
        TreasureData::Updater.update_package_endpoint.should =~ Regexp.new(default_toolbelt_url)
      end
    end
  end

  describe 'with the TD_TOOLBELT_UPDATE_ROOT environment variable defined' do
    before do
      ENV['TD_TOOLBELT_UPDATE_ROOT'] = 'https://0.0.0.0:5000/'
    end
    describe 'endpoints methods' do
      it 'use the custom root path' do
        TreasureData::Updater.endpoint_root.should == ENV['TD_TOOLBELT_UPDATE_ROOT']
        TreasureData::Updater.version_endpoint.should =~ Regexp.new(ENV['TD_TOOLBELT_UPDATE_ROOT'])
        TreasureData::Updater.update_package_endpoint.should =~ Regexp.new(ENV['TD_TOOLBELT_UPDATE_ROOT'])
      end
    end
    after do
      ENV.delete 'TD_TOOLBELT_UPDATE_ROOT'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
td-0.11.5 spec/td/updater_spec.rb
td-0.11.4 spec/td/updater_spec.rb
td-0.11.3 spec/td/updater_spec.rb