test/lib/vedeu/dsl/interface_test.rb in vedeu-0.5.4 vs test/lib/vedeu/dsl/interface_test.rb in vedeu-0.5.5

- old
+ new

@@ -5,11 +5,11 @@ module DSL describe Interface do let(:described) { Vedeu::DSL::Interface } - let(:instance) { described.new(model) } + let(:instance) { described.new(model, client) } let(:model) { Vedeu::Interface.new(name: 'actinium') } let(:client) {} @@ -17,17 +17,45 @@ it { instance.must_be_instance_of(described) } it { instance.instance_variable_get('@model').must_equal(model) } it { instance.instance_variable_get('@client').must_equal(client) } end + describe '.interface' do + after { Vedeu.interfaces.reset } + + subject { + described.interface('flourine') do + # ... + end + } + + it { subject.must_be_instance_of(Vedeu::Interface) } + + context 'when the block is not given' do + subject { described.interface('flourine') } + + it { proc { subject }.must_raise(Vedeu::InvalidSyntax) } + end + + context 'when the name is not given' do + subject { + described.interface('') do + # ... + end + } + + it { proc { subject }.must_raise(Vedeu::MissingRequired) } + end + end + describe '#border' do after { Vedeu.borders.reset } context 'when the block is not given' do subject { instance.border } - it { proc { subject }.must_raise(InvalidSyntax) } + it { proc { subject }.must_raise(Vedeu::InvalidSyntax) } end context 'when the block is given' do subject { instance.border { } } @@ -157,11 +185,11 @@ describe '#geometry' do context 'when the required block is not provided' do subject { instance.geometry } - it { proc { subject }.must_raise(InvalidSyntax) } + it { proc { subject }.must_raise(Vedeu::InvalidSyntax) } end context 'when the block is given' do subject { instance.geometry { } } @@ -226,27 +254,9 @@ end } it { subject.must_be_instance_of(Vedeu::Keymap) } it { instance.must_respond_to(:keys) } - end - - describe '#lines' do - subject { - instance.lines do - # ... - end - } - - it { subject.must_be_instance_of(Vedeu::Lines) } - - context 'when the required block is not provided' do - subject { instance.lines } - - it { proc { subject }.must_raise(InvalidSyntax) } - end - - it { instance.must_respond_to(:line) } end describe '#name' do subject { instance.name('nickel') }