Sha256: 0c0d44611597d8e7cc81a19aa82a59299f69af8f929bcc3da6e8ff67eb4f9ee6

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Pushbullet::Device do
  describe '::all' do
    it 'returns all devices' do
      VCR.use_cassette('devices_all') do
        expect(described_class.all).to be_a Array
      end
    end

    it 'returns iterable of Devices' do
      VCR.use_cassette('devices_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 nickname and a type' do
      let(:nickname) { 'Letz Device' }
      let(:type) { 'stream' }

      it 'returns a device' do
        VCR.use_cassette('devices_create') do
          expect(described_class.create nickname, type).to be_a described_class
        end
      end
    end
  end

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

      it 'removes a device' do
        VCR.use_cassette('devices_remove') do
          expect(device.destroy).to be_truthy
        end
      end
    end
  end

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

    it 'updates the name of the device' do
      VCR.use_cassette('devices_update') do
        expect(device.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/devices_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/ruby-pushbullet-0.1.4/spec/pushbullet/devices_spec.rb
tdiary-5.0.4 vendor/bundle/gems/ruby-pushbullet-0.1.4/spec/pushbullet/devices_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/ruby-pushbullet-0.1.4/spec/pushbullet/devices_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/ruby-pushbullet-0.1.4/spec/pushbullet/devices_spec.rb
ruby-pushbullet-0.1.4 spec/pushbullet/devices_spec.rb
ruby-pushbullet-0.1.3 spec/pushbullet/devices_spec.rb
ruby-pushbullet-0.1.2 spec/pushbullet/devices_spec.rb
ruby-pushbullet-0.1.1 spec/pushbullet/devices_spec.rb
ruby-pushbullet-0.1 spec/pushbullet/devices_spec.rb