Sha256: 2193c9cef9c5d778a27805e874b4b33fc29b4a63adb24a66d858d19adcf3b319

Contents?: true

Size: 1.88 KB

Versions: 3

Compression:

Stored size: 1.88 KB

Contents

require 'spec_helper'

describe Cradlepoint::Router do

  let(:router) { Cradlepoint::Router }

  subject { router }
  it { should be }

  it 'should provide the proper rel_url' do
    router.rel_url.should == '/routers'
  end

  it 'should provide the proper rel_url_with_id' do
    router.rel_url_with_id(123).should == '/routers/123/'
  end

  context 'when authenticated' do

    before { login }

    describe '.get' do

      describe 'attrs' do

        let(:ecm_router) { router.new(ROUTER_ID) }
        let(:attrs) { [:mac, :config_status, :description, :full_product_name, :ip_address, :name, :stream_usage_in, 
                       :stream_usage_out, :stream_usage_period] }

        before { ecm_router.get }

        it 'should be assigned correctly' do
          attrs.each do |a|
            ecm_router.send(a).should == ecm_router.data[a]
          end
        end
      end
    end

    describe '.index' do

      let(:routers) { router.index }

      it 'should return routers' do
        routers.any?.should be_true
      end

      it 'should return the correct collection' do
        routers.is_a?(Array).should be_true
      end

      it 'should be of the correct type' do
        routers.each{ |r| r.is_a?(Cradlepoint::Router).should be_true }
      end
    end

    describe '.get_configuration_manager_data' do

      let(:the_router)  { router.new(ROUTER_ID) }

      before { the_router.configuration_manager_data }

      it 'should have gotten the configuration manager data' do
        the_router.ecm_configuration_manager_data.should be
      end
    end

    describe '.firmware_data' do

      let(:the_router) { router.new(ROUTER_ID) }

      it 'should have gotten the firmware data' do
        pending 'Waiting for updates to the firmware on the API side.'
        the_router.firmware_data['success'].should be_true
      end
    end

    describe '.apply_new_config' do

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cradlepoint-0.2.0 spec/router_spec.rb
cradlepoint-0.1.2 spec/router_spec.rb
cradlepoint-0.1.1 spec/router_spec.rb