enju_news 0.1.0.pre3 → 0.1.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/news_post.rb +6 -1
- data/lib/enju_news/engine.rb +1 -1
- data/lib/enju_news/version.rb +1 -1
- data/spec/cassette_library/NewsFeed/should_fetch_feeds.yml +496 -872
- data/spec/cassette_library/NewsFeed/should_get_content.yml +463 -806
- data/spec/cassette_library/NewsFeed/should_not_get_content_if_the_feed_is_invalid.yml +35 -68
- data/spec/cassette_library/NewsFeed/should_reload_content.yml +463 -806
- data/spec/dummy/app/controllers/application_controller.rb +2 -48
- data/spec/dummy/app/models/user.rb +5 -91
- data/spec/dummy/config/application.rb +1 -2
- data/spec/dummy/config/application.yml +42 -0
- data/spec/dummy/config/initializers/devise.rb +2 -0
- data/spec/dummy/db/migrate/059_create_libraries.rb +28 -0
- data/spec/dummy/db/migrate/069_create_shelves.rb +15 -0
- data/spec/dummy/db/migrate/080_create_library_groups.rb +1 -3
- data/spec/dummy/db/migrate/120_create_baskets.rb +12 -0
- data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +12 -0
- data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
- data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +17 -0
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +14 -0
- data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
- data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
- data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -8
- data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
- data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +12 -0
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -0
- data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
- data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +26 -0
- data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
- data/spec/dummy/db/schema.rb +185 -15
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/library.rb +13 -0
- data/spec/factories/user.rb +33 -11
- data/spec/fixtures/libraries.yml +102 -0
- data/spec/fixtures/user_groups.yml +45 -0
- data/spec/spec_helper.rb +16 -17
- metadata +96 -53
- data/lib/generators/enju_news/views_generator.rb +0 -18
- data/spec/dummy/app/models/library_group.rb +0 -86
- data/spec/dummy/app/models/role.rb +0 -46
- data/spec/dummy/app/models/user_group.rb +0 -40
- data/spec/dummy/app/models/user_has_role.rb +0 -5
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/lib/master_model.rb +0 -19
- data/spec/dummy/lib/url_validator.rb +0 -10
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,22 +11,97 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20130412083556) do
|
15
|
+
|
16
|
+
create_table "accepts", :force => true do |t|
|
17
|
+
t.integer "basket_id"
|
18
|
+
t.integer "item_id"
|
19
|
+
t.integer "librarian_id"
|
20
|
+
t.datetime "created_at", :null => false
|
21
|
+
t.datetime "updated_at", :null => false
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index "accepts", ["basket_id"], :name => "index_accepts_on_basket_id"
|
25
|
+
add_index "accepts", ["item_id"], :name => "index_accepts_on_item_id"
|
26
|
+
|
27
|
+
create_table "baskets", :force => true do |t|
|
28
|
+
t.integer "user_id"
|
29
|
+
t.text "note"
|
30
|
+
t.integer "lock_version", :default => 0, :null => false
|
31
|
+
t.datetime "created_at", :null => false
|
32
|
+
t.datetime "updated_at", :null => false
|
33
|
+
end
|
34
|
+
|
35
|
+
add_index "baskets", ["user_id"], :name => "index_baskets_on_user_id"
|
36
|
+
|
37
|
+
create_table "bookstores", :force => true do |t|
|
38
|
+
t.text "name", :null => false
|
39
|
+
t.string "zip_code"
|
40
|
+
t.text "address"
|
41
|
+
t.text "note"
|
42
|
+
t.string "telephone_number"
|
43
|
+
t.string "fax_number"
|
44
|
+
t.string "url"
|
45
|
+
t.integer "position"
|
46
|
+
t.datetime "deleted_at"
|
47
|
+
t.datetime "created_at", :null => false
|
48
|
+
t.datetime "updated_at", :null => false
|
49
|
+
end
|
50
|
+
|
51
|
+
create_table "budget_types", :force => true do |t|
|
52
|
+
t.string "name"
|
53
|
+
t.text "display_name"
|
54
|
+
t.text "note"
|
55
|
+
t.integer "position"
|
56
|
+
t.datetime "created_at", :null => false
|
57
|
+
t.datetime "updated_at", :null => false
|
58
|
+
end
|
59
|
+
|
60
|
+
create_table "libraries", :force => true do |t|
|
61
|
+
t.string "name", :null => false
|
62
|
+
t.text "display_name"
|
63
|
+
t.string "short_display_name", :null => false
|
64
|
+
t.string "zip_code"
|
65
|
+
t.text "street"
|
66
|
+
t.text "locality"
|
67
|
+
t.text "region"
|
68
|
+
t.string "telephone_number_1"
|
69
|
+
t.string "telephone_number_2"
|
70
|
+
t.string "fax_number"
|
71
|
+
t.text "note"
|
72
|
+
t.integer "call_number_rows", :default => 1, :null => false
|
73
|
+
t.string "call_number_delimiter", :default => "|", :null => false
|
74
|
+
t.integer "library_group_id", :default => 1, :null => false
|
75
|
+
t.integer "users_count", :default => 0, :null => false
|
76
|
+
t.integer "position"
|
77
|
+
t.integer "country_id"
|
78
|
+
t.datetime "created_at", :null => false
|
79
|
+
t.datetime "updated_at", :null => false
|
80
|
+
t.datetime "deleted_at"
|
81
|
+
t.string "isil"
|
82
|
+
t.float "latitude"
|
83
|
+
t.float "longitude"
|
84
|
+
t.text "opening_hour"
|
85
|
+
end
|
86
|
+
|
87
|
+
add_index "libraries", ["library_group_id"], :name => "index_libraries_on_library_group_id"
|
88
|
+
add_index "libraries", ["name"], :name => "index_libraries_on_name", :unique => true
|
15
89
|
|
16
90
|
create_table "library_groups", :force => true do |t|
|
17
|
-
t.string "name",
|
91
|
+
t.string "name", :null => false
|
18
92
|
t.text "display_name"
|
19
|
-
t.string "short_name",
|
93
|
+
t.string "short_name", :null => false
|
20
94
|
t.string "email"
|
21
95
|
t.text "my_networks"
|
22
|
-
t.boolean "use_dsbl",
|
96
|
+
t.boolean "use_dsbl", :default => false, :null => false
|
23
97
|
t.text "dsbl_list"
|
24
98
|
t.text "login_banner"
|
25
99
|
t.text "note"
|
26
100
|
t.integer "country_id"
|
27
|
-
t.datetime "created_at",
|
28
|
-
t.datetime "updated_at",
|
29
|
-
t.string "url",
|
101
|
+
t.datetime "created_at", :null => false
|
102
|
+
t.datetime "updated_at", :null => false
|
103
|
+
t.string "url", :default => "http://localhost:3000/"
|
104
|
+
t.text "admin_networks"
|
30
105
|
end
|
31
106
|
|
32
107
|
add_index "library_groups", ["short_name"], :name => "index_library_groups_on_short_name"
|
@@ -58,6 +133,24 @@ ActiveRecord::Schema.define(:version => 20111201163718) do
|
|
58
133
|
|
59
134
|
add_index "news_posts", ["user_id"], :name => "index_news_posts_on_user_id"
|
60
135
|
|
136
|
+
create_table "request_status_types", :force => true do |t|
|
137
|
+
t.string "name", :null => false
|
138
|
+
t.text "display_name"
|
139
|
+
t.text "note"
|
140
|
+
t.integer "position"
|
141
|
+
t.datetime "created_at", :null => false
|
142
|
+
t.datetime "updated_at", :null => false
|
143
|
+
end
|
144
|
+
|
145
|
+
create_table "request_types", :force => true do |t|
|
146
|
+
t.string "name", :null => false
|
147
|
+
t.text "display_name"
|
148
|
+
t.text "note"
|
149
|
+
t.integer "position"
|
150
|
+
t.datetime "created_at", :null => false
|
151
|
+
t.datetime "updated_at", :null => false
|
152
|
+
end
|
153
|
+
|
61
154
|
create_table "roles", :force => true do |t|
|
62
155
|
t.string "name"
|
63
156
|
t.text "display_name"
|
@@ -67,6 +160,61 @@ ActiveRecord::Schema.define(:version => 20111201163718) do
|
|
67
160
|
t.datetime "updated_at", :null => false
|
68
161
|
end
|
69
162
|
|
163
|
+
create_table "search_engines", :force => true do |t|
|
164
|
+
t.string "name", :null => false
|
165
|
+
t.text "display_name"
|
166
|
+
t.string "url", :null => false
|
167
|
+
t.text "base_url", :null => false
|
168
|
+
t.text "http_method", :null => false
|
169
|
+
t.text "query_param", :null => false
|
170
|
+
t.text "additional_param"
|
171
|
+
t.text "note"
|
172
|
+
t.integer "position"
|
173
|
+
t.datetime "created_at", :null => false
|
174
|
+
t.datetime "updated_at", :null => false
|
175
|
+
end
|
176
|
+
|
177
|
+
create_table "shelves", :force => true do |t|
|
178
|
+
t.string "name", :null => false
|
179
|
+
t.text "display_name"
|
180
|
+
t.text "note"
|
181
|
+
t.integer "library_id", :default => 1, :null => false
|
182
|
+
t.integer "items_count", :default => 0, :null => false
|
183
|
+
t.integer "position"
|
184
|
+
t.datetime "created_at", :null => false
|
185
|
+
t.datetime "updated_at", :null => false
|
186
|
+
t.datetime "deleted_at"
|
187
|
+
t.boolean "closed", :default => false, :null => false
|
188
|
+
end
|
189
|
+
|
190
|
+
add_index "shelves", ["library_id"], :name => "index_shelves_on_library_id"
|
191
|
+
|
192
|
+
create_table "subscribes", :force => true do |t|
|
193
|
+
t.integer "subscription_id", :null => false
|
194
|
+
t.integer "work_id", :null => false
|
195
|
+
t.datetime "start_at", :null => false
|
196
|
+
t.datetime "end_at", :null => false
|
197
|
+
t.datetime "created_at", :null => false
|
198
|
+
t.datetime "updated_at", :null => false
|
199
|
+
end
|
200
|
+
|
201
|
+
add_index "subscribes", ["subscription_id"], :name => "index_subscribes_on_subscription_id"
|
202
|
+
add_index "subscribes", ["work_id"], :name => "index_subscribes_on_work_id"
|
203
|
+
|
204
|
+
create_table "subscriptions", :force => true do |t|
|
205
|
+
t.text "title", :null => false
|
206
|
+
t.text "note"
|
207
|
+
t.integer "user_id"
|
208
|
+
t.integer "order_list_id"
|
209
|
+
t.datetime "deleted_at"
|
210
|
+
t.integer "subscribes_count", :default => 0, :null => false
|
211
|
+
t.datetime "created_at", :null => false
|
212
|
+
t.datetime "updated_at", :null => false
|
213
|
+
end
|
214
|
+
|
215
|
+
add_index "subscriptions", ["order_list_id"], :name => "index_subscriptions_on_order_list_id"
|
216
|
+
add_index "subscriptions", ["user_id"], :name => "index_subscriptions_on_user_id"
|
217
|
+
|
70
218
|
create_table "user_groups", :force => true do |t|
|
71
219
|
t.string "name"
|
72
220
|
t.string "string"
|
@@ -88,14 +236,6 @@ ActiveRecord::Schema.define(:version => 20111201163718) do
|
|
88
236
|
end
|
89
237
|
|
90
238
|
create_table "users", :force => true do |t|
|
91
|
-
t.integer "user_group_id"
|
92
|
-
t.integer "required_role_id"
|
93
|
-
t.string "username"
|
94
|
-
t.text "note"
|
95
|
-
t.string "locale"
|
96
|
-
t.string "user_number"
|
97
|
-
t.integer "library_id"
|
98
|
-
t.datetime "locked_at"
|
99
239
|
t.datetime "created_at", :null => false
|
100
240
|
t.datetime "updated_at", :null => false
|
101
241
|
t.string "email", :default => "", :null => false
|
@@ -108,9 +248,39 @@ ActiveRecord::Schema.define(:version => 20111201163718) do
|
|
108
248
|
t.datetime "last_sign_in_at"
|
109
249
|
t.string "current_sign_in_ip"
|
110
250
|
t.string "last_sign_in_ip"
|
251
|
+
t.string "username"
|
252
|
+
t.string "user_number"
|
253
|
+
t.string "state"
|
254
|
+
t.string "locale"
|
255
|
+
t.datetime "deleted_at"
|
256
|
+
t.datetime "expired_at"
|
257
|
+
t.integer "library_id", :default => 1, :null => false
|
258
|
+
t.integer "required_role_id", :default => 1, :null => false
|
259
|
+
t.integer "user_group_id", :default => 1, :null => false
|
260
|
+
t.text "note"
|
261
|
+
t.text "keyword_list"
|
262
|
+
t.integer "failed_attempts"
|
263
|
+
t.string "unlock_token"
|
264
|
+
t.datetime "locked_at"
|
265
|
+
t.datetime "confirmed_at"
|
111
266
|
end
|
112
267
|
|
113
268
|
add_index "users", ["email"], :name => "index_users_on_email"
|
114
269
|
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
270
|
+
add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
|
271
|
+
add_index "users", ["user_group_id"], :name => "index_users_on_user_group_id"
|
272
|
+
add_index "users", ["user_number"], :name => "index_users_on_user_number", :unique => true
|
273
|
+
add_index "users", ["username"], :name => "index_users_on_username", :unique => true
|
274
|
+
|
275
|
+
create_table "versions", :force => true do |t|
|
276
|
+
t.string "item_type", :null => false
|
277
|
+
t.integer "item_id", :null => false
|
278
|
+
t.string "event", :null => false
|
279
|
+
t.string "whodunnit"
|
280
|
+
t.text "object"
|
281
|
+
t.datetime "created_at"
|
282
|
+
end
|
283
|
+
|
284
|
+
add_index "versions", ["item_type", "item_id"], :name => "index_versions_on_item_type_and_item_id"
|
115
285
|
|
116
286
|
end
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :library do |f|
|
3
|
+
f.sequence(:name){|n| "library#{n}"}
|
4
|
+
f.sequence(:short_display_name){|n| "library_#{n}"}
|
5
|
+
f.library_group_id{LibraryGroup.first.id}
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
FactoryGirl.define do
|
10
|
+
factory :invalid_library, :class => Library do |f|
|
11
|
+
f.library_group_id{LibraryGroup.first.id}
|
12
|
+
end
|
13
|
+
end
|
data/spec/factories/user.rb
CHANGED
@@ -2,34 +2,56 @@ FactoryGirl.define do
|
|
2
2
|
factory :admin, :class => User do |f|
|
3
3
|
f.sequence(:username){|n| "admin_#{n}"}
|
4
4
|
f.sequence(:email){|n| "admin_#{n}@example.jp"}
|
5
|
-
f.
|
5
|
+
f.email_confirmation{|u| u.email}
|
6
|
+
f.library_id{FactoryGirl.create(:library).id}
|
6
7
|
f.password 'adminpassword'
|
7
8
|
f.password_confirmation 'adminpassword'
|
8
|
-
f.
|
9
|
-
f.
|
10
|
-
f.
|
9
|
+
f.user_group_id{UserGroup.where(:name => 'User').first.id}
|
10
|
+
f.required_role_id{Role.find_by_name('User').id}
|
11
|
+
f.locale 'ja'
|
12
|
+
f.after(:create) do |user|
|
13
|
+
user_has_role = UserHasRole.new
|
14
|
+
user_has_role.assign_attributes({:user_id => user.id, :role_id => Role.find_by_name('Administrator').id})
|
15
|
+
user_has_role.save
|
16
|
+
user.reload
|
17
|
+
end
|
11
18
|
end
|
12
19
|
|
13
20
|
factory :librarian, :class => User do |f|
|
14
21
|
f.sequence(:username){|n| "librarian_#{n}"}
|
15
22
|
f.sequence(:email){|n| "librarian_#{n}@example.jp"}
|
16
|
-
f.
|
23
|
+
f.email_confirmation{|u| u.email}
|
24
|
+
f.library_id{FactoryGirl.create(:library).id}
|
17
25
|
f.password 'librarianpassword'
|
18
26
|
f.password_confirmation 'librarianpassword'
|
19
|
-
f.
|
20
|
-
f.
|
21
|
-
f.
|
27
|
+
f.user_group_id{UserGroup.where(:name => 'User').first.id}
|
28
|
+
f.required_role_id{Role.find_by_name('User').id}
|
29
|
+
f.locale 'ja'
|
30
|
+
f.after(:create) do |user|
|
31
|
+
user_has_role = UserHasRole.new
|
32
|
+
user_has_role.assign_attributes({:user_id => user.id, :role_id => Role.find_by_name('Librarian').id})
|
33
|
+
user_has_role.save
|
34
|
+
user.reload
|
35
|
+
end
|
22
36
|
end
|
23
37
|
|
24
38
|
factory :user, :class => User do |f|
|
25
39
|
f.sequence(:username){|n| "user_#{n}"}
|
26
40
|
f.sequence(:email){|n| "user_#{n}@example.jp"}
|
27
|
-
f.
|
41
|
+
f.email_confirmation{|u| u.email}
|
42
|
+
f.library_id{FactoryGirl.create(:library).id}
|
28
43
|
f.password 'userpassword'
|
29
44
|
f.password_confirmation 'userpassword'
|
30
|
-
f.
|
31
|
-
f.
|
45
|
+
f.user_group_id{UserGroup.where(:name => 'not_specified').first.id}
|
46
|
+
f.required_role_id{Role.find_by_name('User').id}
|
47
|
+
f.locale 'ja'
|
32
48
|
f.sequence(:user_number){|n| "user_number_#{n}"}
|
49
|
+
f.after(:create) do |user|
|
50
|
+
user_has_role = UserHasRole.new
|
51
|
+
user_has_role.assign_attributes({:user_id => user.id, :role_id => Role.find_by_name('User').id})
|
52
|
+
user_has_role.save
|
53
|
+
user.reload
|
54
|
+
end
|
33
55
|
end
|
34
56
|
|
35
57
|
factory :invalid_user, :class => User do |f|
|
@@ -0,0 +1,102 @@
|
|
1
|
+
---
|
2
|
+
library_00001:
|
3
|
+
name: web
|
4
|
+
short_display_name: Web
|
5
|
+
display_name: World Wide Web
|
6
|
+
fax_number:
|
7
|
+
updated_at: 2007-08-31 00:18:06.662349 +09:00
|
8
|
+
telephone_number_1:
|
9
|
+
telephone_number_2:
|
10
|
+
id: 1
|
11
|
+
zip_code:
|
12
|
+
region:
|
13
|
+
locality:
|
14
|
+
street:
|
15
|
+
created_at: 2007-08-13 18:10:00 +09:00
|
16
|
+
library_group_id: 1
|
17
|
+
call_number_delimiter: "|"
|
18
|
+
position: 1
|
19
|
+
library_00002:
|
20
|
+
name: kamata
|
21
|
+
short_display_name: 蒲田
|
22
|
+
display_name: Kamata Library
|
23
|
+
fax_number: ""
|
24
|
+
updated_at: 2007-08-31 00:18:06.662349 +09:00
|
25
|
+
telephone_number_1: 81-3-3732-5111
|
26
|
+
telephone_number_2: ""
|
27
|
+
id: 2
|
28
|
+
zip_code: 144-8535
|
29
|
+
region: Tokyo
|
30
|
+
locality:
|
31
|
+
street:
|
32
|
+
created_at: 2007-08-13 18:10:00 +09:00
|
33
|
+
library_group_id: 1
|
34
|
+
call_number_delimiter: "|"
|
35
|
+
position: 2
|
36
|
+
isil: "JP-0000000"
|
37
|
+
library_00003:
|
38
|
+
name: hachioji
|
39
|
+
short_display_name: 八王子
|
40
|
+
display_name: Hachioji Library
|
41
|
+
fax_number: 042-637-2116
|
42
|
+
updated_at: 2007-08-31 00:18:16.188285 +09:00
|
43
|
+
telephone_number_1: 042-637-2033
|
44
|
+
telephone_number_2: ""
|
45
|
+
id: 3
|
46
|
+
zip_code: 192-0982
|
47
|
+
region: Tokyo
|
48
|
+
locality: Hachioji
|
49
|
+
street:
|
50
|
+
created_at: 2007-08-14 16:37:00 +09:00
|
51
|
+
library_group_id: 1
|
52
|
+
call_number_delimiter: "|"
|
53
|
+
position: 3
|
54
|
+
library_00004:
|
55
|
+
name: mita
|
56
|
+
short_display_name: 三田
|
57
|
+
display_name: Mita Library
|
58
|
+
fax_number: ""
|
59
|
+
updated_at: 2007-08-31 00:18:20.043951 +09:00
|
60
|
+
telephone_number_1: ""
|
61
|
+
telephone_number_2: ""
|
62
|
+
id: 4
|
63
|
+
zip_code: 108-8345
|
64
|
+
region: Tokyo
|
65
|
+
locality: Minato
|
66
|
+
street:
|
67
|
+
created_at: 2007-08-23 19:51:00 +09:00
|
68
|
+
library_group_id: 1
|
69
|
+
call_number_delimiter: "|"
|
70
|
+
position: 4
|
71
|
+
|
72
|
+
# == Schema Information
|
73
|
+
#
|
74
|
+
# Table name: libraries
|
75
|
+
#
|
76
|
+
# id :integer not null, primary key
|
77
|
+
# name :string(255) not null
|
78
|
+
# display_name :text
|
79
|
+
# short_display_name :string(255) not null
|
80
|
+
# zip_code :string(255)
|
81
|
+
# street :text
|
82
|
+
# locality :text
|
83
|
+
# region :text
|
84
|
+
# telephone_number_1 :string(255)
|
85
|
+
# telephone_number_2 :string(255)
|
86
|
+
# fax_number :string(255)
|
87
|
+
# note :text
|
88
|
+
# call_number_rows :integer default(1), not null
|
89
|
+
# call_number_delimiter :string(255) default("|"), not null
|
90
|
+
# library_group_id :integer default(1), not null
|
91
|
+
# users_count :integer default(0), not null
|
92
|
+
# position :integer
|
93
|
+
# country_id :integer
|
94
|
+
# created_at :datetime not null
|
95
|
+
# updated_at :datetime not null
|
96
|
+
# deleted_at :datetime
|
97
|
+
# opening_hour :text
|
98
|
+
# latitude :float
|
99
|
+
# longitude :float
|
100
|
+
# isil :string(255)
|
101
|
+
#
|
102
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
user_group_00001:
|
3
|
+
name: not_specified
|
4
|
+
display_name: (not specified)
|
5
|
+
updated_at: 2007-12-13 21:00:51.564542 +09:00
|
6
|
+
id: 1
|
7
|
+
note: ""
|
8
|
+
created_at: 2007-12-13 21:00:01.674976 +09:00
|
9
|
+
position: 1
|
10
|
+
valid_period_for_new_user: 0
|
11
|
+
user_group_00002:
|
12
|
+
name: User
|
13
|
+
display_name: User
|
14
|
+
updated_at: 2007-12-23 03:14:56.836548 +09:00
|
15
|
+
id: 2
|
16
|
+
note: ""
|
17
|
+
created_at: 2007-12-23 03:14:40.173954 +09:00
|
18
|
+
position: 2
|
19
|
+
valid_period_for_new_user: 365
|
20
|
+
user_group_00003:
|
21
|
+
name: Faculty
|
22
|
+
display_name: Faculty
|
23
|
+
updated_at: 2007-12-23 03:15:05.134351 +09:00
|
24
|
+
id: 3
|
25
|
+
note: ""
|
26
|
+
created_at: 2007-12-23 03:15:05.126457 +09:00
|
27
|
+
position: 3
|
28
|
+
valid_period_for_new_user: 730
|
29
|
+
|
30
|
+
# == Schema Information
|
31
|
+
#
|
32
|
+
# Table name: user_groups
|
33
|
+
#
|
34
|
+
# id :integer not null, primary key
|
35
|
+
# name :string(255)
|
36
|
+
# display_name :text
|
37
|
+
# note :text
|
38
|
+
# position :integer
|
39
|
+
# created_at :datetime not null
|
40
|
+
# updated_at :datetime not null
|
41
|
+
# deleted_at :datetime
|
42
|
+
# valid_period_for_new_user :integer default(0), not null
|
43
|
+
# expired_at :datetime
|
44
|
+
#
|
45
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
2
|
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("
|
3
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
4
4
|
require 'rspec/rails'
|
5
|
-
require 'rspec/autorun'
|
6
|
-
require 'factory_girl'
|
7
5
|
require 'vcr'
|
6
|
+
require 'factory_girl'
|
7
|
+
require 'sunspot-rails-tester'
|
8
8
|
|
9
9
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
10
|
# in spec/support/ and its subdirectories.
|
11
11
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
|
-
#Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
13
12
|
|
14
13
|
RSpec.configure do |config|
|
15
|
-
#
|
14
|
+
# == Mock Framework
|
16
15
|
#
|
17
16
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
18
17
|
#
|
19
18
|
# config.mock_with :mocha
|
20
19
|
# config.mock_with :flexmock
|
21
20
|
# config.mock_with :rr
|
21
|
+
config.mock_with :rspec
|
22
22
|
|
23
23
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
24
24
|
config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
|
@@ -27,21 +27,20 @@ RSpec.configure do |config|
|
|
27
27
|
# examples within a transaction, remove the following line or assign false
|
28
28
|
# instead of true.
|
29
29
|
config.use_transactional_fixtures = true
|
30
|
+
config.extend ControllerMacros, :type => :controller
|
30
31
|
|
31
|
-
|
32
|
-
# automatically. This will be the default behavior in future versions of
|
33
|
-
# rspec-rails.
|
34
|
-
config.infer_base_class_for_anonymous_controllers = false
|
32
|
+
$original_sunspot_session = Sunspot.session
|
35
33
|
|
36
|
-
config.
|
34
|
+
config.before do
|
35
|
+
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
|
36
|
+
end
|
37
|
+
|
38
|
+
config.before :each, :solr => true do
|
39
|
+
Sunspot::Rails::Tester.start_original_sunspot_session
|
40
|
+
Sunspot.session = $original_sunspot_session
|
41
|
+
Sunspot.remove_all!
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
45
|
FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
|
40
46
|
FactoryGirl.find_definitions
|
41
|
-
|
42
|
-
VCR.configure do |c|
|
43
|
-
c.cassette_library_dir = 'spec/cassette_library'
|
44
|
-
c.hook_into :fakeweb
|
45
|
-
c.configure_rspec_metadata!
|
46
|
-
c.allow_http_connections_when_no_cassette = true
|
47
|
-
end
|