diff options
| author | Robert | 2017-07-23 22:56:12 +0200 | 
|---|---|---|
| committer | Robert | 2017-07-25 21:31:51 +0200 | 
| commit | fe46c7832fa1e0c6af450f0937aea3534c0f6b01 (patch) | |
| tree | 60670a6ac730a081c3627f25a44c0bd78ea90d3a /spec/concerns | |
| parent | 384a06676b8e0985f39fbc894a2d7dd458823529 (diff) | |
| download | chouette-core-fe46c7832fa1e0c6af450f0937aea3534c0f6b01.tar.bz2 | |
Refs: #3507;20h Specing and Implementing the ZipService
Diffstat (limited to 'spec/concerns')
| -rw-r--r-- | spec/concerns/configurable_spec.rb | 31 | 
1 files changed, 31 insertions, 0 deletions
| diff --git a/spec/concerns/configurable_spec.rb b/spec/concerns/configurable_spec.rb new file mode 100644 index 000000000..822f572c1 --- /dev/null +++ b/spec/concerns/configurable_spec.rb @@ -0,0 +1,31 @@ +RSpec.describe Configurable do + +  subject do +    Class.new do +      include Configurable +    end +  end + +  let( :something ){ double('something') } + +  it 'can be configured' do +    expect{ subject.config.anything }.to raise_error(NoMethodError) + +    subject.config.something = something + +    expect( subject.config.something ).to eq(something) +    expect( subject.new.send(:config).something ).to eq(something) +    expect( subject.new.send(:config).something ).to eq(something) +  end + +  it 'can be configured with a block' do + +    subject.config do | c | +      c.something = something  +    end + +    expect( subject.config.something ).to eq(something) +    expect( subject.new.send(:config).something ).to eq(something) +    expect( subject.new.send(:config).something ).to eq(something) +  end +end | 
