enju_subject 0.1.0.pre12 → 0.1.0.pre13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/subjects_controller.rb +3 -9
- data/app/models/classification.rb +6 -17
- data/app/models/classification_type.rb +2 -2
- data/app/models/enju_subject/ability.rb +0 -5
- data/app/models/subject.rb +7 -7
- data/app/models/subject_heading_type.rb +2 -2
- data/app/models/subject_heading_type_has_subject.rb +2 -2
- data/app/models/subject_sweeper.rb +2 -10
- data/app/models/subject_type.rb +2 -2
- data/app/models/work_has_subject.rb +2 -2
- data/app/views/classifications/index.html.erb +51 -4
- data/app/views/manifestations/_classification_detail.html.erb +14 -0
- data/app/views/manifestations/_subject_detail.html.erb +14 -0
- data/app/views/subjects/index.html.erb +1 -3
- data/app/views/subjects/show.html.erb +2 -6
- data/db/migrate/20130504133816_add_manifestation_id_to_subject.rb +6 -0
- data/db/migrate/20130504143515_add_manifestation_id_to_classification.rb +6 -0
- data/lib/enju_subject/manifestation.rb +5 -9
- data/lib/enju_subject/version.rb +1 -1
- data/lib/generators/enju_subject/setup/templates/db/fixtures/classification_types.yml +8 -2
- data/spec/dummy/app/models/ability.rb +0 -5
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20130421093852_add_periodical_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb +7 -0
- data/spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb +5 -0
- data/spec/dummy/db/schema.rb +21 -27
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_1n5 +0 -0
- data/spec/fixtures/classification_types.yml +2 -2
- data/spec/fixtures/classifications.yml +3 -2
- data/spec/fixtures/subject_heading_type_has_subjects.yml +2 -2
- data/spec/fixtures/subject_heading_types.yml +2 -2
- data/spec/fixtures/subject_types.yml +2 -2
- data/spec/fixtures/subjects.yml +3 -0
- data/spec/fixtures/work_has_subjects.yml +2 -2
- data/spec/models/classification_spec.rb +3 -2
- data/spec/models/classification_type_spec.rb +2 -2
- data/spec/models/subject_heading_type_has_subject_spec.rb +2 -2
- data/spec/models/subject_heading_type_spec.rb +2 -2
- data/spec/models/subject_spec.rb +2 -0
- data/spec/models/subject_type_spec.rb +2 -2
- data/spec/models/work_has_subject_spec.rb +2 -2
- metadata +33 -29
- data/app/controllers/subject_has_classifications_controller.rb +0 -97
- data/app/models/subject_has_classification.rb +0 -37
- data/app/views/classifications/_index.html.erb +0 -52
- data/app/views/classifications/_index_subject.html.erb +0 -62
- data/app/views/subject_has_classifications/edit.html.erb +0 -30
- data/app/views/subject_has_classifications/index.html.erb +0 -38
- data/app/views/subject_has_classifications/new.html.erb +0 -32
- data/app/views/subject_has_classifications/show.html.erb +0 -22
- data/app/views/subjects/_index_classification.html.erb +0 -57
- data/db/migrate/143_create_subject_has_classifications.rb +0 -16
- data/spec/controllers/subject_has_classifications_controller_spec.rb +0 -443
- data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +0 -13
- data/spec/dummy/solr/data/test/index/segments_19e +0 -0
- data/spec/factories/subject_has_classification.rb +0 -6
- data/spec/fixtures/subject_has_classifications.yml +0 -74
- data/spec/models/subject_has_classification_spec.rb +0 -20
@@ -1,30 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.subject_has_classification')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
|
5
|
-
<%= form_for(@subject_has_classification) do |f| -%>
|
6
|
-
<%= f.error_messages -%>
|
7
|
-
<div class="field">
|
8
|
-
<%= f.label t('activerecord.models.subject') -%><br />
|
9
|
-
<%= f.text_field :subject_id -%>
|
10
|
-
</div>
|
11
|
-
|
12
|
-
<div class="field">
|
13
|
-
<%= f.label t('activerecord.models.classification') -%><br />
|
14
|
-
<%= f.text_field :classification_id -%>
|
15
|
-
</div>
|
16
|
-
|
17
|
-
<div class="actions">
|
18
|
-
<%= f.submit %>
|
19
|
-
</div>
|
20
|
-
<%- end -%>
|
21
|
-
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
|
25
|
-
<div id="submenu" class="ui-corner-all">
|
26
|
-
<ul>
|
27
|
-
<li><%= link_to t('page.show'), @subject_has_classification -%></li>
|
28
|
-
<li><%= link_to t('page.back'), subject_has_classifications_path -%></li>
|
29
|
-
</ul>
|
30
|
-
</div>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.subject_has_classification')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
|
5
|
-
<table class="table table-striped index">
|
6
|
-
<tr>
|
7
|
-
<th><%= t('activerecord.models.subject') -%></th>
|
8
|
-
<th><%= t('activerecord.models.classification') -%></th>
|
9
|
-
<th></th>
|
10
|
-
<th></th>
|
11
|
-
</tr>
|
12
|
-
|
13
|
-
<%- @subject_has_classifications.each do |subject_has_classification| -%>
|
14
|
-
<tr class="line<%= cycle("0", "1") -%>">
|
15
|
-
<td><%= link_to subject_has_classification.subject.term, subject_has_classification.subject -%></td>
|
16
|
-
<td><%= link_to subject_has_classification.classification.category, subject_has_classification.classification -%></td>
|
17
|
-
<td><%= link_to t('page.show'), subject_has_classification -%></td>
|
18
|
-
<td>
|
19
|
-
<% if can? :delete, subject_has_classification %>
|
20
|
-
<%= link_to t('page.edit'), edit_subject_has_classification_path(subject_has_classification) -%>
|
21
|
-
<%= link_to t('page.destroy'), subject_has_classification, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
22
|
-
<% end %>
|
23
|
-
</td>
|
24
|
-
</tr>
|
25
|
-
<%- end -%>
|
26
|
-
</table>
|
27
|
-
|
28
|
-
<%= paginate(@subject_has_classifications) -%>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
|
32
|
-
<div id="submenu" class="ui-corner-all">
|
33
|
-
<!--
|
34
|
-
<ul>
|
35
|
-
<li><%= link_to t('page.new', :model => t('activerecord.models.subject_has_classification')), new_subject_has_classification_path -%></li>
|
36
|
-
</ul>
|
37
|
-
-->
|
38
|
-
</div>
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.subject_has_classification')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
|
5
|
-
<%= form_for(@subject_has_classification) do |f| -%>
|
6
|
-
<%= f.error_messages -%>
|
7
|
-
|
8
|
-
<div class="field">
|
9
|
-
<%= f.label t('activerecord.models.subject') -%><br />
|
10
|
-
<%= link_to @subject_has_classification.subject.term, @subject_has_classification.subject if @subject_has_classification.subject -%>
|
11
|
-
<%= f.hidden_field :subject_id -%>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
<div class="field">
|
15
|
-
<%= f.label t('activerecord.models.classification') -%><br />
|
16
|
-
<%= link_to @subject_has_classification.classification.category, @subject_has_classification.classification if @subject_has_classification.classification -%>
|
17
|
-
<%= f.hidden_field :classification_id -%>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<div class="actions">
|
21
|
-
<%= f.submit %>
|
22
|
-
</div>
|
23
|
-
<%- end -%>
|
24
|
-
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<div id="submenu" class="ui-corner-all">
|
29
|
-
<ul>
|
30
|
-
<li><%= link_to t('page.back'), subject_has_classifications_path -%></li>
|
31
|
-
</ul>
|
32
|
-
</div>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.subject_has_classification')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
<p>
|
5
|
-
<strong><%= t('activerecord.models.subject') -%>:</strong>
|
6
|
-
<%= link_to @subject_has_classification.subject.term, @subject_has_classification.subject -%>
|
7
|
-
</p>
|
8
|
-
|
9
|
-
<p>
|
10
|
-
<strong><%= t('activerecord.models.classification') -%>:</strong>
|
11
|
-
<%= link_to @subject_has_classification.classification.category, @subject_has_classification.classification -%>
|
12
|
-
</p>
|
13
|
-
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
|
17
|
-
<div id="submenu" class="ui-corner-all">
|
18
|
-
<ul>
|
19
|
-
<li><%= link_to t('page.edit'), edit_subject_has_classification_path(@subject_has_classification) -%></li>
|
20
|
-
<li><%= back_to_index(flash[:page_info]) -%></li>
|
21
|
-
</ul>
|
22
|
-
</div>
|
@@ -1,57 +0,0 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.subject')) -%></h1>
|
3
|
-
<div id="content_list">
|
4
|
-
|
5
|
-
<h2 class="resource_title"><%= link_to @classification.category, @classification -%></h2>
|
6
|
-
<div class="search_form">
|
7
|
-
<%= form_for :subjects, :url => classification_subjects_path(@classification), :html => {:method => 'get'} do -%>
|
8
|
-
<p>
|
9
|
-
<%= t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
|
10
|
-
<%= submit_tag t('page.search') -%>
|
11
|
-
<%- if can? :create, WorkHasSubject -%>
|
12
|
-
<%= render 'page/add' %>
|
13
|
-
<%- end -%>
|
14
|
-
</p>
|
15
|
-
<%- end -%>
|
16
|
-
</div>
|
17
|
-
|
18
|
-
<table class="table table-striped index">
|
19
|
-
<tr>
|
20
|
-
<th><%= t('activerecord.attributes.subject.term') -%></th>
|
21
|
-
<th></th>
|
22
|
-
</tr>
|
23
|
-
<%- subjects.each do |subject| -%>
|
24
|
-
<tr class="line<%= cycle("0", "1") -%>">
|
25
|
-
<td><%= link_to subject.term, subject -%></td>
|
26
|
-
<td>
|
27
|
-
<%- if can? :update, subject -%>
|
28
|
-
<%= link_to t('page.edit'), edit_subject_path(subject) -%>
|
29
|
-
<% end %>
|
30
|
-
</td>
|
31
|
-
<td>
|
32
|
-
<%- if params[:mode] == 'add' -%>
|
33
|
-
<%- if can? :update, subject -%>
|
34
|
-
<%= link_to t('page.add'), new_classification_subject_has_classification_path(@classification, :subject_id => subject.id) unless @classification.subjects.include?(subject) -%>
|
35
|
-
<% end %>
|
36
|
-
<%- else -%>
|
37
|
-
<%- has_classification = @classification.subject_has_classifications.find_by_subject_id(subject) -%>
|
38
|
-
<% if can? :delete, has_classification %>
|
39
|
-
<%= link_to t('page.destroy'), classification_subject_has_classification_path(@classification, has_classification), :data => {:confirm => t('page.are_you_sure')}, :method => :delete if has_classification -%>
|
40
|
-
<% end %>
|
41
|
-
<%- end -%>
|
42
|
-
</td>
|
43
|
-
</tr>
|
44
|
-
<%- end -%>
|
45
|
-
</table>
|
46
|
-
|
47
|
-
<%= paginate(subjects) -%>
|
48
|
-
</div>
|
49
|
-
</div>
|
50
|
-
|
51
|
-
<div id="submenu" class="ui-corner-all">
|
52
|
-
<ul>
|
53
|
-
<%- if can? :create, Subject -%>
|
54
|
-
<li><%= link_to t('page.new', :model => t('activerecord.models.subject')), new_classification_subject_path(@classification) -%></li>
|
55
|
-
<%- end -%>
|
56
|
-
</ul>
|
57
|
-
</div>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class CreateSubjectHasClassifications < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :subject_has_classifications do |t|
|
4
|
-
t.references :subject, :polymorphic => true
|
5
|
-
t.integer :classification_id, :null => false
|
6
|
-
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
add_index :subject_has_classifications, :subject_id
|
10
|
-
add_index :subject_has_classifications, :classification_id
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.down
|
14
|
-
drop_table :subject_has_classifications
|
15
|
-
end
|
16
|
-
end
|
@@ -1,443 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'sunspot/rails/spec_helper'
|
3
|
-
|
4
|
-
describe SubjectHasClassificationsController do
|
5
|
-
fixtures :all
|
6
|
-
disconnect_sunspot
|
7
|
-
|
8
|
-
def valid_attributes
|
9
|
-
FactoryGirl.attributes_for(:subject_has_classification)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "GET index" do
|
13
|
-
before(:each) do
|
14
|
-
FactoryGirl.create(:subject_has_classification)
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "When logged in as Administrator" do
|
18
|
-
login_admin
|
19
|
-
|
20
|
-
it "assigns all subject_has_classifications as @subject_has_classifications" do
|
21
|
-
get :index
|
22
|
-
assigns(:subject_has_classifications).should eq(SubjectHasClassification.page(1))
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "When logged in as Librarian" do
|
27
|
-
login_librarian
|
28
|
-
|
29
|
-
it "assigns all subject_has_classifications as @subject_has_classifications" do
|
30
|
-
get :index
|
31
|
-
assigns(:subject_has_classifications).should eq(SubjectHasClassification.page(1))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "When logged in as User" do
|
36
|
-
login_user
|
37
|
-
|
38
|
-
it "assigns all subject_has_classifications as @subject_has_classifications" do
|
39
|
-
get :index
|
40
|
-
assigns(:subject_has_classifications).should eq(SubjectHasClassification.page(1))
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "When not logged in" do
|
45
|
-
it "should not assign subject_has_classifications as @subject_has_classifications" do
|
46
|
-
get :index
|
47
|
-
assigns(:subject_has_classifications).should eq(SubjectHasClassification.page(1))
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "GET show" do
|
53
|
-
describe "When logged in as Administrator" do
|
54
|
-
login_admin
|
55
|
-
|
56
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
57
|
-
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
58
|
-
get :show, :id => subject_has_classification.id
|
59
|
-
assigns(:subject_has_classification).should eq(subject_has_classification)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "When logged in as Librarian" do
|
64
|
-
login_librarian
|
65
|
-
|
66
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
67
|
-
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
68
|
-
get :show, :id => subject_has_classification.id
|
69
|
-
assigns(:subject_has_classification).should eq(subject_has_classification)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "When logged in as User" do
|
74
|
-
login_user
|
75
|
-
|
76
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
77
|
-
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
78
|
-
get :show, :id => subject_has_classification.id
|
79
|
-
assigns(:subject_has_classification).should eq(subject_has_classification)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe "When not logged in" do
|
84
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
85
|
-
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
86
|
-
get :show, :id => subject_has_classification.id
|
87
|
-
assigns(:subject_has_classification).should eq(subject_has_classification)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "GET new" do
|
93
|
-
describe "When logged in as Administrator" do
|
94
|
-
login_admin
|
95
|
-
|
96
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
97
|
-
get :new
|
98
|
-
assigns(:subject_has_classification).should_not be_valid
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "When logged in as Librarian" do
|
103
|
-
login_librarian
|
104
|
-
|
105
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
106
|
-
get :new
|
107
|
-
assigns(:subject_has_classification).should_not be_valid
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe "When logged in as User" do
|
112
|
-
login_user
|
113
|
-
|
114
|
-
it "should not assign the requested subject_has_classification as @subject_has_classification" do
|
115
|
-
get :new
|
116
|
-
assigns(:subject_has_classification).should_not be_valid
|
117
|
-
response.should be_forbidden
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe "When not logged in" do
|
122
|
-
it "should not assign the requested subject_has_classification as @subject_has_classification" do
|
123
|
-
get :new
|
124
|
-
assigns(:subject_has_classification).should_not be_valid
|
125
|
-
response.should redirect_to(new_user_session_url)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe "GET edit" do
|
131
|
-
describe "When logged in as Administrator" do
|
132
|
-
login_admin
|
133
|
-
|
134
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
135
|
-
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
136
|
-
get :edit, :id => subject_has_classification.id
|
137
|
-
assigns(:subject_has_classification).should eq(subject_has_classification)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe "When logged in as Librarian" do
|
142
|
-
login_librarian
|
143
|
-
|
144
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
145
|
-
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
146
|
-
get :edit, :id => subject_has_classification.id
|
147
|
-
assigns(:subject_has_classification).should eq(subject_has_classification)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe "When logged in as User" do
|
152
|
-
login_user
|
153
|
-
|
154
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
155
|
-
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
156
|
-
get :edit, :id => subject_has_classification.id
|
157
|
-
response.should be_forbidden
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe "When not logged in" do
|
162
|
-
it "should not assign the requested subject_has_classification as @subject_has_classification" do
|
163
|
-
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
164
|
-
get :edit, :id => subject_has_classification.id
|
165
|
-
response.should redirect_to(new_user_session_url)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
describe "POST create" do
|
171
|
-
before(:each) do
|
172
|
-
@attrs = valid_attributes
|
173
|
-
@invalid_attrs = {:subject_id => ''}
|
174
|
-
end
|
175
|
-
|
176
|
-
describe "When logged in as Administrator" do
|
177
|
-
login_admin
|
178
|
-
|
179
|
-
describe "with valid params" do
|
180
|
-
it "assigns a newly created subject_has_classification as @subject_has_classification" do
|
181
|
-
post :create, :subject_has_classification => @attrs
|
182
|
-
assigns(:subject_has_classification).should be_valid
|
183
|
-
end
|
184
|
-
|
185
|
-
it "redirects to the created subject_has_classification" do
|
186
|
-
post :create, :subject_has_classification => @attrs
|
187
|
-
response.should redirect_to(subject_has_classification_url(assigns(:subject_has_classification)))
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe "with invalid params" do
|
192
|
-
it "assigns a newly created but unsaved subject_has_classification as @subject_has_classification" do
|
193
|
-
post :create, :subject_has_classification => @invalid_attrs
|
194
|
-
assigns(:subject_has_classification).should_not be_valid
|
195
|
-
end
|
196
|
-
|
197
|
-
it "re-renders the 'new' template" do
|
198
|
-
post :create, :subject_has_classification => @invalid_attrs
|
199
|
-
response.should render_template("new")
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
describe "When logged in as Librarian" do
|
205
|
-
login_librarian
|
206
|
-
|
207
|
-
describe "with valid params" do
|
208
|
-
it "assigns a newly created subject_has_classification as @subject_has_classification" do
|
209
|
-
post :create, :subject_has_classification => @attrs
|
210
|
-
assigns(:subject_has_classification).should be_valid
|
211
|
-
end
|
212
|
-
|
213
|
-
it "redirects to the created subject_has_classification" do
|
214
|
-
post :create, :subject_has_classification => @attrs
|
215
|
-
response.should redirect_to(subject_has_classification_url(assigns(:subject_has_classification)))
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
describe "with invalid params" do
|
220
|
-
it "assigns a newly created but unsaved subject_has_classification as @subject_has_classification" do
|
221
|
-
post :create, :subject_has_classification => @invalid_attrs
|
222
|
-
assigns(:subject_has_classification).should_not be_valid
|
223
|
-
end
|
224
|
-
|
225
|
-
it "re-renders the 'new' template" do
|
226
|
-
post :create, :subject_has_classification => @invalid_attrs
|
227
|
-
response.should render_template("new")
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
describe "When logged in as User" do
|
233
|
-
login_user
|
234
|
-
|
235
|
-
describe "with valid params" do
|
236
|
-
it "assigns a newly created subject_has_classification as @subject_has_classification" do
|
237
|
-
post :create, :subject_has_classification => @attrs
|
238
|
-
assigns(:subject_has_classification).should be_valid
|
239
|
-
end
|
240
|
-
|
241
|
-
it "should be forbidden" do
|
242
|
-
post :create, :subject_has_classification => @attrs
|
243
|
-
response.should be_forbidden
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
describe "with invalid params" do
|
248
|
-
it "assigns a newly created but unsaved subject_has_classification as @subject_has_classification" do
|
249
|
-
post :create, :subject_has_classification => @invalid_attrs
|
250
|
-
assigns(:subject_has_classification).should_not be_valid
|
251
|
-
end
|
252
|
-
|
253
|
-
it "should be forbidden" do
|
254
|
-
post :create, :subject_has_classification => @invalid_attrs
|
255
|
-
response.should be_forbidden
|
256
|
-
end
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
describe "When not logged in" do
|
261
|
-
describe "with valid params" do
|
262
|
-
it "assigns a newly created subject_has_classification as @subject_has_classification" do
|
263
|
-
post :create, :subject_has_classification => @attrs
|
264
|
-
assigns(:subject_has_classification).should be_valid
|
265
|
-
end
|
266
|
-
|
267
|
-
it "should be forbidden" do
|
268
|
-
post :create, :subject_has_classification => @attrs
|
269
|
-
response.should redirect_to(new_user_session_url)
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
describe "with invalid params" do
|
274
|
-
it "assigns a newly created but unsaved subject_has_classification as @subject_has_classification" do
|
275
|
-
post :create, :subject_has_classification => @invalid_attrs
|
276
|
-
assigns(:subject_has_classification).should_not be_valid
|
277
|
-
end
|
278
|
-
|
279
|
-
it "should be forbidden" do
|
280
|
-
post :create, :subject_has_classification => @invalid_attrs
|
281
|
-
response.should redirect_to(new_user_session_url)
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
describe "PUT update" do
|
288
|
-
before(:each) do
|
289
|
-
@subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
290
|
-
@attrs = valid_attributes
|
291
|
-
@invalid_attrs = {:subject_id => ''}
|
292
|
-
end
|
293
|
-
|
294
|
-
describe "When logged in as Administrator" do
|
295
|
-
login_admin
|
296
|
-
|
297
|
-
describe "with valid params" do
|
298
|
-
it "updates the requested subject_has_classification" do
|
299
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
300
|
-
end
|
301
|
-
|
302
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
303
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
304
|
-
assigns(:subject_has_classification).should eq(@subject_has_classification)
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
describe "with invalid params" do
|
309
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
310
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @invalid_attrs
|
311
|
-
response.should render_template("edit")
|
312
|
-
end
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
describe "When logged in as Librarian" do
|
317
|
-
login_librarian
|
318
|
-
|
319
|
-
describe "with valid params" do
|
320
|
-
it "updates the requested subject_has_classification" do
|
321
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
322
|
-
end
|
323
|
-
|
324
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
325
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
326
|
-
assigns(:subject_has_classification).should eq(@subject_has_classification)
|
327
|
-
response.should redirect_to(@subject_has_classification)
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
|
-
describe "with invalid params" do
|
332
|
-
it "assigns the subject_has_classification as @subject_has_classification" do
|
333
|
-
put :update, :id => @subject_has_classification, :subject_has_classification => @invalid_attrs
|
334
|
-
assigns(:subject_has_classification).should_not be_valid
|
335
|
-
end
|
336
|
-
|
337
|
-
it "re-renders the 'edit' template" do
|
338
|
-
put :update, :id => @subject_has_classification, :subject_has_classification => @invalid_attrs
|
339
|
-
response.should render_template("edit")
|
340
|
-
end
|
341
|
-
end
|
342
|
-
end
|
343
|
-
|
344
|
-
describe "When logged in as User" do
|
345
|
-
login_user
|
346
|
-
|
347
|
-
describe "with valid params" do
|
348
|
-
it "updates the requested subject_has_classification" do
|
349
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
350
|
-
end
|
351
|
-
|
352
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
353
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
354
|
-
assigns(:subject_has_classification).should eq(@subject_has_classification)
|
355
|
-
response.should be_forbidden
|
356
|
-
end
|
357
|
-
end
|
358
|
-
|
359
|
-
describe "with invalid params" do
|
360
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
361
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @invalid_attrs
|
362
|
-
response.should be_forbidden
|
363
|
-
end
|
364
|
-
end
|
365
|
-
end
|
366
|
-
|
367
|
-
describe "When not logged in" do
|
368
|
-
describe "with valid params" do
|
369
|
-
it "updates the requested subject_has_classification" do
|
370
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
371
|
-
end
|
372
|
-
|
373
|
-
it "should be forbidden" do
|
374
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
375
|
-
response.should redirect_to(new_user_session_url)
|
376
|
-
end
|
377
|
-
end
|
378
|
-
|
379
|
-
describe "with invalid params" do
|
380
|
-
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
381
|
-
put :update, :id => @subject_has_classification.id, :subject_has_classification => @invalid_attrs
|
382
|
-
response.should redirect_to(new_user_session_url)
|
383
|
-
end
|
384
|
-
end
|
385
|
-
end
|
386
|
-
end
|
387
|
-
|
388
|
-
describe "DELETE destroy" do
|
389
|
-
before(:each) do
|
390
|
-
@subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
391
|
-
end
|
392
|
-
|
393
|
-
describe "When logged in as Administrator" do
|
394
|
-
login_admin
|
395
|
-
|
396
|
-
it "destroys the requested subject_has_classification" do
|
397
|
-
delete :destroy, :id => @subject_has_classification.id
|
398
|
-
end
|
399
|
-
|
400
|
-
it "redirects to the subject_has_classifications list" do
|
401
|
-
delete :destroy, :id => @subject_has_classification.id
|
402
|
-
response.should redirect_to(subject_has_classifications_url)
|
403
|
-
end
|
404
|
-
end
|
405
|
-
|
406
|
-
describe "When logged in as Librarian" do
|
407
|
-
login_librarian
|
408
|
-
|
409
|
-
it "destroys the requested subject_has_classification" do
|
410
|
-
delete :destroy, :id => @subject_has_classification.id
|
411
|
-
end
|
412
|
-
|
413
|
-
it "should be forbidden" do
|
414
|
-
delete :destroy, :id => @subject_has_classification.id
|
415
|
-
response.should redirect_to(subject_has_classifications_url)
|
416
|
-
end
|
417
|
-
end
|
418
|
-
|
419
|
-
describe "When logged in as User" do
|
420
|
-
login_user
|
421
|
-
|
422
|
-
it "destroys the requested subject_has_classification" do
|
423
|
-
delete :destroy, :id => @subject_has_classification.id
|
424
|
-
end
|
425
|
-
|
426
|
-
it "should be forbidden" do
|
427
|
-
delete :destroy, :id => @subject_has_classification.id
|
428
|
-
response.should be_forbidden
|
429
|
-
end
|
430
|
-
end
|
431
|
-
|
432
|
-
describe "When not logged in" do
|
433
|
-
it "destroys the requested subject_has_classification" do
|
434
|
-
delete :destroy, :id => @subject_has_classification.id
|
435
|
-
end
|
436
|
-
|
437
|
-
it "should be forbidden" do
|
438
|
-
delete :destroy, :id => @subject_has_classification.id
|
439
|
-
response.should redirect_to(new_user_session_url)
|
440
|
-
end
|
441
|
-
end
|
442
|
-
end
|
443
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class RenameSeriesStatementManifestationIdToRootManifestationId < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
remove_index :series_statements, :series_statement_identifier
|
4
|
-
rename_column :series_statements, :manifestation_id, :root_manifestation_id
|
5
|
-
add_index :series_statements, :series_statement_identifier
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
remove_index :series_statements, :series_statement_identifier
|
10
|
-
rename_column :series_statements, :root_manifestation_id, :manifestation_id
|
11
|
-
add_index :series_statements, :series_statement_identifier
|
12
|
-
end
|
13
|
-
end
|
Binary file
|