enju_purchase_request 0.0.3

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 (131) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +45 -0
  4. data/app/controllers/order_lists_controller.rb +94 -0
  5. data/app/controllers/orders_controller.rb +129 -0
  6. data/app/controllers/purchase_requests_controller.rb +139 -0
  7. data/app/models/order.rb +35 -0
  8. data/app/models/order_list.rb +53 -0
  9. data/app/models/purchase_request.rb +89 -0
  10. data/app/views/order_lists/edit.html.erb +37 -0
  11. data/app/views/order_lists/index.atom.builder +11 -0
  12. data/app/views/order_lists/index.html.erb +34 -0
  13. data/app/views/order_lists/index.rss.builder +31 -0
  14. data/app/views/order_lists/new.html.erb +32 -0
  15. data/app/views/order_lists/show.html.erb +40 -0
  16. data/app/views/orders/edit.html.erb +30 -0
  17. data/app/views/orders/index.atom.builder +11 -0
  18. data/app/views/orders/index.html.erb +40 -0
  19. data/app/views/orders/index.rss.builder +38 -0
  20. data/app/views/orders/new.html.erb +34 -0
  21. data/app/views/orders/show.html.erb +23 -0
  22. data/app/views/purchase_requests/_index.html.erb +85 -0
  23. data/app/views/purchase_requests/_index_order_list.html.erb +76 -0
  24. data/app/views/purchase_requests/_new.html.erb +76 -0
  25. data/app/views/purchase_requests/_new_order_list.html.erb +74 -0
  26. data/app/views/purchase_requests/edit.html.erb +66 -0
  27. data/app/views/purchase_requests/index.atom.builder +15 -0
  28. data/app/views/purchase_requests/index.csv.erb +4 -0
  29. data/app/views/purchase_requests/index.html.erb +5 -0
  30. data/app/views/purchase_requests/index.rss.builder +38 -0
  31. data/app/views/purchase_requests/new.html.erb +5 -0
  32. data/app/views/purchase_requests/show.html.erb +94 -0
  33. data/config/routes.rb +18 -0
  34. data/db/migrate/123_create_purchase_requests.rb +30 -0
  35. data/db/migrate/126_create_orders.rb +18 -0
  36. data/db/migrate/20081009062129_create_order_lists.rb +21 -0
  37. data/lib/enju_purchase_request/bookmark_url.rb +45 -0
  38. data/lib/enju_purchase_request/bookstore.rb +3 -0
  39. data/lib/enju_purchase_request/engine.rb +14 -0
  40. data/lib/enju_purchase_request/url_validator.rb +10 -0
  41. data/lib/enju_purchase_request/version.rb +3 -0
  42. data/lib/enju_purchase_request.rb +7 -0
  43. data/lib/tasks/enju_purchase_request_tasks.rake +4 -0
  44. data/spec/controllers/order_lists_controller_spec.rb +476 -0
  45. data/spec/controllers/orders_controller_spec.rb +481 -0
  46. data/spec/controllers/purchase_requests_controller_spec.rb +537 -0
  47. data/spec/dummy/Rakefile +7 -0
  48. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  49. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  50. data/spec/dummy/app/controllers/application_controller.rb +104 -0
  51. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  52. data/spec/dummy/app/models/ability.rb +25 -0
  53. data/spec/dummy/app/models/bookmark.rb +29 -0
  54. data/spec/dummy/app/models/bookstore.rb +31 -0
  55. data/spec/dummy/app/models/role.rb +5 -0
  56. data/spec/dummy/app/models/user.rb +29 -0
  57. data/spec/dummy/app/models/user_group.rb +2 -0
  58. data/spec/dummy/app/models/user_has_role.rb +4 -0
  59. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  60. data/spec/dummy/app/views/page/403.html.erb +9 -0
  61. data/spec/dummy/app/views/page/403.mobile.erb +5 -0
  62. data/spec/dummy/app/views/page/403.xml.erb +4 -0
  63. data/spec/dummy/app/views/page/404.html.erb +9 -0
  64. data/spec/dummy/app/views/page/404.mobile.erb +5 -0
  65. data/spec/dummy/app/views/page/404.xml.erb +4 -0
  66. data/spec/dummy/config/application.rb +45 -0
  67. data/spec/dummy/config/boot.rb +10 -0
  68. data/spec/dummy/config/database.yml +25 -0
  69. data/spec/dummy/config/environment.rb +5 -0
  70. data/spec/dummy/config/environments/development.rb +30 -0
  71. data/spec/dummy/config/environments/production.rb +60 -0
  72. data/spec/dummy/config/environments/test.rb +39 -0
  73. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  74. data/spec/dummy/config/initializers/devise.rb +209 -0
  75. data/spec/dummy/config/initializers/inflections.rb +10 -0
  76. data/spec/dummy/config/initializers/mime_types.rb +6 -0
  77. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  78. data/spec/dummy/config/initializers/session_store.rb +8 -0
  79. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  80. data/spec/dummy/config/locales/en.yml +5 -0
  81. data/spec/dummy/config/routes.rb +60 -0
  82. data/spec/dummy/config.ru +4 -0
  83. data/spec/dummy/db/migrate/006_create_items.rb +36 -0
  84. data/spec/dummy/db/migrate/124_create_bookstores.rb +21 -0
  85. data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
  86. data/spec/dummy/db/migrate/20111201155456_create_users.rb +13 -0
  87. data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +31 -0
  88. data/spec/dummy/db/migrate/20111201163342_create_user_groups.rb +12 -0
  89. data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
  90. data/spec/dummy/db/schema.rb +156 -0
  91. data/spec/dummy/db/test.sqlite3 +0 -0
  92. data/spec/dummy/log/development.log +0 -0
  93. data/spec/dummy/log/sunspot-solr-test.log +222 -0
  94. data/spec/dummy/log/test.log +137771 -0
  95. data/spec/dummy/public/404.html +26 -0
  96. data/spec/dummy/public/422.html +26 -0
  97. data/spec/dummy/public/500.html +26 -0
  98. data/spec/dummy/public/favicon.ico +0 -0
  99. data/spec/dummy/script/rails +6 -0
  100. data/spec/dummy/solr/conf/admin-extra.html +31 -0
  101. data/spec/dummy/solr/conf/elevate.xml +36 -0
  102. data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  103. data/spec/dummy/solr/conf/protwords.txt +21 -0
  104. data/spec/dummy/solr/conf/schema.xml +238 -0
  105. data/spec/dummy/solr/conf/scripts.conf +24 -0
  106. data/spec/dummy/solr/conf/solrconfig.xml +934 -0
  107. data/spec/dummy/solr/conf/spellings.txt +2 -0
  108. data/spec/dummy/solr/conf/stopwords.txt +58 -0
  109. data/spec/dummy/solr/conf/synonyms.txt +31 -0
  110. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  111. data/spec/dummy/solr/data/test/index/segments_1 +0 -0
  112. data/spec/dummy/solr/data/test/spellchecker/segments.gen +0 -0
  113. data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
  114. data/spec/factories/bookstore.rb +5 -0
  115. data/spec/factories/order.rb +6 -0
  116. data/spec/factories/order_list.rb +7 -0
  117. data/spec/factories/purchase_request.rb +6 -0
  118. data/spec/factories/user.rb +34 -0
  119. data/spec/fixtures/order_lists.yml +40 -0
  120. data/spec/fixtures/orders.yml +50 -0
  121. data/spec/fixtures/purchase_requests.yml +129 -0
  122. data/spec/fixtures/roles.yml +21 -0
  123. data/spec/fixtures/user_has_roles.yml +41 -0
  124. data/spec/fixtures/users.yml +69 -0
  125. data/spec/models/order_list_spec.rb +24 -0
  126. data/spec/models/order_spec.rb +21 -0
  127. data/spec/models/purchase_request_spec.rb +31 -0
  128. data/spec/spec_helper.rb +44 -0
  129. data/spec/support/controller_macros.rb +48 -0
  130. data/spec/support/devise.rb +4 -0
  131. metadata +394 -0
@@ -0,0 +1,2 @@
1
+ pizza
2
+ history
@@ -0,0 +1,58 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ #-----------------------------------------------------------------------
17
+ # a couple of test stopwords to test that the words are really being
18
+ # configured from this file:
19
+ stopworda
20
+ stopwordb
21
+
22
+ #Standard english stop words taken from Lucene's StopAnalyzer
23
+ a
24
+ an
25
+ and
26
+ are
27
+ as
28
+ at
29
+ be
30
+ but
31
+ by
32
+ for
33
+ if
34
+ in
35
+ into
36
+ is
37
+ it
38
+ no
39
+ not
40
+ of
41
+ on
42
+ or
43
+ s
44
+ such
45
+ t
46
+ that
47
+ the
48
+ their
49
+ then
50
+ there
51
+ these
52
+ they
53
+ this
54
+ to
55
+ was
56
+ will
57
+ with
58
+
@@ -0,0 +1,31 @@
1
+ # The ASF licenses this file to You under the Apache License, Version 2.0
2
+ # (the "License"); you may not use this file except in compliance with
3
+ # the License. You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ #-----------------------------------------------------------------------
14
+ #some test synonym mappings unlikely to appear in real input text
15
+ aaa => aaaa
16
+ bbb => bbbb1 bbbb2
17
+ ccc => cccc1,cccc2
18
+ a\=>a => b\=>b
19
+ a\,a => b\,b
20
+ fooaaa,baraaa,bazaaa
21
+
22
+ # Some synonym groups specific to this example
23
+ GB,gib,gigabyte,gigabytes
24
+ MB,mib,megabyte,megabytes
25
+ Television, Televisions, TV, TVs
26
+ #notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
27
+ #after us won't split it into two words.
28
+
29
+ # Synonym mappings can be used for spelling correction too
30
+ pixima => pixma
31
+
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :bookstore do |f|
3
+ f.sequence(:name){|n| "bookstore_#{n}"}
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ FactoryGirl.define do
2
+ factory :order do |f|
3
+ f.order_list_id{FactoryGirl.create(:order_list).id}
4
+ f.purchase_request_id{FactoryGirl.create(:purchase_request).id}
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+ factory :order_list do |f|
3
+ f.user_id{FactoryGirl.create(:user).id}
4
+ f.sequence(:title){|n| "order_list_#{n}"}
5
+ f.bookstore_id{FactoryGirl.create(:bookstore).id}
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ FactoryGirl.define do
2
+ factory :purchase_request do |f|
3
+ f.sequence(:title){|n| "purchase_request_#{n}"}
4
+ f.user_id{FactoryGirl.create(:user).id}
5
+ end
6
+ end
@@ -0,0 +1,34 @@
1
+ FactoryGirl.define do
2
+ factory :admin, :class => User do |f|
3
+ f.sequence(:username){|n| "admin_#{n}"}
4
+ f.sequence(:email){|n| "admin_#{n}@example.jp"}
5
+ f.role {Role.find_by_name('Administrator')}
6
+ f.password 'adminpassword'
7
+ f.password_confirmation 'adminpassword'
8
+ f.user_group {UserGroup.first}
9
+ f.required_role {Role.find_by_name('User')}
10
+ end
11
+
12
+ factory :librarian, :class => User do |f|
13
+ f.sequence(:username){|n| "librarian_#{n}"}
14
+ f.sequence(:email){|n| "librarian_#{n}@example.jp"}
15
+ f.role {Role.find_by_name('Librarian')}
16
+ f.password 'librarianpassword'
17
+ f.password_confirmation 'librarianpassword'
18
+ f.user_group {UserGroup.first}
19
+ f.required_role {Role.find_by_name('User')}
20
+ end
21
+
22
+ factory :user, :class => User do |f|
23
+ f.sequence(:username){|n| "user_#{n}"}
24
+ f.sequence(:email){|n| "user_#{n}@example.jp"}
25
+ f.role {Role.find_by_name('User')}
26
+ f.password 'userpassword'
27
+ f.password_confirmation 'userpassword'
28
+ f.user_group {UserGroup.first}
29
+ f.required_role {Role.find_by_name('User')}
30
+ end
31
+
32
+ factory :invalid_user, :class => User do |f|
33
+ end
34
+ end
@@ -0,0 +1,40 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ order_list_00001:
4
+ id: 1
5
+ bookstore_id: 1
6
+ user_id: 1
7
+ title: MyText
8
+ note: MyText
9
+ state: pending
10
+ order_list_00002:
11
+ id: 2
12
+ bookstore_id: 2
13
+ user_id: 1
14
+ title: MyText
15
+ note: MyText
16
+ state: pending
17
+ order_list_00003:
18
+ id: 3
19
+ bookstore_id: 3
20
+ user_id: 2
21
+ title: MyText
22
+ note: MyText
23
+ state: pending
24
+
25
+ # == Schema Information
26
+ #
27
+ # Table name: order_lists
28
+ #
29
+ # id :integer not null, primary key
30
+ # user_id :integer not null
31
+ # bookstore_id :integer not null
32
+ # title :text not null
33
+ # note :text
34
+ # ordered_at :datetime
35
+ # deleted_at :datetime
36
+ # state :string(255)
37
+ # created_at :datetime
38
+ # updated_at :datetime
39
+ #
40
+
@@ -0,0 +1,50 @@
1
+ ---
2
+ order_00001:
3
+ updated_at: 2008-01-11 23:28:19.277110 +09:00
4
+ purchase_request_id: 1
5
+ order_list_id: 1
6
+ id: 1
7
+ position: 1
8
+ created_at: 2008-01-11 23:28:19.277110 +09:00
9
+ order_00002:
10
+ updated_at: 2008-01-11 23:28:57.068191 +09:00
11
+ purchase_request_id: 2
12
+ order_list_id: 2
13
+ id: 2
14
+ position: 1
15
+ created_at: 2008-01-11 23:28:57.068191 +09:00
16
+ order_00003:
17
+ updated_at: 2008-01-11 23:32:03.701425 +09:00
18
+ purchase_request_id: 3
19
+ order_list_id: 3
20
+ id: 3
21
+ position: 1
22
+ created_at: 2008-01-11 23:32:03.701425 +09:00
23
+ order_00004:
24
+ updated_at: 2008-01-11 02:34:20.183962 +09:00
25
+ purchase_request_id: 4
26
+ order_list_id: 1
27
+ id: 4
28
+ position: 1
29
+ created_at: 2008-01-11 02:34:20.183962 +09:00
30
+ order_00005:
31
+ updated_at: 2008-01-11 02:34:32.352223 +09:00
32
+ purchase_request_id: 5
33
+ order_list_id: 2
34
+ id: 5
35
+ position: 2
36
+ created_at: 2008-01-11 02:34:32.352223 +09:00
37
+
38
+ # == Schema Information
39
+ #
40
+ # Table name: orders
41
+ #
42
+ # id :integer not null, primary key
43
+ # order_list_id :integer not null
44
+ # purchase_request_id :integer not null
45
+ # position :integer
46
+ # state :string(255)
47
+ # created_at :datetime
48
+ # updated_at :datetime
49
+ #
50
+
@@ -0,0 +1,129 @@
1
+ ---
2
+ purchase_request_00001:
3
+ date_of_publication:
4
+ isbn: ""
5
+ accepted_at:
6
+ url: ""
7
+ updated_at: 2008-02-09 18:53:28.893662 +09:00
8
+ denied_at:
9
+ title: !binary |
10
+ 44Gq44KT44Go44GL44GL44KT44Go44GL
11
+
12
+ price:
13
+ deleted_at:
14
+ author: !binary |
15
+ 44Gq44KT44Gf44KJ44GL44KT44Gf44KJ
16
+
17
+ id: 1
18
+ publisher: ""
19
+ note: ""
20
+ user_id: 1
21
+ created_at: 2008-02-09 18:53:28.893662 +09:00
22
+ purchase_request_00002:
23
+ date_of_publication:
24
+ isbn: ""
25
+ accepted_at:
26
+ url: ""
27
+ updated_at: 2008-02-09 19:26:43.085258 +09:00
28
+ denied_at:
29
+ title: !binary |
30
+ 44G744GS44G744GS
31
+
32
+ price:
33
+ deleted_at:
34
+ author: !binary |
35
+ 44Gq44KT44Go44GL
36
+
37
+ id: 2
38
+ publisher: !binary |
39
+ 44GL44KT44Go44GL
40
+
41
+ note: !binary |
42
+ 44OG44K544OI55So
43
+
44
+ user_id: 2
45
+ created_at: 2008-02-09 19:21:11.162568 +09:00
46
+ purchase_request_00003:
47
+ date_of_publication:
48
+ isbn: ""
49
+ accepted_at:
50
+ url: ""
51
+ updated_at: 2008-02-11 13:36:48.698469 +09:00
52
+ denied_at:
53
+ title: "test1"
54
+ price:
55
+ deleted_at:
56
+ author: !binary |
57
+ 44Gq44KT44Gf44KJ44GL44KT44Gf44KJ
58
+
59
+ id: 3
60
+ publisher: !binary |
61
+ 44G744GS44G744GS
62
+
63
+ note: ""
64
+ user_id: 3
65
+ created_at: 2008-02-11 13:36:48.698469 +09:00
66
+ purchase_request_00004:
67
+ date_of_publication:
68
+ isbn: ""
69
+ accepted_at:
70
+ url: ""
71
+ updated_at: 2008-02-11 13:36:48.698469 +09:00
72
+ denied_at:
73
+ title: "test2"
74
+ price:
75
+ deleted_at:
76
+ author: !binary |
77
+ 44Gq44KT44Gf44KJ44GL44KT44Gf44KJ
78
+
79
+ id: 4
80
+ publisher: !binary |
81
+ 44G744GS44G744GS
82
+
83
+ note: ""
84
+ user_id: 1
85
+ created_at: 2008-02-11 13:36:48.698469 +09:00
86
+ purchase_request_00005:
87
+ date_of_publication:
88
+ isbn: ""
89
+ accepted_at:
90
+ url: ""
91
+ updated_at: 2008-02-11 13:36:48.698469 +09:00
92
+ denied_at:
93
+ title: "test3"
94
+ price:
95
+ deleted_at:
96
+ author: !binary |
97
+ 44Gq44KT44Gf44KJ44GL44KT44Gf44KJ
98
+
99
+ id: 5
100
+ publisher: !binary |
101
+ 44G744GS44G744GS
102
+
103
+ note: ""
104
+ user_id: 2
105
+ created_at: 2008-02-11 13:36:48.698469 +09:00
106
+
107
+ # == Schema Information
108
+ #
109
+ # Table name: purchase_requests
110
+ #
111
+ # id :integer not null, primary key
112
+ # user_id :integer not null
113
+ # title :text not null
114
+ # author :text
115
+ # publisher :text
116
+ # isbn :string(255)
117
+ # date_of_publication :datetime
118
+ # price :integer
119
+ # url :string(255)
120
+ # note :text
121
+ # accepted_at :datetime
122
+ # denied_at :datetime
123
+ # created_at :datetime
124
+ # updated_at :datetime
125
+ # deleted_at :datetime
126
+ # state :string(255)
127
+ # pub_date :string(255)
128
+ #
129
+
@@ -0,0 +1,21 @@
1
+ ---
2
+ role_00001:
3
+ name: Guest
4
+ display_name: Guest
5
+ id: 1
6
+ note:
7
+ role_00002:
8
+ name: User
9
+ display_name: User
10
+ id: 2
11
+ note:
12
+ role_00003:
13
+ name: Librarian
14
+ display_name: Librarian
15
+ id: 3
16
+ note:
17
+ role_00004:
18
+ name: Administrator
19
+ display_name: Administrator
20
+ id: 4
21
+ note:
@@ -0,0 +1,41 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ admin:
4
+ user_id: 1
5
+ role_id: 4
6
+
7
+ librarian1:
8
+ user_id: 2
9
+ role_id: 3
10
+
11
+ user1:
12
+ user_id: 3
13
+ role_id: 2
14
+
15
+ librarian2:
16
+ user_id: 4
17
+ role_id: 3
18
+
19
+ user2:
20
+ user_id: 5
21
+ role_id: 2
22
+
23
+ user3:
24
+ user_id: 6
25
+ role_id: 2
26
+
27
+ user4:
28
+ user_id: 7
29
+ role_id: 2
30
+
31
+ # == Schema Information
32
+ #
33
+ # Table name: user_has_roles
34
+ #
35
+ # id :integer not null, primary key
36
+ # user_id :integer
37
+ # role_id :integer
38
+ # created_at :datetime
39
+ # updated_at :datetime
40
+ #
41
+
@@ -0,0 +1,69 @@
1
+ ---
2
+ admin:
3
+ updated_at: 2008-05-31 13:16:30.163731 +09:00
4
+ encrypted_password: $2a$10$vHohD1WflnTIqAa8zMkF9evwAgIZRw3XuR4d3bi29M.jph/MB/AJi
5
+ user_group_id: 2
6
+ id: 1
7
+ note:
8
+ username: admin
9
+ email: tanabe@kamata.lib.teu.ac.jp
10
+ created_at: 2007-11-19 16:58:32.111941 +09:00
11
+ required_role_id: 4
12
+ librarian1:
13
+ updated_at: 2008-05-31 12:41:16.337474 +09:00
14
+ encrypted_password: $2a$10$9O2VuTccN4gHq36ARg0QReSrb1D7WrBBhZZ759RM9moHbB0W5zCzS
15
+ user_group_id: 1
16
+ id: 2
17
+ note:
18
+ username: librarian1
19
+ email: librarian1@kamata.lib.teu.ac.jp
20
+ created_at: 2007-11-19 16:58:33.172441 +09:00
21
+ required_role_id: 1
22
+ user1:
23
+ updated_at: 2008-05-31 13:02:25.101261 +09:00
24
+ encrypted_password: $2a$10$JthS59A0BNkDOoFpCXM0V.GhhffKaoWKbzpPahYp/vTFrOyM7h/uW
25
+ user_group_id: 1
26
+ id: 3
27
+ note:
28
+ username: user1
29
+ email: user1@kamata.lib.teu.ac.jp
30
+ created_at: 2007-11-19 16:58:34.637413 +09:00
31
+ required_role_id: 3
32
+ librarian2:
33
+ updated_at: 2008-05-31 12:42:23.340575 +09:00
34
+ encrypted_password: $2a$10$YmmTGrYQ1Ir6oc7wXnp.GuNeO1eYLoP3sv8wMSIrTdaGw2BPwRrpS
35
+ user_group_id: 1
36
+ id: 4
37
+ note:
38
+ username: librarian2
39
+ created_at: 2008-01-18 12:24:04.222344 +09:00
40
+ required_role_id: 1
41
+ user2:
42
+ updated_at: 2008-05-31 12:42:44.711117 +09:00
43
+ encrypted_password: $2a$10$i7UjJhLVrJM/J7qaTwW39OXw1NiwowUEbtNHVDV0sqMLjX9.UO9ca
44
+ user_group_id: 1
45
+ id: 5
46
+ note:
47
+ username: user2
48
+ created_at: 2008-01-18 13:29:06.922728 +09:00
49
+ required_role_id: 2
50
+ user3:
51
+ updated_at: 2008-05-31 13:02:25.101261 +09:00
52
+ encrypted_password: cc53de0c2d9a1a228daa9a673ec824473747e17507a6c3c4f7e5eff8821f531d4b9e23616b3ddc66fe17006b2298a556fbd567ac080e87f00f37eef8cee6c417
53
+ user_group_id: 1
54
+ id: 6
55
+ note:
56
+ username: user3
57
+ email: user3@kamata.lib.teu.ac.jp
58
+ created_at: 2007-11-19 16:58:34.637413 +09:00
59
+ required_role_id: 3
60
+ user4:
61
+ updated_at: 2008-05-31 13:02:25.101261 +09:00
62
+ encrypted_password: cc53de0c2d9a1a228daa9a673ec824473747e17507a6c3c4f7e5eff8821f531d4b9e23616b3ddc66fe17006b2298a556fbd567ac080e87f00f37eef8cee6c417
63
+ user_group_id: 1
64
+ id: 7
65
+ note:
66
+ username: user4
67
+ email: user4@kamata.lib.teu.ac.jp
68
+ created_at: 2007-11-19 16:58:34.637413 +09:00
69
+ required_role_id: 3
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe OrderList do
5
+ #pending "add some examples to (or delete) #{__FILE__}"
6
+
7
+ end
8
+
9
+ # == Schema Information
10
+ #
11
+ # Table name: order_lists
12
+ #
13
+ # id :integer not null, primary key
14
+ # user_id :integer not null
15
+ # bookstore_id :integer not null
16
+ # title :text not null
17
+ # note :text
18
+ # ordered_at :datetime
19
+ # deleted_at :datetime
20
+ # state :string(255)
21
+ # created_at :datetime
22
+ # updated_at :datetime
23
+ #
24
+
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe Order do
5
+ #pending "add some examples to (or delete) #{__FILE__}"
6
+
7
+ end
8
+
9
+ # == Schema Information
10
+ #
11
+ # Table name: orders
12
+ #
13
+ # id :integer not null, primary key
14
+ # order_list_id :integer not null
15
+ # purchase_request_id :integer not null
16
+ # position :integer
17
+ # state :string(255)
18
+ # created_at :datetime
19
+ # updated_at :datetime
20
+ #
21
+
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe PurchaseRequest do
5
+ #pending "add some examples to (or delete) #{__FILE__}"
6
+
7
+ end
8
+
9
+ # == Schema Information
10
+ #
11
+ # Table name: purchase_requests
12
+ #
13
+ # id :integer not null, primary key
14
+ # user_id :integer not null
15
+ # title :text not null
16
+ # author :text
17
+ # publisher :text
18
+ # isbn :string(255)
19
+ # date_of_publication :datetime
20
+ # price :integer
21
+ # url :string(255)
22
+ # note :text
23
+ # accepted_at :datetime
24
+ # denied_at :datetime
25
+ # created_at :datetime
26
+ # updated_at :datetime
27
+ # deleted_at :datetime
28
+ # state :string(255)
29
+ # pub_date :string(255)
30
+ #
31
+
@@ -0,0 +1,44 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../dummy/config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+
6
+ # Requires supporting ruby files with custom matchers and macros, etc,
7
+ # in spec/support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
9
+
10
+ RSpec.configure do |config|
11
+ # == Mock Framework
12
+ #
13
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
14
+ #
15
+ # config.mock_with :mocha
16
+ # config.mock_with :flexmock
17
+ # config.mock_with :rr
18
+ config.mock_with :rspec
19
+
20
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
+ config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
22
+
23
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
+ # examples within a transaction, remove the following line or assign false
25
+ # instead of true.
26
+ config.use_transactional_fixtures = true
27
+
28
+ config.extend ControllerMacros, :type => :controller
29
+
30
+ $original_sunspot_session = Sunspot.session
31
+
32
+ config.before do
33
+ Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
34
+ end
35
+
36
+ config.before :each, :solr => true do
37
+ Sunspot::Rails::Tester.start_original_sunspot_session
38
+ Sunspot.session = $original_sunspot_session
39
+ #Sunspot.remove_all!
40
+ end
41
+ end
42
+
43
+ FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
44
+ FactoryGirl.find_definitions
@@ -0,0 +1,48 @@
1
+ module ControllerMacros
2
+ def login_admin
3
+ before(:each) do
4
+ @request.env["devise.mapping"] = Devise.mappings[:admin]
5
+ sign_in Factory.create(:admin)
6
+ end
7
+ end
8
+
9
+ def login_librarian
10
+ before(:each) do
11
+ @request.env["devise.mapping"] = Devise.mappings[:user]
12
+ user = Factory.create(:librarian)
13
+ sign_in user
14
+ end
15
+ end
16
+
17
+ def login_user
18
+ before(:each) do
19
+ @request.env["devise.mapping"] = Devise.mappings[:user]
20
+ user = Factory.create(:user)
21
+ sign_in user
22
+ end
23
+ end
24
+
25
+ def login_fixture_admin
26
+ before(:each) do
27
+ @request.env["devise.mapping"] = Devise.mappings[:admin]
28
+ @user = users(:admin)
29
+ sign_in @user
30
+ end
31
+ end
32
+
33
+ def login_fixture_librarian
34
+ before(:each) do
35
+ @request.env["devise.mapping"] = Devise.mappings[:user]
36
+ @user = users(:librarian1)
37
+ sign_in @user
38
+ end
39
+ end
40
+
41
+ def login_fixture_user
42
+ before(:each) do
43
+ @request.env["devise.mapping"] = Devise.mappings[:user]
44
+ @user = users(:user1)
45
+ sign_in @user
46
+ end
47
+ end
48
+ end