Skip to content

Commit

Permalink
Add context to spec in preparation for new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hackling authored and parameme committed Jun 4, 2014
1 parent 567d2e5 commit bb674f0
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions spec/active_enum/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bb674f0

Please sign in to comment.