Sha256: d593cc5592f346f34bbb7dc5620c82bcc53165db356b703fc4721a4f3d9a09db
Contents?: true
Size: 1.27 KB
Versions: 4
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe "ENUM datatype" do describe "schema dump", :db_support => true do before { load_schema "enum_old" } subject { dumped_schema } it "dumps native format" do expect(subject).to match %r{t\.enum\s+"color",\s+(:limit =>|limit:) \["blue", "red", "yellow"\]} end it "dumps default option" do expect(subject).to match %r{t\.enum\s+"color",.+(:default =>|default:) "red"} end it "dumps null option" do expect(subject).to match %r{t\.enum\s+"color",.+(:null =>|null:) false$} end end describe "schema loading" do before { load_schema "enum_new" } subject { column_props :balloons, :color } it "loads native format", :db_support => true do expect(subject[:type]).to eq("enum('red','gold')") end it "falls back to text when missing db support", :db_support => false do expect(subject[:type]).to match(/varchar/) end it "loads default option" do expect(subject[:default]).to eq("gold") end it "loads null option" do expect(subject[:null]).to eq(false) end it "loads native column format", :db_support => true do subject = column_props :balloons, :size expect(subject[:type]).to eq("enum('small','medium','large')") end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
activerecord_enum-0.4.1 | spec/enum_spec.rb |
native_enum-1.0.0 | spec/enum_spec.rb |
native_enum-1.0.0pre1 | spec/enum_spec.rb |
activerecord_enum-0.4.0 | spec/enum_spec.rb |