Sha256: 5c2b0c63824f07a6b2777281afef99853764b0736fb80a293a70e9ea5189c369
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
require 'test_in_memory' require 'enumerated_attribute' require 'active_record' require 'inheritance_classes' def one_to_four; [:one, :two, :three, :four]; end def gear1; [:reverse, :neutral, :first, :second, :over_drive]; end def gear2; [:reverse, :neutral, :first, :second, :third, :over_drive]; end def choke; [:none, :medium, :full]; end describe "SubRaceCar" do it "should have :gear init to :neutral" do o=SubRaceCar.new o.gear.should == :neutral o.enums(:gear).should == gear1 o.gear_previous.should == :reverse end it "should have :choke init to :none" do o=SubRaceCar.new o.choke.should == :none o.enums(:choke).should == choke o.choke_previous.should == :full end it "should have :extra init to :one" do o=SubRaceCar.new o.extra.should == :one o.enums(:extra).should == one_to_four o.extra_previous.should == :four end end describe "SubRaceCar2" do it "should have :gear init to :neutral" do o=SubRaceCar2.new o.gear.should == :neutral o.enums(:gear).should == gear1 o.gear_previous.should == :reverse end it "should have :choke init to :none" do o=SubRaceCar2.new o.choke.should == :none o.enums(:choke).should == choke o.choke_previous.should == :full end end describe "SubRaceCar3" do it "should have overridden :gear init to :first" do o=SubRaceCar3.new o.gear.should == :first o.enums(:gear).should == gear2 o.gear_previous.should == :neutral end it "should have :choke init to :none" do o=SubRaceCar3.new o.choke.should == :none o.enums(:choke).should == choke o.choke_previous.should == :full end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jeffp-enumerated_attribute-0.2.3 | spec/active_record/inheritance_spec.rb |