declare_schema 0.8.0.pre.5 → 0.8.0.pre.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8a020c30e79336f89851e73eaabbb8dcdfd2affed27883e7d4fe06944f76436
4
- data.tar.gz: e17f1fe94f3dc8188469df87679ee09c955765f2a5ac45354928e6664c026bae
3
+ metadata.gz: 3d3ceea8167afc532a38353f4bdac36fc805762dd2c8f2bf5fdb7895e7fc9886
4
+ data.tar.gz: 766a96c62aad5a6360c12a74a2630d52d6ee4c08b44ceeb3dd7309251886ce14
5
5
  SHA512:
6
- metadata.gz: ccf0846c28e2e0a7d20db08d3ad925fc22d7ed1d5a3cb2f75df3585ce4b42a00663f2550b17ce648d9a86e7e58a7d0a367f43ef21138f6fc838ea8f4b39ec8db
7
- data.tar.gz: a5fa4637da88f364ec303ebe0d615e6e0e99caef81e7965d753cf04d8cb33b787efef874ef5b71db3e6a0f1f850087b617a7f6f811cc9fc8d307f7d01562da25
6
+ metadata.gz: d9de9bb8b90e978d745b5832ce81553d1156e10810f30304a347dd5e591ccd55fa086982ea32f349634cc1a8ff34fad3798d94ccfcd1fe3351be1f9e5a1f9648
7
+ data.tar.gz: 7b569604b9dc7f0ca2b8a8c36ffaede21a85e5f0ca13e39291823cfdf41a7b2f3ee00dedb7dd93e4ddd589a266dee75909f9b33bcb084c1e8929086216dbdee9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- declare_schema (0.8.0.pre.5)
4
+ declare_schema (0.8.0.pre.6)
5
5
  rails (>= 4.2)
6
6
 
7
7
  GEM
@@ -44,6 +44,8 @@ module DeclareSchema
44
44
  if ActiveRecord::Base.connection.class.name.match?(/mysql/i)
45
45
  types[:text][:limit] ||= 0xffff
46
46
  types[:binary][:limit] ||= 0xffff
47
+
48
+ types[:varbinary] ||= { name: "varbinary" } # TODO: :varbinary is an Invoca addition to Rails; make it a configurable option
47
49
  end
48
50
  end
49
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeclareSchema
4
- VERSION = "0.8.0.pre.5"
4
+ VERSION = "0.8.0.pre.6"
5
5
  end
@@ -83,37 +83,44 @@ RSpec.describe DeclareSchema::Model::FieldSpec do
83
83
  expect(subject.schema_attributes(col_spec)).to eq(type: :text, null: true, default: 'none')
84
84
  end
85
85
  end
86
+ end
86
87
 
87
- describe 'decimal' do
88
- it 'allows precision: and scale:' do
89
- subject = described_class.new(model, :quantity, :decimal, precision: 8, scale: 10, null: true, position: 3)
90
- expect(subject.schema_attributes(col_spec)).to eq(type: :decimal, precision: 8, scale: 10, null: true)
91
- end
88
+ describe 'varbinary' do # TODO: :varbinary is an Invoca addition to Rails; make it a configurable option
89
+ it 'is supported' do
90
+ subject = described_class.new(model, :binary_dump, :varbinary, limit: 200, null: false, position: 2)
91
+ expect(subject.schema_attributes(col_spec)).to eq(type: :varbinary, limit: 200, null: false)
92
+ end
93
+ end
92
94
 
93
- it 'requires precision:' do
94
- expect_any_instance_of(described_class).to receive(:warn).with(/precision: required for :decimal type/)
95
- described_class.new(model, :quantity, :decimal, scale: 10, null: true, position: 3)
96
- end
95
+ describe 'decimal' do
96
+ it 'allows precision: and scale:' do
97
+ subject = described_class.new(model, :quantity, :decimal, precision: 8, scale: 10, null: true, position: 3)
98
+ expect(subject.schema_attributes(col_spec)).to eq(type: :decimal, precision: 8, scale: 10, null: true)
99
+ end
97
100
 
98
- it 'requires scale:' do
99
- expect_any_instance_of(described_class).to receive(:warn).with(/scale: required for :decimal type/)
100
- described_class.new(model, :quantity, :decimal, precision: 8, null: true, position: 3)
101
- end
101
+ it 'requires precision:' do
102
+ expect_any_instance_of(described_class).to receive(:warn).with(/precision: required for :decimal type/)
103
+ described_class.new(model, :quantity, :decimal, scale: 10, null: true, position: 3)
102
104
  end
103
105
 
104
- [:integer, :bigint, :string, :text, :binary, :datetime, :date, :time].each do |t|
105
- describe t.to_s do
106
- let(:extra) { t == :string ? { limit: 100 } : {} }
106
+ it 'requires scale:' do
107
+ expect_any_instance_of(described_class).to receive(:warn).with(/scale: required for :decimal type/)
108
+ described_class.new(model, :quantity, :decimal, precision: 8, null: true, position: 3)
109
+ end
110
+ end
111
+
112
+ [:integer, :bigint, :string, :text, :binary, :varbinary, :datetime, :date, :time].each do |t|
113
+ describe t.to_s do
114
+ let(:extra) { t == :string ? { limit: 100 } : {} }
107
115
 
108
- it 'does not allow precision:' do
109
- expect_any_instance_of(described_class).to receive(:warn).with(/precision: only allowed for :decimal type/)
110
- described_class.new(model, :quantity, t, { precision: 8, null: true, position: 3 }.merge(extra))
111
- end unless t == :datetime
116
+ it 'does not allow precision:' do
117
+ expect_any_instance_of(described_class).to receive(:warn).with(/precision: only allowed for :decimal type/)
118
+ described_class.new(model, :quantity, t, { precision: 8, null: true, position: 3 }.merge(extra))
119
+ end unless t == :datetime
112
120
 
113
- it 'does not allow scale:' do
114
- expect_any_instance_of(described_class).to receive(:warn).with(/scale: only allowed for :decimal type/)
115
- described_class.new(model, :quantity, t, { scale: 10, null: true, position: 3 }.merge(extra))
116
- end
121
+ it 'does not allow scale:' do
122
+ expect_any_instance_of(described_class).to receive(:warn).with(/scale: only allowed for :decimal type/)
123
+ described_class.new(model, :quantity, t, { scale: 10, null: true, position: 3 }.merge(extra))
117
124
  end
118
125
  end
119
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: declare_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.pre.5
4
+ version: 0.8.0.pre.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca Development adapted from hobo_fields by Tom Locke