Sha256: 56a4b57b97e86fae5ca6d81db2c1f909dc28a5168be6a3570659235368dd40cd

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Locomotive::Coal::Resources::Accounts, order: :defined do

  before { VCR.insert_cassette 'accounts', record: :new_episodes }
  after  { VCR.eject_cassette }

  let(:uri)         { TEST_API_V3_URI }
  let(:credentials) { { email: TEST_API_EMAIL, token: api_token } }
  let(:accounts)    { described_class.new(uri, credentials) }

  describe '#all' do

    subject { accounts.all }
    it { expect(subject.size).to be > 0 }

    describe 'first account' do
      subject { accounts.all }
      it { expect(subject.to_a.map { |a| a.name }).to include('New Admin', 'John Doe') }
    end
  end

  describe '#create' do
    subject { create_account }
    it { expect(subject._id).not_to eq nil }
  end

  describe '#destroy' do
    let(:new_account) { accounts.all.find { |a| a.email == 'jane@doe.net' } || create_account }
    subject { accounts.destroy(new_account._id) }
    it { expect(subject._id).not_to eq nil }
  end

  def create_account
    accounts.create(name: 'Jane', email: 'jane@doe.net', password: 'easyone', password_confirmation: 'easyone')
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locomotivecms_coal-1.7.0 spec/integration/resources/accounts_spec.rb
locomotivecms_coal-1.6.0 spec/integration/resources/accounts_spec.rb
locomotivecms_coal-1.6.0.rc2 spec/integration/resources/accounts_spec.rb