Sha256: 9e5db5ff047fa14ae4d7d2da3ca5ce667103de47782c8023eda610419eefb530

Contents?: true

Size: 1.27 KB

Versions: 10

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Pushbullet::Contact do
  describe '::all' do
    it 'returns all contacts' do
      VCR.use_cassette('contacts_all') do
        expect(described_class.all).to be_a Array
      end
    end

    it 'returns iterable of Contacts' do
      VCR.use_cassette('contacts_all') do
        described_class.all.each do |cont|
          expect(cont).to be_a described_class
        end
      end
    end
  end

  describe '::create' do
    context 'given an name and a email' do
      let(:name) { 'Letz' }
      let(:email) { 'letzdevelopment@gmail.com' }

      it 'returns a contact' do
        VCR.use_cassette('contacts_create') do
          expect(described_class.create name, email).to be_a described_class
        end
      end
    end
  end

  describe '#destroy' do
    context 'given a contact' do
      let(:contact) { build(:contact) }

      it 'removes a contact' do
        VCR.use_cassette('contacts_remove') do
          expect(contact.destroy).to be_truthy
        end
      end
    end
  end

  describe '#save' do
    let(:contact) { build(:contact) }
    before { contact.name = 'Another name' }

    it 'updates the name of the contact' do
      VCR.use_cassette('contacts_update') do
        expect(contact.save).to be_truthy
      end
    end
  end
end

Version data entries

10 entries across 8 versions & 2 rubygems

Version Path
tdiary-5.0.5 vendor/bundle/gems/ruby-pushbullet-0.1.4/spec/pushbullet/contact_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/ruby-pushbullet-0.1.4/spec/pushbullet/contact_spec.rb
tdiary-5.0.4 vendor/bundle/gems/ruby-pushbullet-0.1.4/spec/pushbullet/contact_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/ruby-pushbullet-0.1.4/spec/pushbullet/contact_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/ruby-pushbullet-0.1.4/spec/pushbullet/contact_spec.rb
ruby-pushbullet-0.1.4 spec/pushbullet/contact_spec.rb
ruby-pushbullet-0.1.3 spec/pushbullet/contact_spec.rb
ruby-pushbullet-0.1.2 spec/pushbullet/contact_spec.rb
ruby-pushbullet-0.1.1 spec/pushbullet/contact_spec.rb
ruby-pushbullet-0.1 spec/pushbullet/contact_spec.rb