Sha256: 487e6c366d149252220bd582c9d9d24d93b742a10ed179377530f3bcd8d56f88
Contents?: true
Size: 1.16 KB
Versions: 8
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' describe WialonApi::Resolver do before(:each) do @class = Class.new do include WialonApi::Resolver attr_accessor :sid def initialize(name) @name = name end end end describe '#send' do before(:each) do @resolver = @class.new('trololo') @sid = double('sid') allow(@resolver).to receive(:sid).and_return(@sid) end it 'gets into #method_missing' do expect(@resolver).to receive(:method_missing).with(:send, message: 'hello') @resolver.send(message: 'hello') end end describe '#resolver' do before(:each) do @name = double('Name') @resolver = @class.new(@name) @sid = double('sid') allow(@resolver).to receive(:sid).and_return(@sid) end let(:resolver) { @resolver.resolver } it 'returns a Hashie::Mash with a name and a sid' do expect(resolver.name).to eq(@name) expect(resolver.sid).to eq(@sid) end it 'caches the result' do @mash = double('Mash', name: @name, sid: @sid) expect(Hashie::Mash).to receive(:new).once.and_return(@mash) 5.times { @resolver.resolver } end end end
Version data entries
8 entries across 8 versions & 1 rubygems