test/lib/vedeu/dsl/interface_test.rb in vedeu-0.5.0 vs test/lib/vedeu/dsl/interface_test.rb in vedeu-0.5.1
- old
+ new
@@ -7,34 +7,23 @@
describe Interface do
let(:described) { Vedeu::DSL::Interface }
let(:instance) { described.new(model) }
let(:model) {
- Vedeu.interface 'actinium' do
- # ...
- end
+ Vedeu::Interface.new(name: 'actinium')
}
let(:client) {}
- before { Vedeu.interfaces.reset }
- after { Vedeu.interfaces.reset }
-
describe '#initialize' do
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 '#border' do
after { Vedeu.borders.reset }
- subject {
- instance.border do
- # ...
- end
- }
-
context 'when the block is not given' do
subject { instance.border }
it { proc { subject }.must_raise(InvalidSyntax) }
end
@@ -141,40 +130,34 @@
it { subject; model.delay.must_equal(0.25) }
end
describe '#focus!' do
context 'when a single call is made' do
- before do
+ before {
Vedeu::Focus.reset
Vedeu.interface('curium') { focus! }
- end
+ }
it 'sets the interface as current' do
Vedeu.focus.must_equal('curium')
end
end
context 'when no calls are made' do
- before do
+ before {
Vedeu::Focus.reset
Vedeu.interface('curium') {}
Vedeu.interface('dysprosium') {}
- end
+ }
it 'the first interface defined will be current' do
Vedeu.focus.must_equal('curium')
end
end
end
describe '#geometry' do
- subject {
- instance.geometry do
- # ...
- end
- }
-
context 'when the required block is not provided' do
subject { instance.geometry }
it { proc { subject }.must_raise(InvalidSyntax) }
end
@@ -216,13 +199,13 @@
end
context 'when the named group exists' do
let(:members) { Set['actinium', 'lanthanum'] }
- before do
+ before {
Vedeu::Group.new(name: 'elements', members: ['lanthanum']).store
- end
+ }
it {
subject
Vedeu.groups.find('elements').members.must_equal(members)
}
@@ -299,18 +282,18 @@
it { subject.visible.must_equal(false) }
end
describe '#use' do
- before do
+ before {
Vedeu.interface 'some_interface' do
delay 0.75
end
Vedeu.interface 'other_interface' do
delay use('some_interface').delay
end
- end
+ }
after { Vedeu.interfaces.reset }
subject { instance.use('other_interface').delay }
it 'allows the use of another models attributes' do
@@ -330,10 +313,9 @@
let(:_value) { 1 }
subject { instance.zindex(_value) }
it { subject.must_equal(1) }
-
it { instance.must_respond_to(:z_index) }
it { instance.must_respond_to(:z) }
end
end # Interface