enju_biblio 0.1.0.pre15 → 0.1.0.pre16
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/item.rb +27 -26
- data/app/models/manifestation.rb +1 -1
- data/app/views/layouts/manifestations.html.erb +32 -0
- data/app/views/layouts/manifestations.mobile.erb +18 -0
- data/app/views/layouts/patrons.html.erb +26 -0
- data/app/views/layouts/patrons.mobile.erb +18 -0
- data/app/views/manifestations/_show_detail_librarian.html.erb +0 -3
- data/app/views/manifestations/_show_detail_user.html.erb +0 -3
- data/config/locales/translation_en.yml +239 -0
- data/config/locales/translation_ja.yml +239 -0
- data/config/routes.rb +2 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/dummy/app/controllers/application_controller.rb +11 -1
- data/spec/dummy/app/models/ability.rb +0 -2
- data/spec/dummy/app/views/page/_footer.html.erb +4 -0
- data/spec/dummy/app/views/page/_header.html.erb +2 -0
- data/spec/dummy/app/views/page/_include.html.erb +4 -0
- data/spec/dummy/app/views/page/_menu.html.erb +2 -0
- data/spec/dummy/app/views/page/_select_locale.html.erb +2 -0
- data/spec/dummy/db/schema.rb +0 -11
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
- data/spec/dummy/tmp/cache/6E4/420/search_engine_all +0 -0
- metadata +19 -42
- data/app/controllers/accepts_controller.rb +0 -83
- data/app/models/accept.rb +0 -37
- data/app/views/accepts/_form.html.erb +0 -11
- data/app/views/accepts/_list.html.erb +0 -31
- data/app/views/accepts/edit.html.erb +0 -13
- data/app/views/accepts/index.csv.erb +0 -4
- data/app/views/accepts/index.html.erb +0 -49
- data/app/views/accepts/index.js.erb +0 -1
- data/app/views/accepts/new.html.erb +0 -14
- data/app/views/accepts/show.html.erb +0 -31
- data/db/migrate/20120319173203_create_accepts.rb +0 -14
- data/spec/controllers/accepts_controller_spec.rb +0 -304
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_8c +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments.gen +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- data/spec/factories/accepts.rb +0 -9
- data/spec/models/accept_spec.rb +0 -23
- data/spec/requests/accepts_spec.rb +0 -11
- data/spec/routing/accepts_routing_spec.rb +0 -27
- data/spec/views/accepts/edit.html.erb_spec.rb +0 -18
- data/spec/views/accepts/index.html.erb_spec.rb +0 -25
- data/spec/views/accepts/new.html.erb_spec.rb +0 -31
- data/spec/views/accepts/show.html.erb_spec.rb +0 -17
data/app/models/accept.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
class Accept < ActiveRecord::Base
|
2
|
-
attr_accessible :item_identifier, :librarian_id, :item_id
|
3
|
-
default_scope :order => 'accepts.id DESC'
|
4
|
-
belongs_to :basket
|
5
|
-
belongs_to :item
|
6
|
-
belongs_to :librarian, :class_name => 'User'
|
7
|
-
|
8
|
-
validates_uniqueness_of :item_id, :message => I18n.t('accept.already_accepted')
|
9
|
-
validates_presence_of :item_id, :message => I18n.t('accept.item_not_found')
|
10
|
-
validates_presence_of :basket_id
|
11
|
-
|
12
|
-
before_save :accept!, :on => :create
|
13
|
-
|
14
|
-
attr_accessor :item_identifier
|
15
|
-
|
16
|
-
paginates_per 10
|
17
|
-
|
18
|
-
def accept!
|
19
|
-
if defined?(EnjuCirculation)
|
20
|
-
item.circulation_status = CirculationStatus.where(:name => 'Available On Shelf').first
|
21
|
-
end
|
22
|
-
item.save(:validate => false)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# == Schema Information
|
27
|
-
#
|
28
|
-
# Table name: accepts
|
29
|
-
#
|
30
|
-
# id :integer not null, primary key
|
31
|
-
# basket_id :integer
|
32
|
-
# item_id :integer
|
33
|
-
# librarian_id :integer
|
34
|
-
# created_at :datetime not null
|
35
|
-
# updated_at :datetime not null
|
36
|
-
#
|
37
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
<div style="color: red"><%= flash[:message] -%></div>
|
2
|
-
|
3
|
-
<div class="search_form">
|
4
|
-
<%= form_for(@accept, :url => basket_accepts_path(@basket), :remote => true) do |f| %>
|
5
|
-
<%= f.error_messages %>
|
6
|
-
<p>
|
7
|
-
<%= label_tag :item_identifier, t('activerecord.attributes.item.item_identifier') -%>:
|
8
|
-
<%= f.search_field :item_identifier, :class => 'resource_item_identifier', :value => nil -%>
|
9
|
-
<%= f.submit t('accept.accept'), 'data-disable-with' => t('page.saving') -%>
|
10
|
-
</p>
|
11
|
-
<%- end -%>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
<table class="index">
|
15
|
-
<tr>
|
16
|
-
<th><%= t('activerecord.models.item') -%></th>
|
17
|
-
</tr>
|
18
|
-
<%- @accepts.each_with_index do |accept, i| -%>
|
19
|
-
<tr class="line<%= cycle("0", "1") -%>">
|
20
|
-
<td>
|
21
|
-
<%= render 'manifestations/show_index', :manifestation => accept.item.manifestation %>
|
22
|
-
<%= link_to accept.item.item_identifier, accept.item -%> / <%= accept.item.call_number %>
|
23
|
-
(<%= link_to accept.item.shelf.library.display_name.localize, accept.item.shelf.library %> /
|
24
|
-
<%= link_to accept.item.shelf.display_name.localize, accept.item.shelf %>)<br />
|
25
|
-
<%=l accept.created_at %>
|
26
|
-
</td>
|
27
|
-
</tr>
|
28
|
-
<%- end -%>
|
29
|
-
</table>
|
30
|
-
|
31
|
-
<%= javascript_tag("$('#accept_item_identifier').focus()") -%>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.accept')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
<%= render 'form' %>
|
5
|
-
</div>
|
6
|
-
</div>
|
7
|
-
|
8
|
-
<div id="submenu" class="ui-corner-all">
|
9
|
-
<ul>
|
10
|
-
<li><%= link_to t('page.show'), @accept -%></li>
|
11
|
-
<li><%= link_to t('page.back'), accepts_path -%></li>
|
12
|
-
</ul>
|
13
|
-
</div>
|
@@ -1,49 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.accept')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
|
5
|
-
<div class="search_form">
|
6
|
-
<%= form_for(:accept, :html => {:method => :get}) do |f| %>
|
7
|
-
<p>
|
8
|
-
<%= label_tag :item_identifier, t('activerecord.attributes.item.item_identifier') -%>:
|
9
|
-
<%= f.search_field :item_identifier, :value => @query, :class => 'resource_item_identifier' -%>
|
10
|
-
<%= f.submit t('page.search') -%>
|
11
|
-
</p>
|
12
|
-
<%- end -%>
|
13
|
-
</div>
|
14
|
-
|
15
|
-
<table class="table table-striped index">
|
16
|
-
<tr>
|
17
|
-
<th><%= t('activerecord.models.item') -%></th>
|
18
|
-
<th></th>
|
19
|
-
</tr>
|
20
|
-
<%- @accepts.each_with_index do |accept, i| -%>
|
21
|
-
<tr class="line<%= cycle("0", "1") -%>">
|
22
|
-
<td>
|
23
|
-
<% if accept.item %>
|
24
|
-
<%= render 'manifestations/show_index', :manifestation => accept.item.manifestation %>
|
25
|
-
<%= link_to accept.item.item_identifier, accept.item -%> / <%= accept.item.call_number %>
|
26
|
-
(<%= link_to accept.item.shelf.library.display_name.localize, accept.item.shelf.library %> /
|
27
|
-
<%= link_to accept.item.shelf.display_name.localize, accept.item.shelf %>)<br />
|
28
|
-
<%=l accept.created_at %>
|
29
|
-
<% end %>
|
30
|
-
</td>
|
31
|
-
<td>
|
32
|
-
<%- if can? :destroy, accept -%>
|
33
|
-
<%= link_to t('page.destroy'), accept, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
34
|
-
<%- end -%>
|
35
|
-
</td>
|
36
|
-
</tr>
|
37
|
-
<%- end -%>
|
38
|
-
</table>
|
39
|
-
<%= javascript_tag("$('#accept_item_identifier').focus()") -%>
|
40
|
-
|
41
|
-
<%= paginate(@accepts) %>
|
42
|
-
</div>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<div id="submenu" class="ui-corner-all">
|
46
|
-
<ul>
|
47
|
-
<li><%= link_to t('page.new', :model => t('activerecord.models.accept')), new_accept_path -%></li>
|
48
|
-
</ul>
|
49
|
-
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
$("#accept_list").html("<%= escape_javascript(render('accepts/list')) %>");
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.accept')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
<div id="accept_list">
|
5
|
-
<%= render 'list' -%>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<div id="submenu" class="ui-corner-all">
|
11
|
-
<ul>
|
12
|
-
<li><%= link_to t('page.back'), accepts_path -%></li>
|
13
|
-
</ul>
|
14
|
-
</div>
|
@@ -1,31 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.accept')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
<p id="notice"><%= notice %></p>
|
5
|
-
|
6
|
-
<p>
|
7
|
-
<strong><%= t('activerecord.models.item') -%>:</strong>
|
8
|
-
<% if @accept.item %>
|
9
|
-
<%= link_to @accept.item.item_identifier, @accept.item -%>
|
10
|
-
(<%= link_to @accept.item.manifestation.original_title, @accept.item.manifestation %>)
|
11
|
-
<% end %>
|
12
|
-
</p>
|
13
|
-
|
14
|
-
<p>
|
15
|
-
<strong><%= t('activerecord.models.user') -%>:</strong>
|
16
|
-
<%= link_to @accept.librarian.username, @accept.librarian if @accept.librarian -%>
|
17
|
-
</p>
|
18
|
-
|
19
|
-
<p>
|
20
|
-
<strong><%= t('page.created_at') -%>:</strong>
|
21
|
-
<%=l @accept.created_at %>
|
22
|
-
</p>
|
23
|
-
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
|
27
|
-
<div id="submenu" class="ui-corner-all">
|
28
|
-
<ul>
|
29
|
-
<li><%= back_to_index(flash[:page_info]) -%></li>
|
30
|
-
</ul>
|
31
|
-
</div>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class CreateAccepts < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :accepts do |t|
|
4
|
-
t.integer :basket_id
|
5
|
-
t.integer :item_id
|
6
|
-
t.integer :librarian_id
|
7
|
-
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
|
11
|
-
add_index :accepts, :basket_id
|
12
|
-
add_index :accepts, :item_id
|
13
|
-
end
|
14
|
-
end
|
@@ -1,304 +0,0 @@
|
|
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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/factories/accepts.rb
DELETED
data/spec/models/accept_spec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Accept do
|
4
|
-
fixtures :all
|
5
|
-
|
6
|
-
it "should change circulation_status" do
|
7
|
-
accept = FactoryGirl.create(:accept)
|
8
|
-
accept.item.circulation_status.name.should eq 'Available On Shelf'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
# == Schema Information
|
13
|
-
#
|
14
|
-
# Table name: accepts
|
15
|
-
#
|
16
|
-
# id :integer not null, primary key
|
17
|
-
# basket_id :integer
|
18
|
-
# item_id :integer
|
19
|
-
# librarian_id :integer
|
20
|
-
# created_at :datetime not null
|
21
|
-
# updated_at :datetime not null
|
22
|
-
#
|
23
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Accepts" do
|
4
|
-
describe "GET /accepts" do
|
5
|
-
it "works! (now write some real specs)" do
|
6
|
-
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
|
7
|
-
get accepts_path
|
8
|
-
response.status.should be(302)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe AcceptsController do
|
4
|
-
describe "routing" do
|
5
|
-
|
6
|
-
it "routes to #index" do
|
7
|
-
get("/accepts").should route_to("accepts#index")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "routes to #new" do
|
11
|
-
get("/accepts/new").should route_to("accepts#new")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "routes to #show" do
|
15
|
-
get("/accepts/1").should route_to("accepts#show", :id => "1")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "routes to #create" do
|
19
|
-
post("/accepts").should route_to("accepts#create")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "routes to #destroy" do
|
23
|
-
delete("/accepts/1").should route_to("accepts#destroy", :id => "1")
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "accepts/edit" do
|
4
|
-
before(:each) do
|
5
|
-
@accept = assign(:accept, stub_model(Accept,
|
6
|
-
:item_id => 1
|
7
|
-
))
|
8
|
-
end
|
9
|
-
|
10
|
-
it "renders the edit accept form" do
|
11
|
-
render
|
12
|
-
|
13
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
14
|
-
assert_select "form", :action => accepts_path(@accept), :method => "post" do
|
15
|
-
assert_select "input#accept_item_id", :name => "accept[item_id]"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "accepts/index" do
|
4
|
-
before(:each) do
|
5
|
-
assign(:accepts, Kaminari::paginate_array([
|
6
|
-
stub_model(Accept,
|
7
|
-
:item_id => 1,
|
8
|
-
:created_at => Time.zone.now
|
9
|
-
),
|
10
|
-
stub_model(Accept,
|
11
|
-
:item_id => 1,
|
12
|
-
:created_at => Time.zone.now
|
13
|
-
)
|
14
|
-
]).page(1))
|
15
|
-
basket = FactoryGirl.create(:basket)
|
16
|
-
assign(:basket, basket)
|
17
|
-
assign(:accept, basket.accepts.new)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "renders a list of accepts" do
|
21
|
-
render
|
22
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
23
|
-
assert_select "tr>td"
|
24
|
-
end
|
25
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "accepts/new" do
|
4
|
-
fixtures :all
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
assign(:accept, stub_model(Accept,
|
8
|
-
:item_id => 1
|
9
|
-
).as_new_record)
|
10
|
-
assign(:basket, FactoryGirl.create(:basket))
|
11
|
-
assign(:accepts, Kaminari::paginate_array([
|
12
|
-
stub_model(Accept,
|
13
|
-
:item_id => 1,
|
14
|
-
:created_at => Time.zone.now
|
15
|
-
),
|
16
|
-
stub_model(Accept,
|
17
|
-
:item_id => 1,
|
18
|
-
:created_at => Time.zone.now
|
19
|
-
)
|
20
|
-
]).page(1))
|
21
|
-
end
|
22
|
-
|
23
|
-
it "renders new accept form" do
|
24
|
-
render
|
25
|
-
|
26
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
27
|
-
assert_select "form", :action => accepts_path, :method => "post" do
|
28
|
-
assert_select "input#accept_item_identifier", :name => "accept[item_identifier]"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|