From 5ce30b12b7e67dc800e2783560e3a1adcc37d0f8 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Fri, 7 Feb 2014 22:03:59 +0100 Subject: [PATCH] little alteration in spec test --- spec/models/group_spec.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 9dd30aee6c..615b120997 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -70,13 +70,15 @@ describe Group do describe :create do describe 'group with empty group name' do - before do - @g = Group.new(:lastname => "") - @g.save - end + let(:group) { FactoryGirl.build(:group, lastname: '') } - it { @g.valid?.should be_false } - it { @g.errors.full_messages[0].should include I18n.t('attributes.groupname')} + it { expect(group.valid?).to be_false } + + describe 'error message' do + before { group.valid? } + + it { expect(group.errors.full_messages[0]).to include I18n.t('attributes.groupname')} + end end end -end +end \ No newline at end of file