Sha256: 0002c0e552f6210f99c78c7b2dae73761093e7ddad5f5da0064eeeec6923be87

Contents?: true

Size: 937 Bytes

Versions: 2

Compression:

Stored size: 937 Bytes

Contents

require 'spec_helper'

describe RokuPackager::KeyGen do
  describe '#create' do
    before do
      @key_gen = RokuPackager::KeyGen.new('192.168.1.10')
    end

    it 'returns parsed_output' do
      @key_gen.expects(:generate).returns('output_from_device')
      @key_gen.expects(:parse)
        .with('output_from_device').returns(['devid', 'password'])

      @key_gen.create.must_equal ['devid', 'password']
    end

    it 'raises exception if dev_id is nil' do
      @key_gen.stubs(:generate).returns(nil)
      @key_gen.stubs(:parse).returns([nil, 'password'])

      lambda {
        @key_gen.create
      }.must_raise RokuPackager::KeyGen::GenerationError
    end

    it 'raises exception if password is nil' do
      @key_gen.stubs(:generate).returns(nil)
      @key_gen.stubs(:parse).returns(['devid', nil])

      lambda {
        @key_gen.create
      }.must_raise RokuPackager::KeyGen::GenerationError
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roku-packager-0.0.3 spec/roku-packager/key_gen_spec.rb
roku-packager-0.0.1 spec/roku-packager/key_gen_spec.rb