enju_inter_library_loan 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +45 -0
- data/app/controllers/inter_library_loans_controller.rb +125 -0
- data/app/models/inter_library_loan.rb +111 -0
- data/app/views/inter_library_loans/edit.html.erb +149 -0
- data/app/views/inter_library_loans/index.atom.builder +11 -0
- data/app/views/inter_library_loans/index.html.erb +50 -0
- data/app/views/inter_library_loans/index.rss.builder +31 -0
- data/app/views/inter_library_loans/new.html.erb +42 -0
- data/app/views/inter_library_loans/show.html.erb +58 -0
- data/config/locales/translation_en.yml +20 -0
- data/config/locales/translation_ja.yml +20 -0
- data/config/routes.rb +6 -0
- data/db/migrate/148_create_inter_library_loans.rb +23 -0
- data/lib/enju_inter_library_loan.rb +4 -0
- data/lib/enju_inter_library_loan/engine.rb +13 -0
- data/lib/enju_inter_library_loan/version.rb +3 -0
- data/lib/tasks/enju_inter_library_loan_tasks.rake +4 -0
- data/spec/controllers/inter_library_loans_controller_spec.rb +185 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +71 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/ability.rb +12 -0
- data/spec/dummy/app/models/item.rb +7 -0
- data/spec/dummy/app/models/library.rb +128 -0
- data/spec/dummy/app/models/library_group.rb +86 -0
- data/spec/dummy/app/models/manifestation.rb +6 -0
- data/spec/dummy/app/models/patron.rb +167 -0
- data/spec/dummy/app/models/patron_type.rb +19 -0
- data/spec/dummy/app/models/role.rb +5 -0
- data/spec/dummy/app/models/shelf.rb +54 -0
- data/spec/dummy/app/models/user.rb +27 -0
- data/spec/dummy/app/models/user_has_role.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/page/403.html.erb +9 -0
- data/spec/dummy/app/views/page/403.mobile.erb +5 -0
- data/spec/dummy/app/views/page/403.xml.erb +4 -0
- data/spec/dummy/app/views/page/404.html.erb +9 -0
- data/spec/dummy/app/views/page/404.mobile.erb +5 -0
- data/spec/dummy/app/views/page/404.xml.erb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +47 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +209 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/db/migrate/001_create_patrons.rb +62 -0
- data/spec/dummy/db/migrate/005_create_manifestations.rb +68 -0
- data/spec/dummy/db/migrate/006_create_items.rb +36 -0
- data/spec/dummy/db/migrate/059_create_libraries.rb +34 -0
- data/spec/dummy/db/migrate/069_create_shelves.rb +19 -0
- data/spec/dummy/db/migrate/080_create_library_groups.rb +25 -0
- data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +16 -0
- data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +11 -0
- data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +13 -0
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +31 -0
- data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
- data/spec/dummy/db/schema.rb +289 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/master_model.rb +41 -0
- data/spec/dummy/lib/url_validator.rb +10 -0
- data/spec/dummy/log/test.log +5034 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/inter_library_loan.rb +6 -0
- data/spec/factories/item.rb +7 -0
- data/spec/factories/library.rb +13 -0
- data/spec/factories/manifestation.rb +5 -0
- data/spec/factories/user.rb +31 -0
- data/spec/fixtures/inter_library_loans.yml +84 -0
- data/spec/fixtures/libraries.yml +108 -0
- data/spec/fixtures/library_groups.yml +34 -0
- data/spec/fixtures/patron_types.yml +35 -0
- data/spec/fixtures/patrons.yml +338 -0
- data/spec/fixtures/roles.yml +21 -0
- data/spec/fixtures/user_has_roles.yml +41 -0
- data/spec/fixtures/users.yml +69 -0
- data/spec/models/inter_library_loan_spec.rb +26 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/support/controller_macros.rb +48 -0
- data/spec/support/devise.rb +4 -0
- metadata +386 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
atom_feed(:url => inter_library_loans_url(:format => :atom)) do |feed|
|
2
|
+
feed.title t('inter_library_loan.library_group_inter_library_loan', :library_group_name => @library_group.display_name.localize)
|
3
|
+
feed.updated(@inter_library_loans.first ? @inter_library_loans.first.created_at : Time.zone.now)
|
4
|
+
|
5
|
+
@inter_library_loans.each do |inter_library_loan|
|
6
|
+
feed.entry(inter_library_loan) do |entry|
|
7
|
+
entry.title inter_library_loan.item.manifestation.original_title
|
8
|
+
entry.author(@library_group.display_name.localize)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.inter_library_loan')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<table class="index">
|
5
|
+
<tr>
|
6
|
+
<th><%= t('activerecord.models.item') -%></th>
|
7
|
+
<th><%= t('activerecord.models.library') -%></th>
|
8
|
+
<th><%= t('inter_library_loan.borrowing_library') -%></th>
|
9
|
+
<th>
|
10
|
+
<%= t('activerecord.attributes.inter_library_loan.shipped_at') -%> /
|
11
|
+
<%= t('activerecord.attributes.inter_library_loan.received_at') -%>
|
12
|
+
</th>
|
13
|
+
<th></th>
|
14
|
+
</tr>
|
15
|
+
|
16
|
+
<%- @inter_library_loans.each do |inter_library_loan| -%>
|
17
|
+
<tr class="line<%= cycle("0", "1") -%>">
|
18
|
+
<td>
|
19
|
+
<%= link_to inter_library_loan.item.item_identifier, inter_library_loan.item -%>
|
20
|
+
<br />
|
21
|
+
(<%= link_to inter_library_loan.item.manifestation.original_title, inter_library_loan.item.manifestation -%>)
|
22
|
+
</td>
|
23
|
+
<td><%= link_to inter_library_loan.item.shelf.library.display_name.localize, inter_library_loan.item.shelf.library -%></td>
|
24
|
+
<td><%= link_to inter_library_loan.borrowing_library.display_name.localize, inter_library_loan.borrowing_library -%></td>
|
25
|
+
<td>
|
26
|
+
<%= l(inter_library_loan.shipped_at) if inter_library_loan.shipped_at -%><br />
|
27
|
+
<%= l(inter_library_loan.received_at) if inter_library_loan.received_at -%>
|
28
|
+
</td>
|
29
|
+
<%- if can? :destroy, inter_library_loan -%>
|
30
|
+
<td>
|
31
|
+
<%= link_to t('page.show'), inter_library_loan -%>
|
32
|
+
<%= link_to t('page.edit'), edit_inter_library_loan_path(inter_library_loan) -%>
|
33
|
+
<%= link_to t('page.destroy'), inter_library_loan, :confirm => t('page.are_you_sure'), :method => :delete -%>
|
34
|
+
</td>
|
35
|
+
<%- end -%>
|
36
|
+
</tr>
|
37
|
+
<%- end -%>
|
38
|
+
</table>
|
39
|
+
|
40
|
+
<%= will_paginate(@inter_library_loans) -%>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="submenu" class="ui-corner-all">
|
45
|
+
<ul>
|
46
|
+
<%- if can? :create, InterLibraryLoan -%>
|
47
|
+
<li><%= link_to t('page.new', :model => t('activerecord.models.inter_library_loan')), new_inter_library_loan_path -%></li>
|
48
|
+
<%- end -%>
|
49
|
+
</ul>
|
50
|
+
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
xml.instruct! :xml, :version=>"1.0"
|
2
|
+
xml.rss('version' => "2.0",
|
3
|
+
'xmlns:opensearch' => "http://a9.com/-/spec/opensearch/1.1/",
|
4
|
+
'xmlns:atom' => "http://www.w3.org/2005/Atom"){
|
5
|
+
xml.channel{
|
6
|
+
xml.title t('inter_library_loan.library_group_inter_library_loan', :library_group_name => @library_group.display_name.localize)
|
7
|
+
xml.link inter_library_loans_url
|
8
|
+
xml.description "Next-L Enju, an open source integrated library system developed by Project Next-L"
|
9
|
+
xml.language @locale.to_s
|
10
|
+
xml.ttl "60"
|
11
|
+
xml.tag! "atom:link", :rel => 'self', :href => inter_library_loans_url(:format => :rss)
|
12
|
+
xml.tag! "atom:link", :rel => 'alternate', :href => inter_library_loans_url
|
13
|
+
#xml.tag! "atom:link", :rel => 'search', :type => 'application/opensearchdescription+xml', :href => "http://#{request.host_with_port}/page/opensearch"
|
14
|
+
#unless params[:query].blank?
|
15
|
+
# xml.tag! "opensearch:totalResults", @count[:query_result]
|
16
|
+
# xml.tag! "opensearch:startIndex", @inter_library_loans.offset + 1
|
17
|
+
# xml.tag! "opensearch:itemsPerPage", @inter_library_loans.per_page
|
18
|
+
#xml.tag! "opensearch:Query", :role => 'request', :searchTerms => params[:query], :startPage => (params[:page] || 1)
|
19
|
+
#end
|
20
|
+
@inter_library_loans.each do |inter_library_loan|
|
21
|
+
xml.item do
|
22
|
+
xml.title inter_library_loan.item.manifestation.original_title
|
23
|
+
#xml.description(inter_library_loan.title)
|
24
|
+
# rfc822
|
25
|
+
xml.pubDate inter_library_loan.created_at.utc.rfc822
|
26
|
+
xml.link inter_library_loan_url(inter_library_loan)
|
27
|
+
xml.guid inter_library_loan_url(inter_library_loan), :isPermaLink => "true"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.inter_library_loan')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
|
5
|
+
<%= form_for(@inter_library_loan) do |f| -%>
|
6
|
+
<%= f.error_messages -%>
|
7
|
+
|
8
|
+
<div class="field">
|
9
|
+
<%= f.label t('inter_library_loan.borrowing_library') -%><br />
|
10
|
+
<%= f.select(:borrowing_library_id, @libraries.collect{|l| [l.display_name.localize, l.id]}) -%>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="field">
|
14
|
+
<%= f.label :requested_at -%><br />
|
15
|
+
<%= f.text_field :requested_at, :class => 'date_field' -%>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label t('activerecord.models.item') -%><br />
|
20
|
+
<%- if @item -%>
|
21
|
+
<%= link_to @item.shelf.library.display_name.localize, @item.shelf.library -%>
|
22
|
+
<%= link_to @item.item_identifier, @item -%>
|
23
|
+
(<%= link_to @item.manifestation.original_title, @item.manifestation -%>)
|
24
|
+
<%= f.hidden_field :item_identifier, :value => @item.item_identifier -%>
|
25
|
+
<%- else -%>
|
26
|
+
<%= f.text_field :item_identifier, :class => 'resource_item_identifier' -%>
|
27
|
+
<%- end -%>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="actions">
|
31
|
+
<%= f.submit %>
|
32
|
+
</div>
|
33
|
+
<%- end -%>
|
34
|
+
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="submenu" class="ui-corner-all">
|
39
|
+
<ul>
|
40
|
+
<li><%= link_to t('page.back'), inter_library_loans_path -%></li>
|
41
|
+
</ul>
|
42
|
+
</div>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.inter_library_loan')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<p id="notice"><%= notice %></p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<strong><%= t('activerecord.models.library') -%>:</strong>
|
8
|
+
<%= link_to @inter_library_loan.item.shelf.library.display_name.localize, @inter_library_loan.item.shelf.library -%>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<strong><%= t('inter_library_loan.borrowing_library') -%>:</strong>
|
13
|
+
<%= link_to @inter_library_loan.borrowing_library.display_name.localize, @inter_library_loan.borrowing_library -%>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<strong><%= t('activerecord.models.item') -%>:</strong>
|
18
|
+
<%= link_to @inter_library_loan.item.item_identifier, @inter_library_loan.item -%>
|
19
|
+
(<%= link_to @inter_library_loan.item.manifestation.original_title, @inter_library_loan.item.manifestation -%>)
|
20
|
+
</p>
|
21
|
+
|
22
|
+
<p>
|
23
|
+
<strong><%= t('activerecord.attributes.inter_library_loan.requested_at') -%>:</strong>
|
24
|
+
<%= l(@inter_library_loan.requested_at) if @inter_library_loan.requested_at -%>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<p>
|
28
|
+
<strong><%= t('activerecord.attributes.inter_library_loan.shipped_at') -%>:</strong>
|
29
|
+
<%= l(@inter_library_loan.shipped_at) if @inter_library_loan.shipped_at -%>
|
30
|
+
</p>
|
31
|
+
|
32
|
+
<p>
|
33
|
+
<strong><%= t('activerecord.attributes.inter_library_loan.received_at') -%>:</strong>
|
34
|
+
<%= l(@inter_library_loan.received_at) if @inter_library_loan.received_at -%>
|
35
|
+
</p>
|
36
|
+
|
37
|
+
<p>
|
38
|
+
<strong><%= t('activerecord.attributes.inter_library_loan.return_shipped_at') -%>:</strong>
|
39
|
+
<%= l(@inter_library_loan.return_shipped_at) if @inter_library_loan.return_shipped_at -%>
|
40
|
+
</p>
|
41
|
+
|
42
|
+
<p>
|
43
|
+
<strong><%= t('activerecord.attributes.inter_library_loan.return_received_at') -%>:</strong>
|
44
|
+
<%= l(@inter_library_loan.return_received_at) if @inter_library_loan.return_received_at -%>
|
45
|
+
</p>
|
46
|
+
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<div id="submenu" class="ui-corner-all">
|
51
|
+
<ul>
|
52
|
+
<li><%= link_to t('page.edit'), edit_inter_library_loan_path(@inter_library_loan) -%></li>
|
53
|
+
<%- unless @inter_library_loan.item.shelf.library == current_user.library -%>
|
54
|
+
<li><%= link_to t('inter_library_loan.return_this_item'), edit_inter_library_loan_path(@inter_library_loan) -%></li>
|
55
|
+
<%- end -%>
|
56
|
+
<li><%= back_to_index(flash[:page_info]) -%></li>
|
57
|
+
</ul>
|
58
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
ja:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
inter_library_loan: Inter library loan
|
5
|
+
|
6
|
+
attributes:
|
7
|
+
inter_library_loan:
|
8
|
+
requested_at: Requested at
|
9
|
+
shipped_at: Shipped at
|
10
|
+
received_at: Received at
|
11
|
+
return_shipped_at: Return shipped at
|
12
|
+
return_received_at: Return received at
|
13
|
+
deleted_at: Deleted at
|
14
|
+
state: State
|
15
|
+
|
16
|
+
inter_library_loan:
|
17
|
+
library_group_inter_library_loan: "Inter library loans in %{library_group_name}"
|
18
|
+
borrowing_library: "Borrowing library"
|
19
|
+
return_this_item: "Return this item"
|
20
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
ja:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
inter_library_loan: 相互貸借
|
5
|
+
|
6
|
+
attributes:
|
7
|
+
inter_library_loan:
|
8
|
+
requested_at: 依頼時刻
|
9
|
+
shipped_at: 発送時刻
|
10
|
+
received_at: 受取時刻
|
11
|
+
return_shipped_at: 返却発送時刻
|
12
|
+
return_received_at: 返却受取時刻
|
13
|
+
deleted_at: 削除時刻
|
14
|
+
state: 状態
|
15
|
+
|
16
|
+
inter_library_loan:
|
17
|
+
library_group_inter_library_loan: "%{library_group_name} の相互貸借"
|
18
|
+
borrowing_library: "借受館"
|
19
|
+
return_this_item: "この資料を返却する"
|
20
|
+
|
data/config/routes.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateInterLibraryLoans < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :inter_library_loans do |t|
|
4
|
+
t.integer :item_id, :null => false
|
5
|
+
t.integer :borrowing_library_id, :null => false
|
6
|
+
t.timestamp :requested_at
|
7
|
+
t.timestamp :shipped_at
|
8
|
+
t.timestamp :received_at
|
9
|
+
t.timestamp :return_shipped_at
|
10
|
+
t.timestamp :return_received_at
|
11
|
+
t.timestamp :deleted_at
|
12
|
+
t.string :state
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
add_index :inter_library_loans, :item_id
|
17
|
+
add_index :inter_library_loans, :borrowing_library_id
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
drop_table :inter_library_loans
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'devise'
|
2
|
+
require 'cancan'
|
3
|
+
require 'will_paginate'
|
4
|
+
require 'state_machine'
|
5
|
+
require 'friendly_id'
|
6
|
+
require 'attribute_normalizer'
|
7
|
+
require 'sunspot_rails'
|
8
|
+
require 'addressable/uri'
|
9
|
+
|
10
|
+
module EnjuInterLibraryLoan
|
11
|
+
class Engine < ::Rails::Engine
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'sunspot/rails/spec_helper'
|
3
|
+
|
4
|
+
describe InterLibraryLoansController do
|
5
|
+
fixtures :all
|
6
|
+
disconnect_sunspot
|
7
|
+
|
8
|
+
describe "GET index" do
|
9
|
+
describe "When logged in as Administrator" do
|
10
|
+
before(:each) do
|
11
|
+
sign_in FactoryGirl.create(:admin)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "assigns all inter_library_loans as @inter_library_loans" do
|
15
|
+
get :index
|
16
|
+
assigns(:inter_library_loans).should eq(InterLibraryLoan.page(1))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "When logged in as Librarian" do
|
21
|
+
before(:each) do
|
22
|
+
sign_in FactoryGirl.create(:librarian)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "assigns all inter_library_loans as @inter_library_loans" do
|
26
|
+
get :index
|
27
|
+
assigns(:inter_library_loans).should eq(InterLibraryLoan.page(1))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "When logged in as User" do
|
32
|
+
before(:each) do
|
33
|
+
sign_in FactoryGirl.create(:user)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "assigns empty as @inter_library_loans" do
|
37
|
+
get :index
|
38
|
+
assigns(:inter_library_loans).should be_empty
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "When not logged in" do
|
43
|
+
it "assigns empty as @inter_library_loans" do
|
44
|
+
get :index
|
45
|
+
assigns(:inter_library_loans).should be_empty
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "GET show" do
|
51
|
+
describe "When logged in as Administrator" do
|
52
|
+
before(:each) do
|
53
|
+
sign_in FactoryGirl.create(:admin)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
57
|
+
inter_library_loan = FactoryGirl.create(:inter_library_loan)
|
58
|
+
get :show, :id => inter_library_loan.id
|
59
|
+
assigns(:inter_library_loan).should eq(inter_library_loan)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "When logged in as Librarian" do
|
64
|
+
before(:each) do
|
65
|
+
sign_in FactoryGirl.create(:librarian)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
69
|
+
inter_library_loan = FactoryGirl.create(:inter_library_loan)
|
70
|
+
get :show, :id => inter_library_loan.id
|
71
|
+
assigns(:inter_library_loan).should eq(inter_library_loan)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "When logged in as User" do
|
76
|
+
before(:each) do
|
77
|
+
sign_in FactoryGirl.create(:user)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
81
|
+
inter_library_loan = FactoryGirl.create(:inter_library_loan)
|
82
|
+
get :show, :id => inter_library_loan.id
|
83
|
+
assigns(:inter_library_loan).should eq(inter_library_loan)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "When not logged in" do
|
88
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
89
|
+
inter_library_loan = FactoryGirl.create(:inter_library_loan)
|
90
|
+
get :show, :id => inter_library_loan.id
|
91
|
+
assigns(:inter_library_loan).should eq(inter_library_loan)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "GET new" do
|
97
|
+
describe "When logged in as Administrator" do
|
98
|
+
before(:each) do
|
99
|
+
sign_in FactoryGirl.create(:admin)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
103
|
+
get :new
|
104
|
+
assigns(:inter_library_loan).should_not be_valid
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "When logged in as Librarian" do
|
109
|
+
before(:each) do
|
110
|
+
sign_in FactoryGirl.create(:librarian)
|
111
|
+
end
|
112
|
+
|
113
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
114
|
+
get :new
|
115
|
+
assigns(:inter_library_loan).should_not be_valid
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "When logged in as User" do
|
120
|
+
before(:each) do
|
121
|
+
sign_in FactoryGirl.create(:user)
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should not assign the requested inter_library_loan as @inter_library_loan" do
|
125
|
+
get :new
|
126
|
+
assigns(:inter_library_loan).should_not be_valid
|
127
|
+
response.should be_forbidden
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe "When not logged in" do
|
132
|
+
it "should not assign the requested inter_library_loan as @inter_library_loan" do
|
133
|
+
get :new
|
134
|
+
assigns(:inter_library_loan).should_not be_valid
|
135
|
+
response.should redirect_to(new_user_session_url)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
describe "GET edit" do
|
141
|
+
describe "When logged in as Administrator" do
|
142
|
+
before(:each) do
|
143
|
+
sign_in FactoryGirl.create(:admin)
|
144
|
+
end
|
145
|
+
|
146
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
147
|
+
inter_library_loan = FactoryGirl.create(:inter_library_loan)
|
148
|
+
get :edit, :id => inter_library_loan.id
|
149
|
+
assigns(:inter_library_loan).should eq(inter_library_loan)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "When logged in as Librarian" do
|
154
|
+
before(:each) do
|
155
|
+
sign_in FactoryGirl.create(:librarian)
|
156
|
+
end
|
157
|
+
|
158
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
159
|
+
inter_library_loan = FactoryGirl.create(:inter_library_loan)
|
160
|
+
get :edit, :id => inter_library_loan.id
|
161
|
+
assigns(:inter_library_loan).should eq(inter_library_loan)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe "When logged in as User" do
|
166
|
+
before(:each) do
|
167
|
+
sign_in FactoryGirl.create(:user)
|
168
|
+
end
|
169
|
+
|
170
|
+
it "assigns the requested inter_library_loan as @inter_library_loan" do
|
171
|
+
inter_library_loan = FactoryGirl.create(:inter_library_loan)
|
172
|
+
get :edit, :id => inter_library_loan.id
|
173
|
+
response.should be_forbidden
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe "When not logged in" do
|
178
|
+
it "should not assign the requested inter_library_loan as @inter_library_loan" do
|
179
|
+
inter_library_loan = FactoryGirl.create(:inter_library_loan)
|
180
|
+
get :edit, :id => inter_library_loan.id
|
181
|
+
response.should redirect_to(new_user_session_url)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|