Sha256: d7df15e5dbdab7a0e53984f0efb2c5d50a0e88cd1ebba53006bcb8be0b303a6f

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

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

module Pod
  describe Command::Trunk::Register do
    describe 'CLAide' do
      it 'registers it self' do
        Command.parse(%w( trunk register )).should.be.instance_of Command::Trunk::Register
      end
    end

    it 'should error if email is not supplied' do
      Netrc.any_instance.stubs(:[]).returns(nil)
      command = Command.parse(%w( trunk register ))
      exception = lambda { command.validate! }.should.raise CLAide::Help
      exception.message.should.include 'email address'
    end

    it 'should register user' do
      url = 'https://trunk.cocoapods.org/api/v1/sessions'
      stub_request(:post, url).
        with(:body => hash_including('email' => 'kyle@cocoapods.org')).
        to_return(:status => 200, :body => '{"token": "acct"}')
      Netrc.any_instance.stubs(:[]).returns(nil)
      Netrc.any_instance.expects(:[]=).with('trunk.cocoapods.org', ['kyle@cocoapods.org', 'acct'])
      Netrc.any_instance.expects(:save)

      command = Command.parse(%w( trunk register kyle@cocoapods.org ))
      lambda { command.run }.should.not.raise
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
cocoapods-trunk-1.6.0 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.5.0 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.4.1 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.4.0 spec/command/trunk/register_spec.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/cocoapods-trunk-1.3.1/spec/command/trunk/register_spec.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/cocoapods-trunk-1.3.1/spec/command/trunk/register_spec.rb
cocoapods-trunk-1.3.1 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.3.0 spec/command/trunk/register_spec.rb