Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7424: test_mysql_schema_dump_blob_column_lengths.diff

File test_mysql_schema_dump_blob_column_lengths.diff, 2.0 kB (added by will.bryant, 9 months ago)

currently-failing test case (updated to apply to r8918)

  • test/schema/schema.rb

    old new  
    2424    create_table :binaries, :force => true do |t| 
    2525      t.binary :data 
    2626    end 
     27     
     28    create_table :binary_fields, :force => true do |t| 
     29      t.binary :tiny_blob,   :limit => 255 
     30      t.binary :normal_blob, :limit => 65535 
     31      t.binary :medium_blob, :limit => 16777215 
     32      t.binary :long_blob,   :limit => 2147483647 
     33      t.text   :tiny_text,   :limit => 255 
     34      t.text   :normal_text, :limit => 65535 
     35      t.text   :medium_text, :limit => 16777215 
     36      t.text   :long_text,   :limit => 2147483647 
     37    end 
    2738 
    2839    create_table :booleantests, :force => true do |t| 
    2940      t.integer :value 
  • test/cases/schema_dumper_test.rb

    old new  
    115115        assert_not_nil(match, "nonstandardpk table not found") 
    116116        assert_match %r(:primary_key => "movieid"), match[1], "non-standard primary key not preserved" 
    117117      end 
     118 
     119      def test_schema_dump_includes_length_for_mysql_blob_and_text_fields 
     120        output = standard_dump 
     121        assert_match %r{t.binary\s+"tiny_blob",\s+:limit => 255$}, output 
     122        assert_match %r{t.binary\s+"normal_blob"$}, output 
     123        assert_match %r{t.binary\s+"medium_blob",\s+:limit => 16777215$}, output 
     124        assert_match %r{t.binary\s+"long_blob",\s+:limit => 2147483647$}, output 
     125        assert_match %r{t.text\s+"tiny_text",\s+:limit => 255$}, output 
     126        assert_match %r{t.text\s+"normal_text"$}, output 
     127        assert_match %r{t.text\s+"medium_text",\s+:limit => 16777215$}, output 
     128        assert_match %r{t.text\s+"long_text",\s+:limit => 2147483647$}, output 
     129      end 
    118130    end 
    119131 
    120132    def test_schema_dump_includes_decimal_options