enju_biblio 0.1.0.pre37 → 0.1.0.pre38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/addresses.js +2 -0
  3. data/app/assets/javascripts/identifier_types.js +2 -0
  4. data/app/assets/javascripts/identifiers.js +2 -0
  5. data/app/assets/stylesheets/addresses.css +4 -0
  6. data/app/assets/stylesheets/identifier_types.css +4 -0
  7. data/app/assets/stylesheets/identifiers.css +4 -0
  8. data/app/controllers/addresses_controller.rb +2 -0
  9. data/app/controllers/carrier_types_controller.rb +85 -5
  10. data/app/controllers/identifier_types_controller.rb +84 -0
  11. data/app/controllers/identifiers_controller.rb +14 -0
  12. data/app/controllers/manifestations_controller.rb +14 -21
  13. data/app/helpers/addresses_helper.rb +2 -0
  14. data/app/helpers/identifier_types_helper.rb +2 -0
  15. data/app/helpers/identifiers_helper.rb +2 -0
  16. data/app/models/carrier_type.rb +2 -0
  17. data/app/models/enju_biblio/ability.rb +12 -0
  18. data/app/models/identifier.rb +65 -0
  19. data/app/models/identifier_type.rb +21 -0
  20. data/app/models/import_request.rb +1 -0
  21. data/app/models/manifestation.rb +28 -87
  22. data/app/models/page_sweeper.rb +0 -2
  23. data/app/models/resource_import_file.rb +34 -18
  24. data/app/views/addresses/_form.html.erb +57 -0
  25. data/app/views/addresses/edit.html.erb +6 -0
  26. data/app/views/addresses/index.html.erb +41 -0
  27. data/app/views/addresses/new.html.erb +5 -0
  28. data/app/views/addresses/show.html.erb +55 -0
  29. data/app/views/carrier_types/_form.html.erb +4 -1
  30. data/app/views/carrier_types/index.html.erb +1 -1
  31. data/app/views/identifier_types/_form.html.erb +22 -0
  32. data/app/views/identifier_types/edit.html.erb +13 -0
  33. data/app/views/identifier_types/index.html.erb +45 -0
  34. data/app/views/identifier_types/new.html.erb +12 -0
  35. data/app/views/identifier_types/show.html.erb +24 -0
  36. data/app/views/identifiers/_form.html.erb +30 -0
  37. data/app/views/identifiers/edit.html.erb +15 -0
  38. data/app/views/identifiers/index.html.erb +33 -0
  39. data/app/views/identifiers/new.html.erb +14 -0
  40. data/app/views/identifiers/show.html.erb +29 -0
  41. data/app/views/items/index.csv.erb +1 -1
  42. data/app/views/items/index.html.erb +2 -1
  43. data/app/views/manifestations/_form.html.erb +17 -36
  44. data/app/views/manifestations/_show.mods.builder +6 -2
  45. data/app/views/manifestations/_show.rdf.builder +7 -6
  46. data/app/views/manifestations/_show_detail_librarian.html.erb +5 -15
  47. data/app/views/manifestations/_show_detail_user.html.erb +5 -15
  48. data/app/views/manifestations/_show_index.html.erb +1 -1
  49. data/app/views/manifestations/index.csv.erb +1 -1
  50. data/app/views/manifestations/index.rss.builder +3 -1
  51. data/app/views/manifestations/show.mobile.erb +1 -1
  52. data/config/locales/translation_en.yml +14 -7
  53. data/config/locales/translation_ja.yml +15 -8
  54. data/config/routes.rb +6 -8
  55. data/db/migrate/005_create_manifestations.rb +0 -12
  56. data/db/migrate/20130506175303_create_identifier_types.rb +12 -0
  57. data/db/migrate/20130506175834_create_identifiers.rb +14 -0
  58. data/lib/enju_biblio/version.rb +1 -1
  59. data/lib/generators/enju_biblio/setup/templates/db/fixtures/identifier_types.yml +27 -0
  60. data/spec/controllers/identifier_types_controller_spec.rb +167 -0
  61. data/spec/controllers/identifiers_controller_spec.rb +446 -0
  62. data/spec/controllers/import_requests_controller_spec.rb +1 -1
  63. data/spec/controllers/manifestations_controller_spec.rb +12 -10
  64. data/spec/dummy/app/models/ability.rb +12 -0
  65. data/spec/dummy/db/development.sqlite3 +0 -0
  66. data/spec/dummy/db/migrate/20130504195916_add_subject_heading_type_id_to_subject.rb +5 -0
  67. data/spec/dummy/db/schema.rb +26 -16
  68. data/spec/dummy/db/test.sqlite3 +0 -0
  69. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  70. data/spec/dummy/solr/data/test/index/segments_myc +0 -0
  71. data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
  72. data/spec/factories/identifier.rb +6 -0
  73. data/spec/factories/identifier_type.rb +5 -0
  74. data/spec/fixtures/identifier_types.yml +29 -0
  75. data/spec/fixtures/identifiers.yml +113 -0
  76. data/spec/fixtures/manifestations.yml +0 -137
  77. data/spec/fixtures/subject_heading_types.yml +39 -0
  78. data/spec/fixtures/subject_types.yml +4 -4
  79. data/spec/models/identifier_spec.rb +22 -0
  80. data/spec/models/identifier_type_spec.rb +21 -0
  81. data/spec/models/manifestation_spec.rb +0 -11
  82. data/spec/models/resource_import_file_spec.rb +7 -7
  83. data/spec/routing/manifestations_routing_spec.rb +1 -1
  84. metadata +66 -16
  85. data/app/views/manifestations/_show_periodical_master.html.erb +0 -23
  86. data/app/views/manifestations/_show_series_statement.html.erb +0 -30
  87. data/spec/dummy/solr/data/test/index/segments_l8s +0 -0
@@ -77,8 +77,12 @@
77
77
  end
78
78
  xml.abstract manifestation.description
79
79
  xml.note manifestation.note
80
- xml.identifier manifestation.isbn, :type => 'isbn'
81
- xml.identifier manifestation.lccn, :type => 'lccn'
80
+ manifestation.identifier_content(:isbn).each do |i|
81
+ xml.identifier i, :type => 'isbn'
82
+ end
83
+ manifestation.identifier_content(:lccn).each do |l|
84
+ xml.identifier l, :type => 'lccn'
85
+ end
82
86
  xml.recordInfo{
83
87
  xml.recordCreationDate manifestation.created_at
84
88
  xml.recordChangeDate manifestation.updated_at
@@ -1,12 +1,13 @@
1
1
  xml.dcndl :BibResource do
2
2
  xml.rdf :Description, 'rdf:about' => manifestation_url(manifestation) do
3
- if manifestation.nbn?
4
- xml.dcterms :identifier, manifestation.nbn, 'rdf:datatype' => 'http://ndl.go.jp/dcndl/terms/JPNO'
5
- xml.rdfs :seeAlso, 'rdf:resource' => "http://id.ndl.go.jp/jpno/#{manifestation.nbn}"
3
+ if manifestation.identifier_contents(:nbn).first
4
+ xml.dcterms :identifier, manifestation.identifier_contents(:nbn).first, 'rdf:datatype' => 'http://ndl.go.jp/dcndl/terms/JPNO'
5
+
6
+ xml.rdfs :seeAlso, 'rdf:resource' => "http://id.ndl.go.jp/jpno/#{manifestation.identifier_contents(:nbn).first}"
6
7
  end
7
- if manifestation.isbn?
8
- xml.dcterms :identifier, manifestation.isbn, 'rdf:datatype' => 'http://ndl.go.jp/dcndl/terms/ISBN'
9
- xml.rdfs :seeAlso, 'rdf:resource' => "http://iss.ndl.go.jp/isbn/#{manifestation.isbn}"
8
+ manifestation.identifier_contents(:isbn).each do |i|
9
+ xml.dcterms :identifier, i, 'rdf:datatype' => 'http://ndl.go.jp/dcndl/terms/ISBN'
10
+ xml.rdfs :seeAlso, 'rdf:resource' => "http://iss.ndl.go.jp/isbn/#{i}"
10
11
  end
11
12
  xml.dcterms :title, manifestation.original_title
12
13
  xml.dc :title do
@@ -14,8 +14,8 @@
14
14
  <td style="width: 200px"><%= t('activerecord.models.series_statement') -%>:</td>
15
15
  <td style="width: 500px">
16
16
  <%= render 'show_series_detail', :manifestation => manifestation %>
17
- <%- if manifestation.issn.present? -%>
18
- (<%= t('activerecord.attributes.manifestation.issn') -%>: <%= manifestation.issn -%>)
17
+ <%- unless manifestation.identifier_contents(:issn).empty? -%>
18
+ (<%= t('activerecord.attributes.manifestation.issn') -%>: <%= manifestation.identifier_contents(:issn).join(" ") -%>)
19
19
  <%- end -%>
20
20
  </td>
21
21
  </tr>
@@ -56,19 +56,9 @@
56
56
  <tr>
57
57
  <td><%= t('page.identifier') -%>:</td>
58
58
  <td>
59
- <%- if manifestation.isbn.present? -%>
60
- ISBN: <span itemprop="isbn"><%= manifestation.isbn -%></span>
61
- <%- if manifestation.isbn10.present? -%>
62
- ( <%= manifestation.isbn10 -%> )
63
- <%- end -%>
64
- <%- end -%>
65
- <%- if manifestation.nbn.present? -%>
66
- NBN: <%= manifestation.nbn -%>
67
- <%- end -%>
68
- <%- if manifestation.lccn.present? -%>
69
- <br />
70
- LCCN: <%= manifestation.lccn -%>
71
- <%- end -%>
59
+ <% manifestation.identifiers.each do |identifier| %>
60
+ <%= "#{identifier.identifier_type.display_name.localize}: #{identifier.body}" %>
61
+ <% end %>
72
62
  </td>
73
63
  </tr>
74
64
  <%- end -%>
@@ -14,8 +14,8 @@
14
14
  <td style="width: 200px"><%= t('activerecord.models.series_statement') -%>:</td>
15
15
  <td style="width: 500px">
16
16
  <%= render 'show_series_detail', :manifestation => manifestation %>
17
- <%- if manifestation.issn.present? -%>
18
- (<%= t('activerecord.attributes.manifestation.issn') -%>: <%= manifestation.issn -%>)
17
+ <%- unless manifestation.identifier_contents(:issn).empty? -%>
18
+ (<%= t('activerecord.attributes.manifestation.issn') -%>: <%= manifestation.identifier_contents(:issn).join(" ") -%>)
19
19
  <%- end -%>
20
20
  </td>
21
21
  </tr>
@@ -58,19 +58,9 @@
58
58
  <tr>
59
59
  <td><%= t('page.identifier') -%>:</td>
60
60
  <td>
61
- <%- if manifestation.isbn.present? -%>
62
- ISBN: <span itemprop="isbn"><%= manifestation.isbn -%></span>
63
- <%- if manifestation.isbn10.present? -%>
64
- ( <%= manifestation.isbn10 -%> )
65
- <%- end -%>
66
- <%- end -%>
67
- <%- if manifestation.nbn.present? -%>
68
- NBN: <%= manifestation.nbn -%>
69
- <%- end -%>
70
- <%- if manifestation.lccn.present? -%>
71
- <br />
72
- LCCN: <%= manifestation.lccn -%>
73
- <%- end -%>
61
+ <% manifestation.identifiers.each do |identifier| %>
62
+ <%= "#{identifier.identifier_type.display_name.localize}: #{identifier.body}" %>
63
+ <% end %>
74
64
  </td>
75
65
  </tr>
76
66
  <%- end -%>
@@ -1,6 +1,6 @@
1
1
  <strong>
2
2
  <% if manifestation.root_series_statement %>
3
- <%= link_to manifestation.root_series_statement.original_title, series_statement_manifestations_path(manifestation.root_series_statement, :query => @query) %>
3
+ <%= link_to manifestation.original_title, manifestations_path(:parent => manifestation.id, :query => @query) %>
4
4
  <% else %>
5
5
  <%= link_to title_with_volume_number(manifestation), manifestation -%>
6
6
  <% end %>
@@ -1,4 +1,4 @@
1
1
  manifestation_identifier original_title creator publisher isbn pub_date note
2
2
  <%- @manifestations.each do |manifestation| -%>
3
- <%= manifestation.manifestation_identifier %> "<%=raw manifestation.original_title.gsub(/"/, '""') -%>" <%=raw manifestation.creators.pluck(:full_name).join('; ') -%> <%=raw manifestation.publishers.pluck(:full_name).join('; ') -%> <%= manifestation.isbn -%> <%= manifestation.pub_date -%> <%= manifestation.note -%><%= "\n" -%>
3
+ <%= manifestation.manifestation_identifier %> "<%=raw manifestation.original_title.gsub(/"/, '""') -%>" <%=raw manifestation.creators.pluck(:full_name).join('; ') -%> <%=raw manifestation.publishers.pluck(:full_name).join('; ') -%> <%= manifestation.identifier_contents(:isbn) -%> <%= manifestation.pub_date -%> <%= manifestation.note -%><%= "\n" -%>
4
4
  <%- end -%>
@@ -30,7 +30,9 @@ xml.rss('version' => "2.0",
30
30
  xml.pubDate manifestation.date_of_publication.try(:utc).try(:rfc822)
31
31
  xml.link manifestation_url(manifestation)
32
32
  xml.guid manifestation_url(manifestation), :isPermaLink => "true"
33
- xml.tag! "dc:identifier", manifestation.isbn
33
+ manifestation.identifier_contents(:isbn).each do |i|
34
+ xml.tag! "dc:identifier", i
35
+ end
34
36
  end
35
37
  end
36
38
  end
@@ -7,7 +7,7 @@
7
7
  <table class="table table-striped">
8
8
  <tr>
9
9
  <th>ISBN</th>
10
- <td><%= @manifestation.isbn %></td>
10
+ <td><%= @manifestation.identifier_contents(:isbn).join(' ') %></td>
11
11
  </tr>
12
12
  <tr>
13
13
  <th><%= t('activerecord.attributes.manifestation.price') %></th>
@@ -32,11 +32,11 @@ en:
32
32
  realize_type: Realize type
33
33
  resource_import_file: Resource import file
34
34
  resource_import_result: Resource Import Result
35
- series_has_manifestation: Series statement to manifestation
36
35
  series_statement: Series statement
37
- series_statement_relationship: Series statement relationship
38
36
  country: Country
39
37
  donate: Donate
38
+ identifier: Identifier
39
+ identifier_type: Identifier type
40
40
 
41
41
  attributes:
42
42
  manifestation:
@@ -84,6 +84,7 @@ en:
84
84
  series_master: Series master
85
85
  subject: Subject
86
86
  classification: Classification
87
+ identifier: Identifier
87
88
  item:
88
89
  call_number: Call number
89
90
  item_identifier: Item identifier
@@ -99,7 +100,7 @@ en:
99
100
  patron:
100
101
  last_name: Last name
101
102
  middle_name: Middle name
102
- first_name: Name
103
+ first_name: First name
103
104
  last_name_transcription: Last name transcription
104
105
  middle_name_transcription: Middle name transcription
105
106
  first_name_transcription: First name transcription
@@ -130,9 +131,6 @@ en:
130
131
  language: Language
131
132
  email: Email
132
133
  url: URL
133
- series_statement_relationship:
134
- parent_id: Parent
135
- child_id: Child
136
134
  patron_import_file:
137
135
  patron_import_file_name: Filename
138
136
  patron_import_content_type: Content type
@@ -173,10 +171,11 @@ en:
173
171
  work: Work
174
172
  series_statement_identifier: Series statement identifier
175
173
  issn: ISSN
176
- periodical: Periodical
177
174
  title_transcription: Title transcription
178
175
  note: Note
179
176
  series_master: Maseter
177
+ volume_nunber_string: Volume number
178
+ creator_string: Creator
180
179
  country:
181
180
  name: Name
182
181
  display_name: Display name
@@ -290,6 +289,14 @@ en:
290
289
  name: Name
291
290
  display_name: Display name
292
291
  note: Note
292
+ identitifer_type:
293
+ name: Name
294
+ display_name: Display name
295
+ note: Note
296
+ identifier:
297
+ body: Body
298
+ manifestation_id: Manifestation
299
+ primary: Primary
293
300
 
294
301
  resource_import_file:
295
302
  update_relationship: Update relationship
@@ -8,7 +8,7 @@ ja:
8
8
  embody: 具体化
9
9
  exemplify: 書誌と所蔵の関係
10
10
  extent: 大きさ
11
- form_of_work: 書いた資料の形態
11
+ form_of_work: 著作の形態
12
12
  frequency: 発行頻度
13
13
  item: 所蔵情報
14
14
  language: 言語
@@ -32,11 +32,11 @@ ja:
32
32
  realize_type: 表現の関係
33
33
  resource_import_file: 資料のインポート用ファイル
34
34
  resource_import_result: 資料インポートの結果
35
- series_has_manifestation: シリーズ情報と資料の関係
36
35
  series_statement: シリーズ情報
37
- series_statement_relationship: シリーズ情報の関係
38
36
  country: 国と地域
39
37
  donate: 寄贈
38
+ identifier: 識別子
39
+ identifier_type: 識別子の種類
40
40
 
41
41
  attributes:
42
42
  manifestation:
@@ -84,6 +84,7 @@ ja:
84
84
  series_master: シリーズ情報マスタ
85
85
  subject: 件名
86
86
  classification: 分類
87
+ identifier: 識別子
87
88
  item:
88
89
  call_number: 請求記号
89
90
  item_identifier: 所蔵情報ID
@@ -150,9 +151,6 @@ ja:
150
151
  iso_639_3: ISO 639-3
151
152
  note: 注記
152
153
  position: 位置
153
- series_statement_relationship:
154
- parent_id: 親
155
- child_id: 子
156
154
  resource_import_file:
157
155
  resource_import_file_name: ファイル名
158
156
  resource_import_content_type: Content-Type
@@ -170,13 +168,14 @@ ja:
170
168
  title_subseries: 副シリーズ名
171
169
  title_subseries_transcription: 副シリーズ名よみ
172
170
  numbering_subseries: 副シリーズ番号
173
- work: 書いた資料
171
+ work: 著作
174
172
  series_statement_identifier: シリーズ識別子
175
173
  issn: ISSN
176
- periodical: 定期刊行物
177
174
  title_transcription: シリーズ名よみ
178
175
  note: 注記
179
176
  series_master: マスタ
177
+ volume_number_string: シリーズ巻号
178
+ creator_string: シリーズ著者
180
179
  country:
181
180
  name: 名前
182
181
  display_name: 表示名
@@ -290,6 +289,14 @@ ja:
290
289
  name: 名称
291
290
  display_name: 表示名
292
291
  note: 注記
292
+ identifier_type:
293
+ name: 名称
294
+ display_name: 表示名
295
+ note: 注記
296
+ identifier:
297
+ body: 内容
298
+ manifestation_id: 体現形
299
+ primary: 主に使用
293
300
 
294
301
  resource_import_file:
295
302
  update_relationship: 関連を更新
@@ -1,6 +1,8 @@
1
1
  Rails.application.routes.draw do
2
- resources :people
3
2
 
3
+ resources :identifiers
4
+
5
+ resources :identifier_types
4
6
 
5
7
  resources :manifestations do
6
8
  resources :patrons
@@ -66,9 +68,7 @@ Rails.application.routes.draw do
66
68
 
67
69
  resources :donates
68
70
 
69
- resources :series_statements do
70
- resources :manifestations
71
- end
71
+ resources :series_statements
72
72
 
73
73
  resources :countries
74
74
  resources :languages
@@ -99,8 +99,6 @@ Rails.application.routes.draw do
99
99
 
100
100
  resources :picture_files
101
101
 
102
- resources :accepts
103
-
104
- match '/isbn/:isbn' => 'manifestations#show'
105
- match '/page/advanced_search' => 'page#advanced_search'
102
+ get '/isbn/:isbn' => 'manifestations#index'
103
+ get '/page/advanced_search' => 'page#advanced_search'
106
104
  end
@@ -19,13 +19,6 @@ class CreateManifestations < ActiveRecord::Migration
19
19
  t.integer :height
20
20
  t.integer :width
21
21
  t.integer :depth
22
- t.string :isbn
23
- t.string :isbn10
24
- t.string :wrong_isbn
25
- t.string :nbn
26
- t.string :lccn
27
- t.string :oclc_number
28
- t.string :issn
29
22
  t.integer :price # TODO: 通貨単位
30
23
  t.text :fulltext
31
24
  t.string :volume_number_string
@@ -43,11 +36,6 @@ class CreateManifestations < ActiveRecord::Migration
43
36
  end
44
37
  #add_index :manifestations, :carrier_type_id
45
38
  #add_index :manifestations, :required_role_id
46
- add_index :manifestations, :isbn
47
- add_index :manifestations, :nbn
48
- add_index :manifestations, :lccn
49
- add_index :manifestations, :oclc_number
50
- add_index :manifestations, :issn
51
39
  add_index :manifestations, :access_address
52
40
  #add_index :manifestations, :frequency_id
53
41
  add_index :manifestations, :manifestation_identifier
@@ -0,0 +1,12 @@
1
+ class CreateIdentifierTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :identifier_types do |t|
4
+ t.string :name
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class CreateIdentifiers < ActiveRecord::Migration
2
+ def change
3
+ create_table :identifiers do |t|
4
+ t.string :body, :null => false
5
+ t.integer :identifier_type_id, :null => false
6
+ t.integer :manifestation_id
7
+ t.boolean :primary
8
+ t.integer :position
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :identifiers, [:body, :identifier_type_id]
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module EnjuBiblio
2
- VERSION = "0.1.0.pre37"
2
+ VERSION = "0.1.0.pre38"
3
3
  end
@@ -0,0 +1,27 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ name: isbn
5
+ display_name: ISBN
6
+ note:
7
+ position: 1
8
+
9
+ two:
10
+ name: issn
11
+ display_name: ISSN
12
+ note:
13
+ position: 2
14
+
15
+ # == Schema Information
16
+ #
17
+ # Table name: identifier_types
18
+ #
19
+ # id :integer not null, primary key
20
+ # name :string(255)
21
+ # display_name :text
22
+ # note :text
23
+ # position :integer
24
+ # created_at :datetime not null
25
+ # updated_at :datetime not null
26
+ #
27
+
@@ -0,0 +1,167 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ describe IdentifierTypesController do
22
+ fixtures :all
23
+ login_admin
24
+
25
+ # This should return the minimal set of attributes required to create a valid
26
+ # IdentifierType. As you add validations to IdentifierType, be sure to
27
+ # update the return value of this method accordingly.
28
+ def valid_attributes
29
+ FactoryGirl.attributes_for(:identifier_type)
30
+ end
31
+
32
+ describe "GET index" do
33
+ it "assigns all identifier_types as @identifier_types" do
34
+ identifier_type = IdentifierType.create! valid_attributes
35
+ get :index
36
+ assigns(:identifier_types).should eq(IdentifierType.all)
37
+ end
38
+ end
39
+
40
+ describe "GET show" do
41
+ it "assigns the requested identifier_type as @identifier_type" do
42
+ identifier_type = IdentifierType.create! valid_attributes
43
+ get :show, :id => identifier_type.id
44
+ assigns(:identifier_type).should eq(identifier_type)
45
+ end
46
+ end
47
+
48
+ describe "GET new" do
49
+ it "assigns a new identifier_type as @identifier_type" do
50
+ get :new
51
+ assigns(:identifier_type).should be_a_new(IdentifierType)
52
+ end
53
+ end
54
+
55
+ describe "GET edit" do
56
+ it "assigns the requested identifier_type as @identifier_type" do
57
+ identifier_type = IdentifierType.create! valid_attributes
58
+ get :edit, :id => identifier_type.id
59
+ assigns(:identifier_type).should eq(identifier_type)
60
+ end
61
+ end
62
+
63
+ describe "POST create" do
64
+ describe "with valid params" do
65
+ it "creates a new IdentifierType" do
66
+ expect {
67
+ post :create, :identifier_type => valid_attributes
68
+ }.to change(IdentifierType, :count).by(1)
69
+ end
70
+
71
+ it "assigns a newly created identifier_type as @identifier_type" do
72
+ post :create, :identifier_type => valid_attributes
73
+ assigns(:identifier_type).should be_a(IdentifierType)
74
+ assigns(:identifier_type).should be_persisted
75
+ end
76
+
77
+ it "redirects to the created identifier_type" do
78
+ post :create, :identifier_type => valid_attributes
79
+ response.should redirect_to(IdentifierType.last)
80
+ end
81
+ end
82
+
83
+ describe "with invalid params" do
84
+ it "assigns a newly created but unsaved identifier_type as @identifier_type" do
85
+ # Trigger the behavior that occurs when invalid params are submitted
86
+ IdentifierType.any_instance.stub(:save).and_return(false)
87
+ post :create, :identifier_type => {}
88
+ assigns(:identifier_type).should be_a_new(IdentifierType)
89
+ end
90
+
91
+ it "re-renders the 'new' template" do
92
+ # Trigger the behavior that occurs when invalid params are submitted
93
+ IdentifierType.any_instance.stub(:save).and_return(false)
94
+ post :create, :identifier_type => {}
95
+ #response.should render_template("new")
96
+ end
97
+ end
98
+ end
99
+
100
+ describe "PUT update" do
101
+ describe "with valid params" do
102
+ it "updates the requested identifier_type" do
103
+ identifier_type = IdentifierType.create! valid_attributes
104
+ # Assuming there are no other identifier_types in the database, this
105
+ # specifies that the IdentifierType created on the previous line
106
+ # receives the :update_attributes message with whatever params are
107
+ # submitted in the request.
108
+ IdentifierType.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
109
+ put :update, :id => identifier_type.id, :identifier_type => {'these' => 'params'}
110
+ end
111
+
112
+ it "assigns the requested identifier_type as @identifier_type" do
113
+ identifier_type = IdentifierType.create! valid_attributes
114
+ put :update, :id => identifier_type.id, :identifier_type => valid_attributes
115
+ assigns(:identifier_type).should eq(identifier_type)
116
+ end
117
+
118
+ it "redirects to the identifier_type" do
119
+ identifier_type = IdentifierType.create! valid_attributes
120
+ put :update, :id => identifier_type.id, :identifier_type => valid_attributes
121
+ response.should redirect_to(identifier_type)
122
+ end
123
+
124
+ it "moves its position when specified" do
125
+ identifier_type = IdentifierType.create! valid_attributes
126
+ position = identifier_type.position
127
+ put :update, :id => identifier_type.id, :move => 'higher'
128
+ response.should redirect_to identifier_types_url
129
+ assigns(:identifier_type).position.should eq position - 1
130
+ end
131
+ end
132
+
133
+ describe "with invalid params" do
134
+ it "assigns the identifier_type as @identifier_type" do
135
+ identifier_type = IdentifierType.create! valid_attributes
136
+ # Trigger the behavior that occurs when invalid params are submitted
137
+ IdentifierType.any_instance.stub(:save).and_return(false)
138
+ put :update, :id => identifier_type.id, :identifier_type => {}
139
+ assigns(:identifier_type).should eq(identifier_type)
140
+ end
141
+
142
+ it "re-renders the 'edit' template" do
143
+ identifier_type = IdentifierType.create! valid_attributes
144
+ # Trigger the behavior that occurs when invalid params are submitted
145
+ IdentifierType.any_instance.stub(:save).and_return(false)
146
+ put :update, :id => identifier_type.id, :identifier_type => {}
147
+ #response.should render_template("edit")
148
+ end
149
+ end
150
+ end
151
+
152
+ describe "DELETE destroy" do
153
+ it "destroys the requested identifier_type" do
154
+ identifier_type = IdentifierType.create! valid_attributes
155
+ expect {
156
+ delete :destroy, :id => identifier_type.id
157
+ }.to change(IdentifierType, :count).by(-1)
158
+ end
159
+
160
+ it "redirects to the identifier_types list" do
161
+ identifier_type = IdentifierType.create! valid_attributes
162
+ delete :destroy, :id => identifier_type.id
163
+ response.should redirect_to(identifier_types_url)
164
+ end
165
+ end
166
+
167
+ end