nostalgic 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ require 'test_helper'
2
+
3
+ class CompanyTest < ActiveSupport::TestCase
4
+
5
+ end
@@ -2,14 +2,30 @@ require 'test_helper'
2
2
 
3
3
  class UserTest < ActiveSupport::TestCase
4
4
 
5
+ def test_belongs_to
6
+ assert @user = User.first
7
+ assert_equal 1, @user.company_id
8
+
9
+ today = Date.today
10
+ assert_equal 1, @user.company_on(today).id
11
+
12
+ @user.company_id = Company.second.id
13
+ @user.company_id_effective_at = today + 1.day
14
+ assert @user.save
15
+
16
+ @user.reload
17
+ assert_equal 1, @user.company.id
18
+ assert_equal 1, @user.company_on(nil).id
19
+ assert_equal 1, @user.company_on(today - 1.day).id
20
+ assert_equal 1, @user.company_on(today).id
21
+ assert_equal 2, @user.company_on(today + 1.day).id
22
+ end
23
+
5
24
  def test_tel
6
25
  assert @user = User.first
7
26
  assert_equal '222-123-4567', @user.tel
8
27
 
9
- assert_raise ArgumentError do
10
- @user.tel_at(nil)
11
- end
12
-
28
+ assert_equal '222-123-4567', @user.tel_at(nil)
13
29
  assert_equal '111-123-4567', @user.tel_at(Date.today - 1.day)
14
30
  assert_equal '222-123-4567', @user.tel_at(Date.today)
15
31
  assert_equal '333-123-4567', @user.tel_at(Date.today + 1.day)
@@ -0,0 +1,7 @@
1
+ 1:
2
+ id: 1
3
+ name: TestCompany001
4
+
5
+ 2:
6
+ id: 2
7
+ name: TestCompany002
@@ -19,3 +19,10 @@
19
19
  name: tel
20
20
  value: '333-123-4567'
21
21
  effective_at: <%= Date.today + 1.day %>
22
+ 4:
23
+ id: 4
24
+ model_type: User
25
+ model_id: 1
26
+ name: company_id
27
+ value: 1
28
+ effective_at: <%= Date.today - 1.day %>
@@ -1,4 +1,5 @@
1
1
  1:
2
2
  id: 1
3
+ company_id: 1
3
4
  email: test1@example.com
4
5
  tel: 222-123-4567
@@ -4,7 +4,7 @@ module Nostalgic
4
4
  class AttrTest < ActiveSupport::TestCase
5
5
 
6
6
  def test_nostalgic_model
7
- na = Nostalgic::Attr.new
7
+ Nostalgic::Attr.new
8
8
  end
9
9
 
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nostalgic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.7
19
+ version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 5.0.0
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 4.2.7
29
+ version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 5.0.0
@@ -76,16 +76,16 @@ dependencies:
76
76
  name: sqlite3
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: '1.3'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0'
88
+ version: '1.3'
89
89
  description: column versioning utility
90
90
  email:
91
91
  - ichylinux@gmail.com
@@ -105,6 +105,7 @@ files:
105
105
  - app/helpers/nostalgic/application_helper.rb
106
106
  - app/models/nostalgic/attr.rb
107
107
  - app/views/layouts/nostalgic/application.html.erb
108
+ - app/views/nostalgic/_collection_select.html.erb
108
109
  - app/views/nostalgic/_text_field.html.erb
109
110
  - config/routes.rb
110
111
  - db/migrate/20160807101438_create_nostalgic_attrs.rb
@@ -123,6 +124,7 @@ files:
123
124
  - test/dummy/app/assets/stylesheets/application.css
124
125
  - test/dummy/app/controllers/application_controller.rb
125
126
  - test/dummy/app/helpers/application_helper.rb
127
+ - test/dummy/app/models/company.rb
126
128
  - test/dummy/app/models/user.rb
127
129
  - test/dummy/app/views/layouts/application.html.erb
128
130
  - test/dummy/bin/bundle
@@ -150,6 +152,8 @@ files:
150
152
  - test/dummy/config/secrets.yml
151
153
  - test/dummy/db/development.sqlite3
152
154
  - test/dummy/db/migrate/20160807103323_create_users.rb
155
+ - test/dummy/db/migrate/20161217105723_create_companies.rb
156
+ - test/dummy/db/migrate/20161217105921_add_column_company_id_on_users.rb
153
157
  - test/dummy/db/schema.rb
154
158
  - test/dummy/db/test.sqlite3
155
159
  - test/dummy/log/development.log
@@ -158,7 +162,9 @@ files:
158
162
  - test/dummy/public/422.html
159
163
  - test/dummy/public/500.html
160
164
  - test/dummy/public/favicon.ico
165
+ - test/dummy/test/models/company_test.rb
161
166
  - test/dummy/test/models/user_test.rb
167
+ - test/fixtures/companies.yml
162
168
  - test/fixtures/nostalgic/attrs.yml
163
169
  - test/fixtures/users.yml
164
170
  - test/integration/navigation_test.rb
@@ -203,6 +209,7 @@ test_files:
203
209
  - test/dummy/app/helpers/application_helper.rb
204
210
  - test/dummy/app/views/layouts/application.html.erb
205
211
  - test/dummy/app/models/user.rb
212
+ - test/dummy/app/models/company.rb
206
213
  - test/dummy/bin/bundle
207
214
  - test/dummy/bin/rails
208
215
  - test/dummy/bin/rake
@@ -226,6 +233,8 @@ test_files:
226
233
  - test/dummy/config/boot.rb
227
234
  - test/dummy/config/database.yml
228
235
  - test/dummy/db/migrate/20160807103323_create_users.rb
236
+ - test/dummy/db/migrate/20161217105723_create_companies.rb
237
+ - test/dummy/db/migrate/20161217105921_add_column_company_id_on_users.rb
229
238
  - test/dummy/db/schema.rb
230
239
  - test/dummy/db/development.sqlite3
231
240
  - test/dummy/db/test.sqlite3
@@ -236,6 +245,8 @@ test_files:
236
245
  - test/dummy/public/500.html
237
246
  - test/dummy/public/favicon.ico
238
247
  - test/dummy/test/models/user_test.rb
248
+ - test/dummy/test/models/company_test.rb
239
249
  - test/models/nostalgic/attr_test.rb
240
250
  - test/fixtures/nostalgic/attrs.yml
241
251
  - test/fixtures/users.yml
252
+ - test/fixtures/companies.yml