flex_columns 1.0.7 → 1.0.8
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 +15 -7
- data/.travis.yml +20 -10
- data/CHANGES.md +7 -0
- data/README.md +74 -66
- data/lib/flex_columns/definition/flex_column_contents_class.rb +6 -13
- data/lib/flex_columns/version.rb +1 -1
- data/spec/flex_columns/helpers/database_helper.rb +1 -1
- data/spec/flex_columns/system/basic_system_spec.rb +1 -1
- data/spec/flex_columns/system/migrations_system_spec.rb +88 -0
- data/spec/flex_columns/unit/definition/flex_column_contents_class_spec.rb +7 -9
- metadata +155 -77
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NjQzNTM5OWZhMTAyMjU0NjFlOGFkMDc4NGIxZTE3YTk0OGJlMjY5ZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjUwOWIzNWU2Zjc3NGQxZWU5MDlmNjI2ZjIxNWFlOTViMWIzYmI4OQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjE2MGVlNDIwN2Y5ZWQ0NGM0MzdkODJhMTIzNDQ5MWU0OTBiN2Q5OGEwOTQz
|
10
|
+
YzFiNDFhOTA1NTUwYzZiNGJkMzc4OWJhNDQ4ODU4OGQ2OGRhMTg4ZjhiOWM3
|
11
|
+
YmNkYjExMzgwMDk2NWUxM2QyMjBkOWM4OWVlNDFkMjJmYzMxMjY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWE4MDdlNzlkYWU2M2YzODg0ZDUzN2U5OGM4NDlkYTBlMDgyMjdiYTVlZDM3
|
14
|
+
YWM0MzhjYjg3YzFiOTRhNmVhYjg2M2UyYjI3MTdkMjMxODJkOGQwNmZlOTIx
|
15
|
+
OWZmZTQyYjg5NTI0Mjc5ZDk0MWVlN2YzYmYyODhjMmRlNjE4ZmI=
|
data/.travis.yml
CHANGED
@@ -2,7 +2,8 @@ rvm:
|
|
2
2
|
- "1.8.7"
|
3
3
|
- "1.9.3"
|
4
4
|
- "2.0.0"
|
5
|
-
- "
|
5
|
+
- "2.1.2"
|
6
|
+
- "jruby-1.7.12"
|
6
7
|
env:
|
7
8
|
- FLEX_COLUMNS_AR_TEST_VERSION=3.0.20 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
8
9
|
- FLEX_COLUMNS_AR_TEST_VERSION=3.0.20 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
@@ -10,12 +11,15 @@ env:
|
|
10
11
|
- FLEX_COLUMNS_AR_TEST_VERSION=3.1.12 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
11
12
|
- FLEX_COLUMNS_AR_TEST_VERSION=3.1.12 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
12
13
|
- FLEX_COLUMNS_AR_TEST_VERSION=3.1.12 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
13
|
-
- FLEX_COLUMNS_AR_TEST_VERSION=3.2.
|
14
|
-
- FLEX_COLUMNS_AR_TEST_VERSION=3.2.
|
15
|
-
- FLEX_COLUMNS_AR_TEST_VERSION=3.2.
|
16
|
-
- FLEX_COLUMNS_AR_TEST_VERSION=4.0.
|
17
|
-
- FLEX_COLUMNS_AR_TEST_VERSION=4.0.
|
18
|
-
- FLEX_COLUMNS_AR_TEST_VERSION=4.0.
|
14
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=3.2.19 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
15
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=3.2.19 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
16
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=3.2.19 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
17
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=4.0.8 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
18
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=4.0.8 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
19
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=4.0.8 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
20
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=4.1.4 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
21
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=4.1.4 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
22
|
+
- FLEX_COLUMNS_AR_TEST_VERSION=4.1.4 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
19
23
|
before_script:
|
20
24
|
- mysql -e 'create database myapp_test;'
|
21
25
|
- psql -c 'create database myapp_test;' -U postgres
|
@@ -23,11 +27,17 @@ matrix:
|
|
23
27
|
exclude:
|
24
28
|
# ActiveRecord 4.x doesn't support Ruby 1.8.7
|
25
29
|
- rvm: 1.8.7
|
26
|
-
env: FLEX_COLUMNS_AR_TEST_VERSION=4.0.
|
30
|
+
env: FLEX_COLUMNS_AR_TEST_VERSION=4.0.8 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
27
31
|
- rvm: 1.8.7
|
28
|
-
env: FLEX_COLUMNS_AR_TEST_VERSION=4.0.
|
32
|
+
env: FLEX_COLUMNS_AR_TEST_VERSION=4.0.8 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
29
33
|
- rvm: 1.8.7
|
30
|
-
env: FLEX_COLUMNS_AR_TEST_VERSION=4.0.
|
34
|
+
env: FLEX_COLUMNS_AR_TEST_VERSION=4.0.8 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
35
|
+
- rvm: 1.8.7
|
36
|
+
env: FLEX_COLUMNS_AR_TEST_VERSION=4.1.4 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
37
|
+
- rvm: 1.8.7
|
38
|
+
env: FLEX_COLUMNS_AR_TEST_VERSION=4.1.4 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
39
|
+
- rvm: 1.8.7
|
40
|
+
env: FLEX_COLUMNS_AR_TEST_VERSION=4.1.4 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
31
41
|
# There's a bug in ActiveRecord 3.1.x that makes it incompatible with Ruby 2.0
|
32
42
|
- rvm: 2.0.0
|
33
43
|
env: FLEX_COLUMNS_AR_TEST_VERSION=3.1.12 FLEX_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# `flex_columns` Changelog
|
2
2
|
|
3
|
+
## 1.0.8, 2014-07-06
|
4
|
+
|
5
|
+
* Fixed an issue where you couldn't migrate a flex_column into existence with a migration — because if you
|
6
|
+
declared a flex_column on a table that existed but a column that didn't, you would get an exception
|
7
|
+
(`FlexColumns::Errors::NoSuchColumnError`) immediately.
|
8
|
+
* Bumped versions of Rails and Ruby that we test against to much more up-to-date ones.
|
9
|
+
|
3
10
|
## 1.0.7, 2014-04-07
|
4
11
|
|
5
12
|
* Fixed an issue where, if you defined a model class when its table didn't exist, and then created its table while the Ruby process was still running, you still couldn't access any flex-column attributes — because we would simply skip defining them entirely if the table didn't exist. Now, we define them, assuming the columns exist and are of type `:string` (and `null`able) if the table doesn't exist, and replace them with the actual column definition once the table exists. (You need to call `.reset_column_information` on the model class to make this happen, just as you do with any changes to the underlying table of an ActiveRecord model.)
|
data/README.md
CHANGED
@@ -11,101 +11,109 @@ while relying on the most reliable, manageable, proven data engines out there.
|
|
11
11
|
|
12
12
|
Supported platforms:
|
13
13
|
|
14
|
-
* Ruby 1.8.7, 1.9.3, 2.0.0, and JRuby 1.7.
|
15
|
-
* ActiveRecord 3.0.20, 3.1.12, 3.2.
|
14
|
+
* Ruby 1.8.7, 1.9.3, 2.0.0, 2.1.2, and JRuby 1.7.12.
|
15
|
+
* ActiveRecord 3.0.20, 3.1.12, 3.2.19, 4.0.8, and 4.1.4. (Should be compatible with future versions, as well...just sits on top of the public API of ActiveRecord.)
|
16
16
|
* Tested against MySQL, PostgreSQL, and SQLite 3. (Should be compatible with all RDBMSes supported by ActiveRecord.)
|
17
17
|
|
18
18
|
Current build status: 
|
19
19
|
|
20
20
|
### Installing flex_columns
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
```ruby
|
23
|
+
# Gemfile
|
24
|
+
gem 'flex_columns'
|
25
|
+
```
|
24
26
|
|
25
27
|
### Example
|
26
28
|
|
27
29
|
As an example — assume table `users` has a `CLOB` column `user_attributes`:
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
```ruby
|
32
|
+
class User < ActiveRecord::Base
|
33
|
+
...
|
34
|
+
flex_column :user_attributes do
|
35
|
+
field :locale
|
36
|
+
field :comments_display_mode
|
37
|
+
field :custom_page_color
|
38
|
+
field :nickname
|
39
|
+
end
|
40
|
+
...
|
41
|
+
end
|
42
|
+
```
|
39
43
|
|
40
44
|
You can now write code like:
|
41
45
|
|
42
|
-
|
43
|
-
|
46
|
+
```ruby
|
47
|
+
user = User.find(...)
|
48
|
+
user.locale = :fr_FR
|
44
49
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
50
|
+
case user.comments_display_mode
|
51
|
+
when 'threaded' then ...
|
52
|
+
when 'linear' then ...
|
53
|
+
end
|
54
|
+
```
|
49
55
|
|
50
56
|
### Robust Example
|
51
57
|
|
52
58
|
As a snapshot of all possibilities:
|
53
59
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
# +super+ works correctly in all cases
|
80
|
-
def visit_count
|
81
|
-
super || 0
|
82
|
-
end
|
83
|
-
|
84
|
-
# You can also access attributes using Hash syntax
|
85
|
-
def increment_visit_count!
|
86
|
-
self[:visit_count] += 1
|
87
|
-
end
|
88
|
-
end
|
60
|
+
```ruby
|
61
|
+
# Assume we're storing the JSON in a wholly separate table, so we don't have to load it unless we need it...
|
62
|
+
class UserDetails < ActiveRecord::Base
|
63
|
+
flex_column :user_attributes,
|
64
|
+
:compress => 100, # try compressing any JSON >= 100 bytes, but only store compressed if it's smaller
|
65
|
+
:visibility => :private, # attributes are private by default
|
66
|
+
:prefix => :ua, # sets a prefix for methods delegated from the outer class
|
67
|
+
:unknown_fields => :delete # if DB contains fields not declared here, delete those keys when saving
|
68
|
+
do
|
69
|
+
# automatically adds validations requiring a string that's non-nil
|
70
|
+
field :locale, :string, :null => false
|
71
|
+
# automatically adds validations requiring the value to be one of the listed values
|
72
|
+
field :comments_display_mode, :enum => %w{threaded linear collapsed}
|
73
|
+
# in the JSON in the database, the key will be 'cpc', not 'custom_page_color', to save space
|
74
|
+
field :custom_page_color, :json => :cpc
|
75
|
+
field :nickname
|
76
|
+
field :visit_count, :integer
|
77
|
+
|
78
|
+
# Use the full gamut of Rails validations -- they will run automatically when saving a User
|
79
|
+
validates :custom_page_color, :format => { :with => /^\#[0-9a-f]{6}/i, :message => 'must be a valid HTML hex color' }
|
80
|
+
|
81
|
+
# Define custom methods...
|
82
|
+
def french?
|
83
|
+
[ :fr_FR, :fr_CA ].include?(locale)
|
89
84
|
end
|
90
85
|
|
91
|
-
#
|
92
|
-
|
93
|
-
|
86
|
+
# +super+ works correctly in all cases
|
87
|
+
def visit_count
|
88
|
+
super || 0
|
89
|
+
end
|
94
90
|
|
95
|
-
|
91
|
+
# You can also access attributes using Hash syntax
|
92
|
+
def increment_visit_count!
|
93
|
+
self[:visit_count] += 1
|
96
94
|
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# And now transparently include it into our User class...
|
99
|
+
class User < ActiveRecord::Base
|
100
|
+
has_one :user_details
|
101
|
+
|
102
|
+
include_flex_columns_from :user_details
|
103
|
+
end
|
97
104
|
|
98
105
|
...and then you can write code like so:
|
99
106
|
|
100
|
-
|
107
|
+
user = User.find(...)
|
101
108
|
|
102
|
-
|
103
|
-
|
109
|
+
user.user_attributes.french? # access directly from the column
|
110
|
+
user.ua_visit_count # :prefix prefixed the delegated method names with the desired string
|
104
111
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
112
|
+
user.visit_count = 'foo' # sets an invalid value
|
113
|
+
user.save # => false; user isn't valid
|
114
|
+
user.errors.keys # => :'user_attributes.visit_count'
|
115
|
+
user.errors[:'user_attributes.visit_count'] # => [ 'must be a number' ]
|
116
|
+
```
|
109
117
|
|
110
118
|
There's lots more, too:
|
111
119
|
|
@@ -274,22 +274,15 @@ module FlexColumns
|
|
274
274
|
# Given the name of a column, finds the column on the model and makes sure it complies with our
|
275
275
|
# requirements for columns we can store data in.
|
276
276
|
#
|
277
|
-
# However, if the underlying table doesn't currently exist,
|
278
|
-
# this fake column object
|
279
|
-
# used so that we can define flex columns on a model for
|
280
|
-
# hasn't been migrated in yet), and effectively upgrade
|
281
|
-
# does exist.
|
277
|
+
# However, if the underlying table doesn't currently exist, or the underlying column doesn't currently exit,
|
278
|
+
# this creates a "fake" column object and returns it; this fake column object responds to just enough methods
|
279
|
+
# that we can use it successfully in this gem. This is used so that we can define flex columns on a model for
|
280
|
+
# a table that doesn't exist yet (typically, because it hasn't been migrated in yet), and effectively upgrade
|
281
|
+
# it using .reset_column_information, above, when it does exist.
|
282
282
|
def find_column(column_name)
|
283
283
|
return create_temporary_fake_column(column_name) if (! @model_class.table_exists?)
|
284
|
-
|
285
284
|
out = model_class.columns.detect { |c| c.name.to_s == column_name.to_s }
|
286
|
-
|
287
|
-
raise FlexColumns::Errors::NoSuchColumnError, %{You're trying to define a flex column #{column_name.inspect}, but
|
288
|
-
the model you're defining it on, #{model_class.name}, seems to have no column
|
289
|
-
named that.
|
290
|
-
|
291
|
-
It has columns named: #{model_class.columns.map(&:name).sort_by(&:to_s).join(", ")}.}
|
292
|
-
end
|
285
|
+
return create_temporary_fake_column(column_name) if (! out)
|
293
286
|
|
294
287
|
unless out.type == :binary || out.text? || out.sql_type == "json" # for PostgreSQL >= 9.2, which has a native JSON data type
|
295
288
|
raise FlexColumns::Errors::InvalidColumnTypeError, %{You're trying to define a flex column #{column_name.inspect}, but
|
data/lib/flex_columns/version.rb
CHANGED
@@ -155,7 +155,7 @@ module FlexColumns
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def invalid_config_file!
|
158
|
-
raise
|
158
|
+
raise InvalidDatabaseConfigurationError, %{In order to run specs for FlexColumns, you need to create a file at:
|
159
159
|
|
160
160
|
#{config_file_path}
|
161
161
|
|
@@ -280,7 +280,7 @@ describe "FlexColumns basic operations" do
|
|
280
280
|
user.name = 'User 1'
|
281
281
|
user.wants_email = [ 1, 2, 3 ]
|
282
282
|
|
283
|
-
user_json = JSON.dump(user)
|
283
|
+
user_json = JSON.dump(user.as_json)
|
284
284
|
parsed = JSON.parse(user_json)
|
285
285
|
|
286
286
|
# ActiveRecord::Base.include_root_in_json may default to different things in different versions of
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'flex_columns'
|
2
|
+
require 'flex_columns/helpers/system_helpers'
|
3
|
+
|
4
|
+
describe "FlexColumns support for migrations" do
|
5
|
+
include FlexColumns::Helpers::SystemHelpers
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
@dh = FlexColumns::Helpers::DatabaseHelper.new
|
9
|
+
@dh.setup_activerecord!
|
10
|
+
end
|
11
|
+
|
12
|
+
after :each do
|
13
|
+
migrate do
|
14
|
+
drop_table :flexcols_spec_nonexistent_col rescue nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should not raise an error if a flex_column is declared for a column that doesn't exist on a model (yet)" do
|
19
|
+
migrate do
|
20
|
+
drop_table :flexcols_spec_nonexistent_col rescue nil
|
21
|
+
create_table :flexcols_spec_nonexistent_col do |t|
|
22
|
+
t.string :name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
define_model_class(:Nonexistent, 'flexcols_spec_nonexistent_col') do
|
27
|
+
flex_column :something do
|
28
|
+
field :some_data
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
n1 = ::Nonexistent.new
|
33
|
+
n1.name = "foo"
|
34
|
+
n1.save!
|
35
|
+
|
36
|
+
expect(n1.some_data).to be_nil
|
37
|
+
expect(n1.something.some_data).to be_nil
|
38
|
+
|
39
|
+
n1_again = ::Nonexistent.find(n1.id)
|
40
|
+
expect(n1_again.name).to eq("foo")
|
41
|
+
|
42
|
+
expect(n1_again.some_data).to be_nil
|
43
|
+
expect(n1_again.something.some_data).to be_nil
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should let you migrate a column into existence and have it work" do
|
47
|
+
migrate do
|
48
|
+
drop_table :flexcols_spec_nonexistent_col rescue nil
|
49
|
+
create_table :flexcols_spec_nonexistent_col do |t|
|
50
|
+
t.string :name
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
define_model_class(:Nonexistent, 'flexcols_spec_nonexistent_col') do
|
55
|
+
flex_column :something do
|
56
|
+
field :some_data
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
n1 = ::Nonexistent.new
|
61
|
+
n1.name = "foo"
|
62
|
+
n1.save!
|
63
|
+
|
64
|
+
expect(n1.some_data).to be_nil
|
65
|
+
expect(n1.something.some_data).to be_nil
|
66
|
+
|
67
|
+
n1_again = ::Nonexistent.find(n1.id)
|
68
|
+
expect(n1_again.name).to eq("foo")
|
69
|
+
|
70
|
+
expect(n1_again.some_data).to be_nil
|
71
|
+
expect(n1_again.something.some_data).to be_nil
|
72
|
+
|
73
|
+
migrate do
|
74
|
+
add_column :flexcols_spec_nonexistent_col, :something, :text
|
75
|
+
end
|
76
|
+
|
77
|
+
::Nonexistent.reset_column_information
|
78
|
+
|
79
|
+
n2 = ::Nonexistent.new
|
80
|
+
n2.name = "bar"
|
81
|
+
n2.some_data = "some_data for bar"
|
82
|
+
n2.save!
|
83
|
+
|
84
|
+
n2_again = ::Nonexistent.find(n2.id)
|
85
|
+
expect(n2_again.name).to eq("bar")
|
86
|
+
expect(n2_again.some_data).to eq("some_data for bar")
|
87
|
+
end
|
88
|
+
end
|
@@ -106,15 +106,6 @@ describe FlexColumns::Definition::FlexColumnContentsClass do
|
|
106
106
|
lambda { @klass.setup!(@model_class, 'foo') { } }.should raise_error(ArgumentError)
|
107
107
|
end
|
108
108
|
|
109
|
-
it "should raise a nice error if passed something that isn't a column on the model" do
|
110
|
-
e = capture_exception(FlexColumns::Errors::NoSuchColumnError) { @klass.setup!(@model_class, :unknowncolumn) { } }
|
111
|
-
e.message.should match(/quux/i)
|
112
|
-
e.message.should match(/foo/i)
|
113
|
-
e.message.should match(/bar/i)
|
114
|
-
e.message.should match(/baz/i)
|
115
|
-
e.message.should match(/mcname/i)
|
116
|
-
end
|
117
|
-
|
118
109
|
it "should raise a nice error if passed a column of the wrong type" do
|
119
110
|
e = capture_exception(FlexColumns::Errors::InvalidColumnTypeError) { @klass.setup!(@model_class, :baz) { } }
|
120
111
|
e.message.should match(/mcname/i)
|
@@ -128,6 +119,13 @@ describe FlexColumns::Definition::FlexColumnContentsClass do
|
|
128
119
|
@klass.setup!(@model_class, :foo) { }
|
129
120
|
end
|
130
121
|
|
122
|
+
it "should work if the column doesn't exist" do
|
123
|
+
allow(@model_class).to receive(:table_exists?).with().and_return(true)
|
124
|
+
allow(@model_class).to receive(:columns).and_return([ @column_bar, @column_baz, @column_quux, @column_ajson ])
|
125
|
+
|
126
|
+
@klass.setup!(@model_class, :foo) { }
|
127
|
+
end
|
128
|
+
|
131
129
|
it "should work on a text column" do
|
132
130
|
@klass.setup!(@model_class, :foo) { }
|
133
131
|
end
|
metadata
CHANGED
@@ -1,99 +1,174 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: flex_columns
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Andrew Geweke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
15
14
|
name: json
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
23
20
|
type: :runtime
|
24
|
-
version_requirements: *id001
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: bundler
|
27
21
|
prerelease: false
|
28
|
-
|
29
|
-
requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
30
31
|
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
33
34
|
type: :development
|
34
|
-
version_requirements: *id002
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rake
|
37
35
|
prerelease: false
|
38
|
-
|
39
|
-
requirements:
|
40
|
-
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
41
48
|
type: :development
|
42
|
-
|
43
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
44
56
|
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.14'
|
62
|
+
type: :development
|
45
63
|
prerelease: false
|
46
|
-
|
47
|
-
requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
48
66
|
- - ~>
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version:
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.14'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-debugger
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
51
90
|
type: :development
|
52
|
-
version_requirements: *id005
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: activerecord
|
55
91
|
prerelease: false
|
56
|
-
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-stack_explorer
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activerecord
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
61
118
|
- - <=
|
62
|
-
- !ruby/object:Gem::Version
|
119
|
+
- !ruby/object:Gem::Version
|
63
120
|
version: 4.99.99
|
64
121
|
type: :runtime
|
65
|
-
version_requirements: *id006
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: activesupport
|
68
122
|
prerelease: false
|
69
|
-
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version:
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '3.0'
|
128
|
+
- - <=
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 4.99.99
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: activesupport
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '3.0'
|
74
138
|
- - <=
|
75
|
-
- !ruby/object:Gem::Version
|
139
|
+
- !ruby/object:Gem::Version
|
76
140
|
version: 4.99.99
|
77
141
|
type: :runtime
|
78
|
-
version_requirements: *id007
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: mysql2
|
81
142
|
prerelease: false
|
82
|
-
|
83
|
-
requirements:
|
84
|
-
-
|
143
|
+
version_requirements: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '3.0'
|
148
|
+
- - <=
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 4.99.99
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: mysql2
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
85
158
|
type: :development
|
86
|
-
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ! '>='
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
87
165
|
description: Schema-free, structured JSON storage inside a RDBMS.
|
88
|
-
email:
|
166
|
+
email:
|
89
167
|
- andrew@geweke.org
|
90
168
|
executables: []
|
91
|
-
|
92
169
|
extensions: []
|
93
|
-
|
94
170
|
extra_rdoc_files: []
|
95
|
-
|
96
|
-
files:
|
171
|
+
files:
|
97
172
|
- .gitignore
|
98
173
|
- .travis.yml
|
99
174
|
- CHANGES.md
|
@@ -128,6 +203,7 @@ files:
|
|
128
203
|
- spec/flex_columns/system/error_handling_system_spec.rb
|
129
204
|
- spec/flex_columns/system/including_system_spec.rb
|
130
205
|
- spec/flex_columns/system/json_alias_system_spec.rb
|
206
|
+
- spec/flex_columns/system/migrations_system_spec.rb
|
131
207
|
- spec/flex_columns/system/performance_system_spec.rb
|
132
208
|
- spec/flex_columns/system/postgres_json_column_type_system_spec.rb
|
133
209
|
- spec/flex_columns/system/types_system_spec.rb
|
@@ -146,29 +222,30 @@ files:
|
|
146
222
|
- spec/flex_columns/unit/util/dynamic_methods_module_spec.rb
|
147
223
|
- spec/flex_columns/unit/util/string_utils_spec.rb
|
148
224
|
homepage: https://github.com/ageweke/flex_columns
|
149
|
-
licenses:
|
225
|
+
licenses:
|
150
226
|
- MIT
|
151
227
|
metadata: {}
|
152
|
-
|
153
228
|
post_install_message:
|
154
229
|
rdoc_options: []
|
155
|
-
|
156
|
-
require_paths:
|
230
|
+
require_paths:
|
157
231
|
- lib
|
158
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
-
requirements:
|
160
|
-
-
|
161
|
-
|
162
|
-
|
163
|
-
|
232
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ! '>='
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
|
+
requirements:
|
239
|
+
- - ! '>='
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: '0'
|
164
242
|
requirements: []
|
165
|
-
|
166
243
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.2.2
|
168
245
|
signing_key:
|
169
246
|
specification_version: 4
|
170
247
|
summary: Schema-free, structured JSON storage inside a RDBMS.
|
171
|
-
test_files:
|
248
|
+
test_files:
|
172
249
|
- spec/flex_columns/helpers/database_helper.rb
|
173
250
|
- spec/flex_columns/helpers/exception_helpers.rb
|
174
251
|
- spec/flex_columns/helpers/system_helpers.rb
|
@@ -181,6 +258,7 @@ test_files:
|
|
181
258
|
- spec/flex_columns/system/error_handling_system_spec.rb
|
182
259
|
- spec/flex_columns/system/including_system_spec.rb
|
183
260
|
- spec/flex_columns/system/json_alias_system_spec.rb
|
261
|
+
- spec/flex_columns/system/migrations_system_spec.rb
|
184
262
|
- spec/flex_columns/system/performance_system_spec.rb
|
185
263
|
- spec/flex_columns/system/postgres_json_column_type_system_spec.rb
|
186
264
|
- spec/flex_columns/system/types_system_spec.rb
|