From bb674f018a0d359f334bc551f60e98383e3bb125 Mon Sep 17 00:00:00 2001 From: Nicholas Chmielewski Date: Thu, 16 May 2013 16:10:01 +1000 Subject: [PATCH] Add context to spec in preparation for new tests --- spec/active_enum/base_spec.rb | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/spec/active_enum/base_spec.rb b/spec/active_enum/base_spec.rb index 98c3df5..52cb427 100644 --- a/spec/active_enum/base_spec.rb +++ b/spec/active_enum/base_spec.rb @@ -161,24 +161,26 @@ class NewEnum < ActiveEnum::Base; end end context "element reference method" do - let(:enum) { - define_enum do - value :id => 1, :name => 'Name 1' - value :id => 2, :name => 'Name 2' - end - } + context 'integer ids' do + let(:enum) { + define_enum do + value :id => 1, :name => 'Name 1' + value :id => 2, :name => 'Name 2' + end + } - it 'should return name when given an id' do - enum[1].should == 'Name 1' - end + it 'should return name when given an id' do + enum[1].should == 'Name 1' + end - it 'should return id when given a name' do - enum['Name 1'].should == 1 - end + it 'should return id when given a name' do + enum['Name 1'].should == 1 + end - it 'should return id when given a symbol of the name' do - enum[:Name_1].should == 1 - enum[:name_1].should == 1 + it 'should return id when given a symbol of the name' do + enum[:Name_1].should == 1 + enum[:name_1].should == 1 + end end end