Sha256: 33cc6dbfeb9920bd5c4f2000c72c5b60a31c7d7a45941e5882348327508c9c54

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require File.expand_path('../spec_helper', File.dirname(__FILE__))

# The CocoaPods namespace
#
module CLAide
  describe Command::PluginsHelper do
    extend SpecHelper::PluginsStubs

    it 'downloads the json file' do
      stub_plugins_json_request
      json = Command::PluginsHelper.download_json
      json.should.not.be.nil?
      json.should.be.is_a? Hash
      json['plugins'].size.should.eql? 3
    end

    it 'handles empty/bad JSON' do
      stub_plugins_json_request 'This is not JSON'
      expected_error = /Invalid plugins list from claidetest-plugins/
      should.raise(CLAide::Informative) do
        Command::PluginsHelper.download_json
      end.message.should.match(expected_error)
    end

    it 'notifies the user if the download fails' do
      stub_plugins_json_request '', [404, 'Not Found']
      expected_error = /Could not download plugins list from claidetest-plugins/
      should.raise(CLAide::Informative) do
        Command::PluginsHelper.download_json
      end.message.should.match(expected_error)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
claide-plugins-0.9.2 spec/command/plugins_helper_spec.rb
claide-plugins-0.9.1 spec/command/plugins_helper_spec.rb