test/lib/vedeu/groups/dsl_test.rb in vedeu-0.7.4 vs test/lib/vedeu/groups/dsl_test.rb in vedeu-0.8.0

- old
+ new

@@ -8,32 +8,41 @@ let(:described) { Vedeu::Groups::DSL } let(:instance) { described.new(model, client) } let(:model) { Vedeu::Groups::Group.new } let(:client) {} - let(:group_name) { 'main_screen' } + let(:_name) { :main_screen } describe '.group' do - context 'when the block is given' do - subject { - described.group(group_name) do - # ... - end - } + subject { + described.group(_name) do + # ... + end + } + context 'when the name is not given' do + let(:_name) {} + + it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) } end - context 'when the block is not given' do - subject { described.group(group_name) } + context 'when the name is given' do + context 'when the block is not given' do + subject { described.group(_name) } - it { proc { subject }.must_raise(Vedeu::Error::RequiresBlock) } + it { proc { subject }.must_raise(Vedeu::Error::RequiresBlock) } + end + + context 'when the block is given' do + it { subject.must_be_instance_of(Vedeu::Groups::Group) } + end end end describe '#add' do subject { - described.group(group_name) do + described.group(_name) do add('editor_interface') end } it { subject.must_be_instance_of(Vedeu::Groups::Group) } @@ -45,11 +54,11 @@ let(:expected) { Set['editor_interface', 'some_interface', 'other_interface'] } subject { - described.group(group_name) do + described.group(_name) do members('editor_interface', 'some_interface', 'other_interface') end } it { subject.must_be_instance_of(Vedeu::Groups::Group) } @@ -96,12 +105,12 @@ end } it { subject.members.size.must_equal(2) } - it { subject.members.must_equal( - Set['main_interface', 'status_interface'] - ) } + it do + subject.members.must_equal(Set['main_interface', 'status_interface']) + end end end # DSL end # Groups