Sha256: 2a9cf6e4c83fc514bde9faf5f99a572547057bbaae7ba5ff7defa56455a8193b

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Woopy::Account do

  before do
    @token = 'foo'
    Woopy(token: @token)
    ActiveResource::HttpMock.respond_to do |mock|
      mock.post( '/services/v1/accounts.json', request_headers(@token), account_response )
      mock.post( '/services/v1/users.json', request_headers(@token), user_response )
      mock.post( '/services/v1/employments.json', request_headers(@token), employment_response )
      mock.post( '/services/v1/ownerships.json', request_headers(@token), ownership_response )
    end
  end

  describe "#save" do

    context "valid name, subdomain, and packages" do
      before do
        @account = Woopy::Account.new(account_attributes)
      end
      it 'saves correctly' do
        @account.save.should be_true
      end
    end

  end

  context "with an existing user" do

    before do
      @account = Woopy::Account.create(account_attributes)
      @user = Woopy::User.create(user_attributes)
    end

    describe "#employ" do
      subject { @account.employ(@user) }

      it { should be_kind_of Woopy::Employment }
      it { should be_persisted }
    end

    describe "#make_owner" do
      subject { @account.make_owner(@user) }

      it { should be_kind_of Woopy::Ownership }
      it { should be_persisted }
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
woopy-0.1.8 spec/woopy/account_spec.rb
woopy-0.1.7 spec/woopy/account_spec.rb