enju_library 0.1.0.pre6 → 0.1.0.pre7

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.
Files changed (67) hide show
  1. data/app/controllers/accepts_controller.rb +83 -0
  2. data/app/models/accept.rb +37 -0
  3. data/app/models/basket.rb +63 -0
  4. data/app/models/library.rb +2 -2
  5. data/app/models/library_group.rb +0 -1
  6. data/app/models/shelf.rb +1 -1
  7. data/app/views/accepts/_form.html.erb +11 -0
  8. data/app/views/accepts/_list.html.erb +31 -0
  9. data/app/views/accepts/edit.html.erb +13 -0
  10. data/app/views/accepts/index.csv.erb +4 -0
  11. data/app/views/accepts/index.html.erb +49 -0
  12. data/app/views/accepts/index.js.erb +1 -0
  13. data/app/views/accepts/new.html.erb +14 -0
  14. data/app/views/accepts/show.html.erb +31 -0
  15. data/config/locales/en.yml +86 -0
  16. data/config/locales/ja.yml +86 -0
  17. data/config/routes.rb +5 -0
  18. data/db/migrate/080_create_library_groups.rb +0 -1
  19. data/db/migrate/120_create_baskets.rb +12 -0
  20. data/db/migrate/20120319173203_create_accepts.rb +14 -0
  21. data/lib/enju_library/engine.rb +2 -0
  22. data/lib/enju_library/version.rb +1 -1
  23. data/spec/controllers/accepts_controller_spec.rb +304 -0
  24. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  25. data/spec/dummy/app/models/ability.rb +2 -0
  26. data/spec/dummy/config/application.rb +4 -2
  27. data/spec/dummy/db/migrate/033_create_checkouts.rb +25 -0
  28. data/spec/dummy/db/migrate/132_create_circulation_statuses.rb +16 -0
  29. data/spec/dummy/db/migrate/20081030023412_create_checkout_types.rb +17 -0
  30. data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +25 -0
  31. data/spec/dummy/db/migrate/20110328130826_add_current_checkout_count_to_user_group_has_checkout_type.rb +9 -0
  32. data/spec/dummy/db/migrate/20121119153944_add_manifestation_id_to_item.rb +5 -0
  33. data/spec/dummy/db/schema.rb +83 -1
  34. data/spec/dummy/db/test.sqlite3 +0 -0
  35. data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
  36. data/spec/factories/accepts.rb +9 -0
  37. data/spec/factories/basket.rb +5 -0
  38. data/spec/factories/item.rb +7 -0
  39. data/spec/fixtures/baskets.yml +80 -0
  40. data/spec/fixtures/checkout_types.yml +34 -0
  41. data/spec/fixtures/checkouts.yml +163 -0
  42. data/spec/fixtures/circulation_statuses.yml +106 -0
  43. data/spec/fixtures/exemplifies.yml +160 -0
  44. data/spec/fixtures/items.yml +259 -0
  45. data/spec/models/accept_spec.rb +23 -0
  46. data/spec/models/basket_spec.rb +25 -0
  47. data/spec/models/library_group_spec.rb +6 -0
  48. data/spec/routing/accepts_routing_spec.rb +27 -0
  49. data/spec/spec_helper.rb +3 -0
  50. data/spec/views/accepts/edit.html.erb_spec.rb +18 -0
  51. data/spec/views/accepts/index.html.erb_spec.rb +27 -0
  52. data/spec/views/accepts/new.html.erb_spec.rb +31 -0
  53. data/spec/views/accepts/show.html.erb_spec.rb +17 -0
  54. metadata +140 -55
  55. data/spec/dummy/db/development.sqlite3 +0 -0
  56. data/spec/dummy/solr/data/test/index/_38.fdt +0 -0
  57. data/spec/dummy/solr/data/test/index/_38.fdx +0 -0
  58. data/spec/dummy/solr/data/test/index/_38.fnm +0 -3
  59. data/spec/dummy/solr/data/test/index/_38.frq +0 -1
  60. data/spec/dummy/solr/data/test/index/_38.nrm +0 -1
  61. data/spec/dummy/solr/data/test/index/_38.prx +0 -0
  62. data/spec/dummy/solr/data/test/index/_38.tii +0 -0
  63. data/spec/dummy/solr/data/test/index/_38.tis +0 -0
  64. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  65. data/spec/dummy/solr/data/test/index/segments_7f +0 -0
  66. data/spec/dummy/solr/data/test/spellchecker/segments.gen +0 -0
  67. data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
@@ -0,0 +1,304 @@
1
+ require 'spec_helper'
2
+
3
+ describe AcceptsController do
4
+ fixtures :all
5
+
6
+ def mock_user(stubs={})
7
+ (@mock_user ||= mock_model(Accept).as_null_object).tap do |user|
8
+ user.stub(stubs) unless stubs.empty?
9
+ end
10
+ end
11
+
12
+ describe "GET index" do
13
+ describe "When logged in as Administrator" do
14
+ login_fixture_admin
15
+
16
+ it "assigns all accepts as @accepts" do
17
+ get :index
18
+ assigns(:accepts).should_not be_nil
19
+ response.should be_success
20
+ end
21
+
22
+ describe "When basket_id is specified" do
23
+ it "assigns all accepts as @accepts" do
24
+ get :index, :basket_id => 10
25
+ assigns(:accepts).should eq Basket.find(10).accepts.page(1)
26
+ response.should be_success
27
+ end
28
+ end
29
+ end
30
+
31
+ describe "When logged in as Librarian" do
32
+ login_fixture_librarian
33
+
34
+ it "assigns all accepts as @accepts" do
35
+ get :index
36
+ assigns(:accepts).should_not be_nil
37
+ response.should be_success
38
+ end
39
+
40
+ describe "When basket_id is specified" do
41
+ it "assigns all accepts as @accepts" do
42
+ get :index, :basket_id => 9
43
+ assigns(:accepts).should eq Basket.find(9).accepts.page(1)
44
+ response.should be_success
45
+ end
46
+ end
47
+ end
48
+
49
+ describe "When logged in as User" do
50
+ login_fixture_user
51
+
52
+ it "should not assign all accepts as @accepts" do
53
+ get :index
54
+ assigns(:accepts).should be_nil
55
+ response.should be_forbidden
56
+ end
57
+ end
58
+ end
59
+
60
+ describe "GET show" do
61
+ describe "When logged in as Administrator" do
62
+ login_fixture_admin
63
+
64
+ it "assigns the requested accept as @accept" do
65
+ accept = FactoryGirl.create(:accept)
66
+ get :show, :id => accept.id
67
+ assigns(:accept).should eq(accept)
68
+ end
69
+
70
+ it "should not show missing accept" do
71
+ get :show, :id => 'missing'
72
+ response.should be_missing
73
+ end
74
+ end
75
+
76
+ describe "When logged in as Librarian" do
77
+ login_fixture_librarian
78
+
79
+ it "assigns the requested accept as @accept" do
80
+ accept = FactoryGirl.create(:accept)
81
+ get :show, :id => accept.id
82
+ assigns(:accept).should eq(accept)
83
+ end
84
+ end
85
+
86
+ describe "When logged in as User" do
87
+ login_fixture_user
88
+
89
+ it "assigns the requested accept as @accept" do
90
+ accept = FactoryGirl.create(:accept)
91
+ get :show, :id => accept.id
92
+ assigns(:accept).should eq(accept)
93
+ response.should be_forbidden
94
+ end
95
+ end
96
+
97
+ describe "When not logged in" do
98
+ it "assigns the requested accept as @accept" do
99
+ accept = FactoryGirl.create(:accept)
100
+ get :show, :id => accept.id
101
+ assigns(:accept).should eq(accept)
102
+ response.should redirect_to new_user_session_url
103
+ end
104
+ end
105
+ end
106
+
107
+ describe "GET new" do
108
+ describe "When logged in as Administrator" do
109
+ login_fixture_admin
110
+
111
+ it "assigns the requested accept as @accept" do
112
+ get :new
113
+ assigns(:accept).should_not be_valid
114
+ end
115
+ end
116
+
117
+ describe "When logged in as Librarian" do
118
+ login_fixture_librarian
119
+
120
+ it "assigns the requested accept as @accept" do
121
+ get :new
122
+ assigns(:accept).should_not be_valid
123
+ end
124
+ end
125
+
126
+ describe "When logged in as User" do
127
+ login_fixture_user
128
+
129
+ it "should not assign the requested accept as @accept" do
130
+ get :new
131
+ assigns(:accept).should_not be_valid
132
+ response.should be_forbidden
133
+ end
134
+ end
135
+
136
+ describe "When not logged in" do
137
+ it "should not assign the requested accept as @accept" do
138
+ get :new
139
+ assigns(:accept).should_not be_valid
140
+ response.should redirect_to(new_user_session_url)
141
+ end
142
+ end
143
+ end
144
+
145
+ describe "POST create" do
146
+ before(:each) do
147
+ @attrs = {:item_identifier => '00003'}
148
+ @invalid_attrs = {:item_identifier => 'invalid'}
149
+ end
150
+
151
+ describe "When logged in as Administrator" do
152
+ login_fixture_admin
153
+
154
+ describe "with valid params" do
155
+ it "assigns a newly created accept as @accept" do
156
+ post :create, :accept => @attrs
157
+ assigns(:accept).should_not be_valid
158
+ end
159
+
160
+ it "should not create a new accept without basket_id" do
161
+ post :create, :accept => @attrs
162
+ response.should be_forbidden
163
+ end
164
+
165
+ describe "When basket_id is specified" do
166
+ it "redirects to the created accept" do
167
+ post :create, :accept => @attrs, :basket_id => 9
168
+ response.should redirect_to(basket_accepts_url(assigns(:accept).basket))
169
+ assigns(:accept).item.circulation_status.name.should eq 'Available On Shelf'
170
+ end
171
+ end
172
+ end
173
+
174
+ describe "with invalid params" do
175
+ it "assigns a newly created but unsaved accept as @accept" do
176
+ post :create, :accept => @invalid_attrs
177
+ assigns(:accept).should_not be_valid
178
+ end
179
+
180
+ it "should be forbidden" do
181
+ post :create, :accept => @invalid_attrs
182
+ response.should be_forbidden
183
+ end
184
+ end
185
+
186
+ it "should not create accept without item_id" do
187
+ post :create, :accept => {:item_identifier => nil}, :basket_id => 9
188
+ assigns(:accept).should_not be_valid
189
+ response.should be_success
190
+ end
191
+ end
192
+
193
+ describe "When logged in as Librarian" do
194
+ login_fixture_librarian
195
+
196
+ describe "with valid params" do
197
+ it "assigns a newly created accept as @accept" do
198
+ post :create, :accept => @attrs
199
+ assigns(:accept).should_not be_valid
200
+ end
201
+
202
+ it "should not create a new accept without basket_id" do
203
+ post :create, :accept => @attrs
204
+ response.should be_forbidden
205
+ end
206
+ end
207
+ end
208
+
209
+ describe "When logged in as User" do
210
+ login_fixture_user
211
+
212
+ describe "with valid params" do
213
+ it "assigns a newly created accept as @accept" do
214
+ post :create, :accept => @attrs
215
+ assigns(:accept).should_not be_valid
216
+ end
217
+
218
+ it "should be forbidden" do
219
+ post :create, :accept => @attrs
220
+ response.should be_forbidden
221
+ end
222
+ end
223
+ end
224
+
225
+ describe "When not logged in" do
226
+ before(:each) do
227
+ @attrs = {:item_identifier => '00003'}
228
+ @invalid_attrs = {:item_identifier => 'invalid'}
229
+ end
230
+
231
+ describe "with valid params" do
232
+ it "assigns a newly created accept as @accept" do
233
+ post :create, :accept => @attrs
234
+ end
235
+
236
+ it "should redirect to new session url" do
237
+ post :create, :accept => @attrs
238
+ response.should redirect_to new_user_session_url
239
+ end
240
+ end
241
+ end
242
+ end
243
+
244
+ describe "DELETE destroy" do
245
+ before(:each) do
246
+ @accept = FactoryGirl.create(:accept)
247
+ end
248
+
249
+ describe "When logged in as Administrator" do
250
+ login_fixture_admin
251
+
252
+ it "destroys the requested accept" do
253
+ delete :destroy, :id => @accept.id
254
+ end
255
+
256
+ it "redirects to the accepts list" do
257
+ delete :destroy, :id => @accept.id
258
+ response.should redirect_to(accepts_url)
259
+ end
260
+
261
+ it "should not destroy missing accept" do
262
+ delete :destroy, :id => 'missing'
263
+ response.should be_missing
264
+ end
265
+ end
266
+
267
+ describe "When logged in as Librarian" do
268
+ login_fixture_librarian
269
+
270
+ it "destroys the requested accept" do
271
+ delete :destroy, :id => @accept.id
272
+ end
273
+
274
+ it "redirects to the accepts list" do
275
+ delete :destroy, :id => @accept.id
276
+ response.should redirect_to(accepts_url)
277
+ end
278
+ end
279
+
280
+ describe "When logged in as User" do
281
+ login_fixture_user
282
+
283
+ it "destroys the requested accept" do
284
+ delete :destroy, :id => @accept.id
285
+ end
286
+
287
+ it "should be forbidden" do
288
+ delete :destroy, :id => @accept.id
289
+ response.should be_forbidden
290
+ end
291
+ end
292
+
293
+ describe "When not logged in" do
294
+ it "destroys the requested accept" do
295
+ delete :destroy, :id => @accept.id
296
+ end
297
+
298
+ it "should be forbidden" do
299
+ delete :destroy, :id => @accept.id
300
+ response.should redirect_to(new_user_session_url)
301
+ end
302
+ end
303
+ end
304
+ end
@@ -1,4 +1,6 @@
1
1
  module ApplicationHelper
2
+ include EnjuBiblio::BiblioHelper
3
+
2
4
  def back_to_index(options = {})
3
5
  if options == nil
4
6
  options = {}
@@ -4,6 +4,7 @@ class Ability
4
4
  def initialize(user, ip_address = nil)
5
5
  case user.try(:role).try(:name)
6
6
  when 'Administrator'
7
+ can :manage, Accept
7
8
  can [:read, :create, :update], Bookstore
8
9
  can :manage, BudgetType
9
10
  can :destroy, Bookstore do |bookstore|
@@ -28,6 +29,7 @@ class Ability
28
29
  can :manage, Subscribe
29
30
  can :manage, Subscription
30
31
  when 'Librarian'
32
+ can :manage, Accept
31
33
  can :read, Bookstore
32
34
  can :read, BudgetType
33
35
  can :read, Library
@@ -4,6 +4,8 @@ require 'rails/all'
4
4
 
5
5
  Bundler.require
6
6
  require "enju_library"
7
+ require "enju_event"
8
+ require "enju_inter_library_loan"
7
9
 
8
10
  module Dummy
9
11
  class Application < Rails::Application
@@ -55,6 +57,6 @@ module Dummy
55
57
  end
56
58
 
57
59
  require 'enju_biblio'
58
- require 'mobile-fu'
59
- require 'RedCloth'
60
+ require 'enju_circulation'
60
61
  require 'enju_manifestation_viewer'
62
+ require 'RedCloth'
@@ -0,0 +1,25 @@
1
+ class CreateCheckouts < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :checkouts do |t|
4
+ t.integer :user_id
5
+ t.integer :item_id, :null => false
6
+ t.integer :checkin_id
7
+ t.integer :librarian_id
8
+ t.integer :basket_id
9
+ t.datetime :due_date
10
+ t.integer :checkout_renewal_count, :default => 0, :null => false
11
+ t.integer :lock_version, :default => 0, :null => false
12
+ t.timestamps
13
+ end
14
+ add_index :checkouts, :user_id
15
+ add_index :checkouts, :item_id
16
+ add_index :checkouts, :basket_id
17
+ add_index :checkouts, [:item_id, :basket_id], :unique => true
18
+ add_index :checkouts, :librarian_id
19
+ add_index :checkouts, :checkin_id
20
+ end
21
+
22
+ def self.down
23
+ drop_table :checkouts
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ class CreateCirculationStatuses < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :circulation_statuses do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :circulation_statuses
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ class CreateCheckoutTypes < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :checkout_types do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :checkout_types, :name
12
+ end
13
+
14
+ def self.down
15
+ drop_table :checkout_types
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ class CreateUserGroupHasCheckoutTypes < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :user_group_has_checkout_types do |t|
4
+ t.integer :user_group_id, :null => false
5
+ t.integer :checkout_type_id, :null => false
6
+ t.integer :checkout_limit, :default => 0, :null => false
7
+ t.integer :checkout_period, :default => 0, :null => false
8
+ t.integer :checkout_renewal_limit, :default => 0, :null => false
9
+ t.integer :reservation_limit, :default => 0, :null => false
10
+ t.integer :reservation_expired_period, :default => 7, :null => false
11
+ t.boolean :set_due_date_before_closing_day, :default => false, :null => false
12
+ t.datetime :fixed_due_date
13
+ t.text :note
14
+ t.integer :position
15
+
16
+ t.timestamps
17
+ end
18
+ add_index :user_group_has_checkout_types, :user_group_id
19
+ add_index :user_group_has_checkout_types, :checkout_type_id
20
+ end
21
+
22
+ def self.down
23
+ drop_table :user_group_has_checkout_types
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ class AddCurrentCheckoutCountToUserGroupHasCheckoutType < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :user_group_has_checkout_types, :current_checkout_count, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :user_group_has_checkout_types, :current_checkout_count
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddManifestationIdToItem < ActiveRecord::Migration
2
+ def change
3
+ add_column :items, :manifestation_id, :integer
4
+ end
5
+ end
@@ -11,7 +11,28 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20120510140958) do
14
+ ActiveRecord::Schema.define(:version => 20121119153944) 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"
15
36
 
16
37
  create_table "bookstores", :force => true do |t|
17
38
  t.text "name", :null => false
@@ -45,6 +66,46 @@ ActiveRecord::Schema.define(:version => 20120510140958) do
45
66
  t.datetime "updated_at", :null => false
46
67
  end
47
68
 
69
+ create_table "checkout_types", :force => true do |t|
70
+ t.string "name", :null => false
71
+ t.text "display_name"
72
+ t.text "note"
73
+ t.integer "position"
74
+ t.datetime "created_at", :null => false
75
+ t.datetime "updated_at", :null => false
76
+ end
77
+
78
+ add_index "checkout_types", ["name"], :name => "index_checkout_types_on_name"
79
+
80
+ create_table "checkouts", :force => true do |t|
81
+ t.integer "user_id"
82
+ t.integer "item_id", :null => false
83
+ t.integer "checkin_id"
84
+ t.integer "librarian_id"
85
+ t.integer "basket_id"
86
+ t.datetime "due_date"
87
+ t.integer "checkout_renewal_count", :default => 0, :null => false
88
+ t.integer "lock_version", :default => 0, :null => false
89
+ t.datetime "created_at", :null => false
90
+ t.datetime "updated_at", :null => false
91
+ end
92
+
93
+ add_index "checkouts", ["basket_id"], :name => "index_checkouts_on_basket_id"
94
+ add_index "checkouts", ["checkin_id"], :name => "index_checkouts_on_checkin_id"
95
+ add_index "checkouts", ["item_id", "basket_id"], :name => "index_checkouts_on_item_id_and_basket_id", :unique => true
96
+ add_index "checkouts", ["item_id"], :name => "index_checkouts_on_item_id"
97
+ add_index "checkouts", ["librarian_id"], :name => "index_checkouts_on_librarian_id"
98
+ add_index "checkouts", ["user_id"], :name => "index_checkouts_on_user_id"
99
+
100
+ create_table "circulation_statuses", :force => true do |t|
101
+ t.string "name", :null => false
102
+ t.text "display_name"
103
+ t.text "note"
104
+ t.integer "position"
105
+ t.datetime "created_at", :null => false
106
+ t.datetime "updated_at", :null => false
107
+ end
108
+
48
109
  create_table "countries", :force => true do |t|
49
110
  t.string "name", :null => false
50
111
  t.text "display_name"
@@ -124,6 +185,7 @@ ActiveRecord::Schema.define(:version => 20120510140958) do
124
185
  t.integer "required_score", :default => 0, :null => false
125
186
  t.datetime "acquired_at"
126
187
  t.integer "bookstore_id"
188
+ t.integer "manifestation_id"
127
189
  end
128
190
 
129
191
  add_index "items", ["bookstore_id"], :name => "index_items_on_bookstore_id"
@@ -579,6 +641,26 @@ ActiveRecord::Schema.define(:version => 20120510140958) do
579
641
  add_index "subscriptions", ["order_list_id"], :name => "index_subscriptions_on_order_list_id"
580
642
  add_index "subscriptions", ["user_id"], :name => "index_subscriptions_on_user_id"
581
643
 
644
+ create_table "user_group_has_checkout_types", :force => true do |t|
645
+ t.integer "user_group_id", :null => false
646
+ t.integer "checkout_type_id", :null => false
647
+ t.integer "checkout_limit", :default => 0, :null => false
648
+ t.integer "checkout_period", :default => 0, :null => false
649
+ t.integer "checkout_renewal_limit", :default => 0, :null => false
650
+ t.integer "reservation_limit", :default => 0, :null => false
651
+ t.integer "reservation_expired_period", :default => 7, :null => false
652
+ t.boolean "set_due_date_before_closing_day", :default => false, :null => false
653
+ t.datetime "fixed_due_date"
654
+ t.text "note"
655
+ t.integer "position"
656
+ t.datetime "created_at", :null => false
657
+ t.datetime "updated_at", :null => false
658
+ t.integer "current_checkout_count"
659
+ end
660
+
661
+ add_index "user_group_has_checkout_types", ["checkout_type_id"], :name => "index_user_group_has_checkout_types_on_checkout_type_id"
662
+ add_index "user_group_has_checkout_types", ["user_group_id"], :name => "index_user_group_has_checkout_types_on_user_group_id"
663
+
582
664
  create_table "user_groups", :force => true do |t|
583
665
  t.string "name"
584
666
  t.string "string"
Binary file
@@ -0,0 +1,9 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :accept do
5
+ basket_id{FactoryGirl.create(:basket).id}
6
+ item_id{FactoryGirl.create(:item).id}
7
+ librarian_id{FactoryGirl.create(:librarian).id}
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :basket do |f|
3
+ f.user_id{FactoryGirl.create(:user).id}
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+ factory :item do |f|
3
+ f.sequence(:item_identifier){|n| "item_#{n}"}
4
+ f.circulation_status_id{CirculationStatus.find(1).id} if defined?(EnjuCircuation)
5
+ f.manifestation_id{FactoryGirl.create(:manifestation).id}
6
+ end
7
+ end
@@ -0,0 +1,80 @@
1
+ ---
2
+ basket_00001:
3
+ updated_at: 2008-01-21 17:21:58.554146 +09:00
4
+ id: 1
5
+ note:
6
+ user_id: 1
7
+ created_at: 2008-01-21 17:21:58.554146 +09:00
8
+ basket_00002:
9
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
10
+ id: 2
11
+ note:
12
+ user_id: 2
13
+ created_at: 2008-01-21 17:26:14.585596 +09:00
14
+ basket_00003:
15
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
16
+ id: 3
17
+ note:
18
+ user_id: 3
19
+ created_at: 2008-01-21 17:26:14.585596 +09:00
20
+ basket_00004:
21
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
22
+ id: 4
23
+ note:
24
+ user_id: 2
25
+ created_at: 2008-01-21 17:26:14.585596 +09:00
26
+ basket_00005:
27
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
28
+ id: 5
29
+ note:
30
+ user_id: 1
31
+ created_at: 2008-01-21 17:26:14.585596 +09:00
32
+ basket_00006:
33
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
34
+ id: 6
35
+ note:
36
+ user_id: 2
37
+ created_at: 2008-01-21 17:26:14.585596 +09:00
38
+ basket_00007:
39
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
40
+ id: 7
41
+ note:
42
+ user_id: 3
43
+ created_at: 2008-01-21 17:26:14.585596 +09:00
44
+ basket_00008:
45
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
46
+ id: 8
47
+ note:
48
+ user_id: 3
49
+ created_at: 2008-01-21 17:26:14.585596 +09:00
50
+ basket_00009:
51
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
52
+ id: 9
53
+ note:
54
+ user_id: 2
55
+ created_at: 2008-01-21 17:26:14.585596 +09:00
56
+ basket_00010:
57
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
58
+ id: 10
59
+ note:
60
+ user_id: 3
61
+ created_at: 2008-01-21 17:26:14.585596 +09:00
62
+ basket_00011:
63
+ updated_at: 2008-01-21 17:26:14.585596 +09:00
64
+ id: 11
65
+ note:
66
+ user_id: 4
67
+ created_at: 2008-01-21 17:26:14.585596 +09:00
68
+
69
+ # == Schema Information
70
+ #
71
+ # Table name: baskets
72
+ #
73
+ # id :integer not null, primary key
74
+ # user_id :integer
75
+ # note :text
76
+ # lock_version :integer default(0), not null
77
+ # created_at :datetime not null
78
+ # updated_at :datetime not null
79
+ #
80
+