Sha256: f11f1db7884bbcc03794227e8371228000137f39dcaab45d951117b6db4ada6e

Contents?: true

Size: 1.15 KB

Versions: 18

Compression:

Stored size: 1.15 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'
      WebMock::API.stub_request(:post, url).
        with(:body => WebMock::API.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

18 entries across 18 versions & 1 rubygems

Version Path
cocoapods-trunk-1.2.0 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.1.2 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.1.1 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.1.0 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.1.0.beta.1 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.0.0 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.0.0.rc.1 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.0.0.beta.4 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.0.0.beta.3 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.0.0.beta.2 spec/command/trunk/register_spec.rb
cocoapods-trunk-1.0.0.beta.1 spec/command/trunk/register_spec.rb
cocoapods-trunk-0.6.4 spec/command/trunk/register_spec.rb
cocoapods-trunk-0.6.3 spec/command/trunk/register_spec.rb
cocoapods-trunk-0.6.2 spec/command/trunk/register_spec.rb
cocoapods-trunk-0.6.1 spec/command/trunk/register_spec.rb
cocoapods-trunk-0.6.0 spec/command/trunk/register_spec.rb
cocoapods-trunk-0.5.1 spec/command/trunk/register_spec.rb
cocoapods-trunk-0.5.0 spec/command/trunk/register_spec.rb