Skip to content

Commit

Permalink
Fix for AR 6.0.0.beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
winebarrel committed Mar 4, 2019
1 parent 79f52d8 commit 28b1973
Showing 1 changed file with 50 additions and 8 deletions.
58 changes: 50 additions & 8 deletions spec/mysql/text_blob_types/text_blob_types_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
expect(delta.differ?).to be_truthy
delta.migrate

expect(subject.dump).to match_fuzzy erbh(<<-ERB)
expect(subject.dump).to match_ruby erbh(<<-ERB)
create_table "foos", id: :integer, unsigned: true, force: :cascade do |t|
t.binary "blob", <%= i cond(5.0, limit: 65535) %>
t.blob "tiny_blob", limit: 255
t.binary "medium_blob", limit: 16777215
t.binary "long_blob", limit: 4294967295
t.text "tiny_text", limit: 255
t.text "medium_text", limit: 16777215
t.text "long_text", limit: 4294967295
t.<%= cond('< 6.0.0.beta2', :blob, :binary) %> "tiny_blob", <%= i cond('< 6.0.0.beta2', {limit: 255}, {size: :tiny}) %>
t.binary "medium_blob", <%= i cond('< 6.0.0.beta2', {limit: 16777215}, {size: :medium}) %>
t.binary "long_blob", <%= i cond('< 6.0.0.beta2', {limit: 4294967295}, {size: :long}) %>
t.text "tiny_text", <%= i cond('< 6.0.0.beta2', {limit: 255}, {size: :tiny}) %>
t.text "medium_text", <%= i cond('< 6.0.0.beta2', {limit: 16777215}, {size: :medium}) %>
t.text "long_text", <%= i cond('< 6.0.0.beta2', {limit: 4294967295}, {size: :long}) %>
t.decimal "unsigned_decimal", precision: 10, unsigned: true
t.float "unsigned_float", <%= i cond('< 5.2.0.beta2', limit: 24) %>, unsigned: true
t.bigint "unsigned_bigint", unsigned: true
Expand All @@ -40,7 +40,7 @@
end
end

context 'when compare new types' do
context 'when compare new types', condition: '< 6.0.0.beta2' do
subject { client }

before do
Expand Down Expand Up @@ -81,4 +81,46 @@
expect(delta.differ?).to be_falsey
end
end

context 'when compare new types', condition: '>= 6.0.0.beta2' do
subject { client }

before do
subject.diff(<<-RUBY).migrate
create_table "foos", force: :cascade do |t|
t.binary "blob"
t.binary "tiny_blob", size: :tiny
t.binary "medium_blob", size: :medium
t.binary "long_blob", size: :long
t.text "tiny_text", size: :tiny
t.text "medium_text", size: :medium
t.text "long_text", size: :long
t.decimal "unsigned_decimal", precision: 10, unsigned: true
t.float "unsigned_float", unsigned: true
t.bigint "unsigned_bigint", unsigned: true
t.integer "unsigned_integer", unsigned: true
end
RUBY
end

it do
delta = subject.diff(<<-RUBY)
create_table "foos", force: :cascade do |t|
t.binary "blob"
t.binary "tiny_blob", size: :tiny
t.binary "medium_blob", size: :medium
t.binary "long_blob", size: :long
t.text "tiny_text", size: :tiny
t.text "medium_text", size: :medium
t.text "long_text", size: :long
t.decimal "unsigned_decimal", precision: 10, unsigned: true
t.float "unsigned_float", unsigned: true
t.bigint "unsigned_bigint", unsigned: true
t.integer "unsigned_integer", unsigned: true
end
RUBY

expect(delta.differ?).to be_falsey
end
end
end

0 comments on commit 28b1973

Please sign in to comment.