Sha256: 28684e8791438b4a3cd75a1aa693abfb4efb458d018b2aef2fed5b775f2c7e32
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' describe AngularSprinkles::Decorators::Bind do class StubObject attr_reader :some_attr def initialize(some_attr) @some_attr = some_attr end end class StubContext def bind(*args) end def var_initialized?(*args) end def set_prototype_variable(*args) end def content_for(*args) end end let(:context) { StubContext.new } let(:context_proc) { ->{ context } } let(:attr) { :brewhouse } let(:key) { 'software' } let(:object) { StubObject.new(attr) } subject { AngularSprinkles::Decorators::Bind.new(object, key, context_proc) } describe '#bind' do context 'when no arguments are passed' do it 'creates the necessary object binding' do expect(context).to receive(:bind) subject.bind end end context 'when more than one argument is passed' do it 'creates the necessary object binding' do expect(context).to receive(:bind).with(key, nil) subject.bind end it 'creates additional bindings' do expect(context).to receive(:bind).with(key, :some_attr) subject.bind(:some_attr) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems