Sha256: 46a7e7621a85de27583a87bcfbff5b2df2dbe4ed05b2637e1ada7ecbd0e873ef
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require 'spec_helper' describe "ENUM datatype" do describe "schema dump" do before { load_schema "enum_old" } subject { dumped_schema } it "dumps native format" do subject.should match %r{t\.enum\s+"color",\s+:limit => \["blue", "red", "yellow"\]} end it "dumps default option" do subject.should match %r{t\.enum\s+"color",.+:default => "red"} end it "dumps null option" do subject.should match %r{t\.enum\s+"color",.+:null => false$} end end describe "schema loading" do before { load_schema "enum_new" } subject { ActiveRecord::Base.connection.select_one "SHOW FIELDS FROM balloons WHERE Field='color'" } it "loads native format" do subject[ "Type" ].should == "enum('red','gold')" end it "loads default option" do subject[ "Default" ].should == "gold" end it "loads null option" do subject[ "Null" ].should == "NO" end it "loads native column format" do subject = ActiveRecord::Base.connection.select_one "SHOW FIELDS FROM balloons WHERE Field='size'" subject[ "Type" ].should == "enum('small','medium','large')" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord_enum-0.0.2 | spec/enum_spec.rb |