enju_resource_merge 0.0.2
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 +36 -0
- data/app/controllers/patron_merge_lists_controller.rb +93 -0
- data/app/controllers/patron_merges_controller.rb +89 -0
- data/app/controllers/series_statement_merge_lists_controller.rb +93 -0
- data/app/controllers/series_statement_merges_controller.rb +94 -0
- data/app/models/patron_merge.rb +22 -0
- data/app/models/patron_merge_list.rb +31 -0
- data/app/models/series_statement_merge.rb +22 -0
- data/app/models/series_statement_merge_list.rb +26 -0
- data/app/views/patron_merge_lists/_form.html.erb +11 -0
- data/app/views/patron_merge_lists/edit.html.erb +13 -0
- data/app/views/patron_merge_lists/index.html.erb +33 -0
- data/app/views/patron_merge_lists/new.html.erb +12 -0
- data/app/views/patron_merge_lists/show.html.erb +31 -0
- data/app/views/patron_merges/edit.html.erb +31 -0
- data/app/views/patron_merges/index.html.erb +32 -0
- data/app/views/patron_merges/new.html.erb +39 -0
- data/app/views/patron_merges/show.html.erb +25 -0
- data/app/views/series_statement_merge_lists/_form.html.erb +11 -0
- data/app/views/series_statement_merge_lists/edit.html.erb +13 -0
- data/app/views/series_statement_merge_lists/index.html.erb +33 -0
- data/app/views/series_statement_merge_lists/new.html.erb +12 -0
- data/app/views/series_statement_merge_lists/show.html.erb +31 -0
- data/app/views/series_statement_merges/_form.html.erb +12 -0
- data/app/views/series_statement_merges/edit.html.erb +31 -0
- data/app/views/series_statement_merges/index.html.erb +32 -0
- data/app/views/series_statement_merges/new.html.erb +39 -0
- data/app/views/series_statement_merges/show.html.erb +27 -0
- data/config/routes.rb +21 -0
- data/db/migrate/133_create_patron_merges.rb +15 -0
- data/db/migrate/134_create_patron_merge_lists.rb +13 -0
- data/db/migrate/20110627034940_create_series_statement_merge_lists.rb +13 -0
- data/db/migrate/20110627035057_create_series_statement_merges.rb +16 -0
- data/lib/enju_resource_merge.rb +5 -0
- data/lib/enju_resource_merge/engine.rb +12 -0
- data/lib/enju_resource_merge/version.rb +3 -0
- data/lib/tasks/enju_resource_merge_tasks.rake +4 -0
- data/spec/controllers/patron_merge_lists_controller_spec.rb +456 -0
- data/spec/controllers/patron_merges_controller_spec.rb +437 -0
- data/spec/controllers/series_statement_merge_lists_controller_spec.rb +439 -0
- data/spec/controllers/series_statement_merges_controller_spec.rb +437 -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 +75 -0
- data/spec/dummy/app/helpers/application_helper.rb +13 -0
- data/spec/dummy/app/models/ability.rb +22 -0
- data/spec/dummy/app/models/create.rb +4 -0
- data/spec/dummy/app/models/donate.rb +10 -0
- data/spec/dummy/app/models/item.rb +20 -0
- data/spec/dummy/app/models/manifestation.rb +416 -0
- data/spec/dummy/app/models/own.rb +22 -0
- data/spec/dummy/app/models/patron.rb +14 -0
- data/spec/dummy/app/models/produce.rb +4 -0
- data/spec/dummy/app/models/realize.rb +4 -0
- data/spec/dummy/app/models/role.rb +5 -0
- data/spec/dummy/app/models/series_has_manifestation.rb +35 -0
- data/spec/dummy/app/models/series_statement.rb +88 -0
- data/spec/dummy/app/models/user.rb +28 -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 +46 -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/development.sqlite3 +0 -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/125_create_donates.rb +16 -0
- data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +17 -0
- data/spec/dummy/db/migrate/20100223121519_rename_sereis_statement_title_to_original_title.rb +13 -0
- data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +17 -0
- data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20111201115527_create_creates.rb +10 -0
- data/spec/dummy/db/migrate/20111201115540_create_produces.rb +10 -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/migrate/20120106093356_create_realizes.rb +10 -0
- data/spec/dummy/db/migrate/20120106093603_create_owns.rb +10 -0
- data/spec/dummy/db/schema.rb +300 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/url_validator.rb +10 -0
- data/spec/dummy/log/development.log +63 -0
- data/spec/dummy/log/test.log +67969 -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/enju_resource_merge_test.rb +7 -0
- data/spec/factories/patron.rb +10 -0
- data/spec/factories/patron_merge.rb +6 -0
- data/spec/factories/patron_merge_list.rb +5 -0
- data/spec/factories/series_statement.rb +5 -0
- data/spec/factories/series_statement_merge.rb +6 -0
- data/spec/factories/series_statement_merge_list.rb +5 -0
- data/spec/factories/user.rb +31 -0
- data/spec/fixtures/manifestations.yml +2017 -0
- data/spec/fixtures/patron_merge_lists.yml +27 -0
- data/spec/fixtures/patron_merges.yml +31 -0
- data/spec/fixtures/patrons.yml +338 -0
- data/spec/fixtures/roles.yml +21 -0
- data/spec/fixtures/series_has_manifestations.yml +35 -0
- data/spec/fixtures/series_statement_merge_lists.yml +27 -0
- data/spec/fixtures/series_statement_merges.yml +31 -0
- data/spec/fixtures/series_statements.yml +35 -0
- data/spec/fixtures/user_has_roles.yml +41 -0
- data/spec/fixtures/users.yml +69 -0
- data/spec/models/patron_merge_list_spec.rb +18 -0
- data/spec/models/patron_merge_spec.rb +19 -0
- data/spec/models/series_statement_merge_list_spec.rb +21 -0
- data/spec/models/series_statement_merge_spec.rb +17 -0
- data/spec/requests/series_statement_merge_lists_spec.rb +11 -0
- data/spec/requests/series_statement_merges_spec.rb +11 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/controller_macros.rb +48 -0
- data/spec/support/devise.rb +4 -0
- data/spec/views/series_statement_merge_lists/edit.html.erb_spec.rb +18 -0
- data/spec/views/series_statement_merge_lists/index.html.erb_spec.rb +22 -0
- data/spec/views/series_statement_merge_lists/new.html.erb_spec.rb +18 -0
- data/spec/views/series_statement_merge_lists/show.html.erb_spec.rb +15 -0
- data/spec/views/series_statement_merges/edit.html.erb_spec.rb +23 -0
- data/spec/views/series_statement_merges/index.html.erb_spec.rb +25 -0
- data/spec/views/series_statement_merges/new.html.erb_spec.rb +23 -0
- data/spec/views/series_statement_merges/show.html.erb_spec.rb +17 -0
- metadata +433 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
series_statement_merge_list_00001:
|
3
|
+
updated_at: 2008-02-18 13:36:49.835774 +09:00
|
4
|
+
title: test1
|
5
|
+
id: 1
|
6
|
+
created_at: 2008-02-18 13:36:49.835774 +09:00
|
7
|
+
series_statement_merge_list_00002:
|
8
|
+
updated_at: 2008-02-18 16:13:10.743437 +09:00
|
9
|
+
title: test2
|
10
|
+
id: 2
|
11
|
+
created_at: 2008-02-18 16:13:10.743437 +09:00
|
12
|
+
series_statement_merge_list_00003:
|
13
|
+
updated_at: 2008-02-18 16:13:14.963116 +09:00
|
14
|
+
title: test3
|
15
|
+
id: 3
|
16
|
+
created_at: 2008-02-18 16:13:14.963116 +09:00
|
17
|
+
|
18
|
+
# == Schema Information
|
19
|
+
#
|
20
|
+
# Table name: series_statement_merge_lists
|
21
|
+
#
|
22
|
+
# id :integer not null, primary key
|
23
|
+
# title :string(255)
|
24
|
+
# created_at :datetime
|
25
|
+
# updated_at :datetime
|
26
|
+
#
|
27
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
series_statement_merge_00001:
|
3
|
+
updated_at: 2008-02-17 18:51:36.776009 +09:00
|
4
|
+
id: 1
|
5
|
+
series_statement_id: 1
|
6
|
+
series_statement_merge_list_id: 1
|
7
|
+
created_at: 2008-02-17 18:51:36.776009 +09:00
|
8
|
+
series_statement_merge_00002:
|
9
|
+
updated_at: 2008-02-17 19:14:03.461761 +09:00
|
10
|
+
id: 2
|
11
|
+
series_statement_id: 2
|
12
|
+
series_statement_merge_list_id: 1
|
13
|
+
created_at: 2008-02-17 19:10:36.282814 +09:00
|
14
|
+
series_statement_merge_00003:
|
15
|
+
updated_at: 2008-02-17 19:19:19.265557 +09:00
|
16
|
+
series_statement_id: 3
|
17
|
+
series_statement_merge_list_id: 1
|
18
|
+
id: 3
|
19
|
+
created_at: 2008-02-17 19:19:19.265557 +09:00
|
20
|
+
|
21
|
+
# == Schema Information
|
22
|
+
#
|
23
|
+
# Table name: series_statement_merges
|
24
|
+
#
|
25
|
+
# id :integer not null, primary key
|
26
|
+
# series_statement_id :integer not null
|
27
|
+
# series_statement_merge_list_id :integer not null
|
28
|
+
# created_at :datetime
|
29
|
+
# updated_at :datetime
|
30
|
+
#
|
31
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
+
|
3
|
+
one:
|
4
|
+
id: 1
|
5
|
+
original_title: title1
|
6
|
+
position: 1
|
7
|
+
|
8
|
+
two:
|
9
|
+
id: 2
|
10
|
+
original_title: title2
|
11
|
+
position: 2
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
# == Schema Information
|
16
|
+
#
|
17
|
+
# Table name: series_statements
|
18
|
+
#
|
19
|
+
# id :integer not null, primary key
|
20
|
+
# original_title :text
|
21
|
+
# numbering :text
|
22
|
+
# title_subseries :text
|
23
|
+
# numbering_subseries :text
|
24
|
+
# position :integer
|
25
|
+
# created_at :datetime
|
26
|
+
# updated_at :datetime
|
27
|
+
# title_transcription :text
|
28
|
+
# title_alternative :text
|
29
|
+
# series_statement_identifier :string(255)
|
30
|
+
# issn :string(255)
|
31
|
+
# periodical :boolean
|
32
|
+
# root_manifestation_id :integer
|
33
|
+
# note :text
|
34
|
+
#
|
35
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
+
|
3
|
+
admin:
|
4
|
+
user_id: 1
|
5
|
+
role_id: 4
|
6
|
+
|
7
|
+
librarian1:
|
8
|
+
user_id: 2
|
9
|
+
role_id: 3
|
10
|
+
|
11
|
+
user1:
|
12
|
+
user_id: 3
|
13
|
+
role_id: 2
|
14
|
+
|
15
|
+
librarian2:
|
16
|
+
user_id: 4
|
17
|
+
role_id: 3
|
18
|
+
|
19
|
+
user2:
|
20
|
+
user_id: 5
|
21
|
+
role_id: 2
|
22
|
+
|
23
|
+
user3:
|
24
|
+
user_id: 6
|
25
|
+
role_id: 2
|
26
|
+
|
27
|
+
user4:
|
28
|
+
user_id: 7
|
29
|
+
role_id: 2
|
30
|
+
|
31
|
+
# == Schema Information
|
32
|
+
#
|
33
|
+
# Table name: user_has_roles
|
34
|
+
#
|
35
|
+
# id :integer not null, primary key
|
36
|
+
# user_id :integer
|
37
|
+
# role_id :integer
|
38
|
+
# created_at :datetime
|
39
|
+
# updated_at :datetime
|
40
|
+
#
|
41
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
admin:
|
3
|
+
updated_at: 2008-05-31 13:16:30.163731 +09:00
|
4
|
+
encrypted_password: $2a$10$vHohD1WflnTIqAa8zMkF9evwAgIZRw3XuR4d3bi29M.jph/MB/AJi
|
5
|
+
user_group_id: 2
|
6
|
+
id: 1
|
7
|
+
note:
|
8
|
+
username: admin
|
9
|
+
email: tanabe@kamata.lib.teu.ac.jp
|
10
|
+
created_at: 2007-11-19 16:58:32.111941 +09:00
|
11
|
+
required_role_id: 4
|
12
|
+
librarian1:
|
13
|
+
updated_at: 2008-05-31 12:41:16.337474 +09:00
|
14
|
+
encrypted_password: $2a$10$9O2VuTccN4gHq36ARg0QReSrb1D7WrBBhZZ759RM9moHbB0W5zCzS
|
15
|
+
user_group_id: 1
|
16
|
+
id: 2
|
17
|
+
note:
|
18
|
+
username: librarian1
|
19
|
+
email: librarian1@kamata.lib.teu.ac.jp
|
20
|
+
created_at: 2007-11-19 16:58:33.172441 +09:00
|
21
|
+
required_role_id: 1
|
22
|
+
user1:
|
23
|
+
updated_at: 2008-05-31 13:02:25.101261 +09:00
|
24
|
+
encrypted_password: $2a$10$JthS59A0BNkDOoFpCXM0V.GhhffKaoWKbzpPahYp/vTFrOyM7h/uW
|
25
|
+
user_group_id: 1
|
26
|
+
id: 3
|
27
|
+
note:
|
28
|
+
username: user1
|
29
|
+
email: user1@kamata.lib.teu.ac.jp
|
30
|
+
created_at: 2007-11-19 16:58:34.637413 +09:00
|
31
|
+
required_role_id: 3
|
32
|
+
librarian2:
|
33
|
+
updated_at: 2008-05-31 12:42:23.340575 +09:00
|
34
|
+
encrypted_password: $2a$10$YmmTGrYQ1Ir6oc7wXnp.GuNeO1eYLoP3sv8wMSIrTdaGw2BPwRrpS
|
35
|
+
user_group_id: 1
|
36
|
+
id: 4
|
37
|
+
note:
|
38
|
+
username: librarian2
|
39
|
+
created_at: 2008-01-18 12:24:04.222344 +09:00
|
40
|
+
required_role_id: 1
|
41
|
+
user2:
|
42
|
+
updated_at: 2008-05-31 12:42:44.711117 +09:00
|
43
|
+
encrypted_password: $2a$10$i7UjJhLVrJM/J7qaTwW39OXw1NiwowUEbtNHVDV0sqMLjX9.UO9ca
|
44
|
+
user_group_id: 1
|
45
|
+
id: 5
|
46
|
+
note:
|
47
|
+
username: user2
|
48
|
+
created_at: 2008-01-18 13:29:06.922728 +09:00
|
49
|
+
required_role_id: 2
|
50
|
+
user3:
|
51
|
+
updated_at: 2008-05-31 13:02:25.101261 +09:00
|
52
|
+
encrypted_password: cc53de0c2d9a1a228daa9a673ec824473747e17507a6c3c4f7e5eff8821f531d4b9e23616b3ddc66fe17006b2298a556fbd567ac080e87f00f37eef8cee6c417
|
53
|
+
user_group_id: 1
|
54
|
+
id: 6
|
55
|
+
note:
|
56
|
+
username: user3
|
57
|
+
email: user3@kamata.lib.teu.ac.jp
|
58
|
+
created_at: 2007-11-19 16:58:34.637413 +09:00
|
59
|
+
required_role_id: 3
|
60
|
+
user4:
|
61
|
+
updated_at: 2008-05-31 13:02:25.101261 +09:00
|
62
|
+
encrypted_password: cc53de0c2d9a1a228daa9a673ec824473747e17507a6c3c4f7e5eff8821f531d4b9e23616b3ddc66fe17006b2298a556fbd567ac080e87f00f37eef8cee6c417
|
63
|
+
user_group_id: 1
|
64
|
+
id: 7
|
65
|
+
note:
|
66
|
+
username: user4
|
67
|
+
email: user4@kamata.lib.teu.ac.jp
|
68
|
+
created_at: 2007-11-19 16:58:34.637413 +09:00
|
69
|
+
required_role_id: 3
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe PatronMergeList do
|
5
|
+
#pending "add some examples to (or delete) #{__FILE__}"
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
# == Schema Information
|
10
|
+
#
|
11
|
+
# Table name: patron_merge_lists
|
12
|
+
#
|
13
|
+
# id :integer not null, primary key
|
14
|
+
# title :string(255)
|
15
|
+
# created_at :datetime
|
16
|
+
# updated_at :datetime
|
17
|
+
#
|
18
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe PatronMerge do
|
5
|
+
#pending "add some examples to (or delete) #{__FILE__}"
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
# == Schema Information
|
10
|
+
#
|
11
|
+
# Table name: patron_merges
|
12
|
+
#
|
13
|
+
# id :integer not null, primary key
|
14
|
+
# patron_id :integer not null
|
15
|
+
# patron_merge_list_id :integer not null
|
16
|
+
# created_at :datetime
|
17
|
+
# updated_at :datetime
|
18
|
+
#
|
19
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SeriesStatementMergeList do
|
4
|
+
fixtures :series_statements
|
5
|
+
|
6
|
+
it "should merge series_statment" do
|
7
|
+
series_statement_merge_list = FactoryGirl.create(:series_statement_merge_list)
|
8
|
+
series_statement_merge_list.merge_series_statements(SeriesStatement.all).should be_true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# == Schema Information
|
13
|
+
#
|
14
|
+
# Table name: series_statement_merge_lists
|
15
|
+
#
|
16
|
+
# id :integer not null, primary key
|
17
|
+
# title :string(255)
|
18
|
+
# created_at :datetime
|
19
|
+
# updated_at :datetime
|
20
|
+
#
|
21
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SeriesStatementMerge do
|
4
|
+
#pending "add some examples to (or delete) #{__FILE__}"
|
5
|
+
end
|
6
|
+
|
7
|
+
# == Schema Information
|
8
|
+
#
|
9
|
+
# Table name: series_statement_merges
|
10
|
+
#
|
11
|
+
# id :integer not null, primary key
|
12
|
+
# series_statement_id :integer not null
|
13
|
+
# series_statement_merge_list_id :integer not null
|
14
|
+
# created_at :datetime
|
15
|
+
# updated_at :datetime
|
16
|
+
#
|
17
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "SeriesStatementMergeLists" do
|
4
|
+
describe "GET /series_statement_merge_lists" 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 series_statement_merge_lists_path
|
8
|
+
response.status.should be(302)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "SeriesStatementMerges" do
|
4
|
+
describe "GET /series_statement_merges" 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 series_statement_merges_path
|
8
|
+
response.status.should be(302)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'factory_girl'
|
6
|
+
|
7
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
+
# in spec/support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# == Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
config.mock_with :rspec
|
20
|
+
|
21
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
22
|
+
config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
|
23
|
+
|
24
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
+
# examples within a transaction, remove the following line or assign false
|
26
|
+
# instead of true.
|
27
|
+
config.use_transactional_fixtures = true
|
28
|
+
|
29
|
+
config.extend ControllerMacros, :type => :controller
|
30
|
+
end
|
31
|
+
|
32
|
+
FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
|
33
|
+
FactoryGirl.find_definitions
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module ControllerMacros
|
2
|
+
def login_admin
|
3
|
+
before(:each) do
|
4
|
+
@request.env["devise.mapping"] = Devise.mappings[:admin]
|
5
|
+
sign_in Factory.create(:admin)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def login_librarian
|
10
|
+
before(:each) do
|
11
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
12
|
+
user = Factory.create(:librarian)
|
13
|
+
sign_in user
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def login_user
|
18
|
+
before(:each) do
|
19
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
20
|
+
user = Factory.create(:user)
|
21
|
+
sign_in user
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def login_fixture_admin
|
26
|
+
before(:each) do
|
27
|
+
@request.env["devise.mapping"] = Devise.mappings[:admin]
|
28
|
+
@user = users(:admin)
|
29
|
+
sign_in @user
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def login_fixture_librarian
|
34
|
+
before(:each) do
|
35
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
36
|
+
@user = users(:librarian1)
|
37
|
+
sign_in @user
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def login_fixture_user
|
42
|
+
before(:each) do
|
43
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
44
|
+
@user = users(:user1)
|
45
|
+
sign_in @user
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "series_statement_merge_lists/edit.html.erb" do
|
4
|
+
before(:each) do
|
5
|
+
@series_statement_merge_list = assign(:series_statement_merge_list, stub_model(SeriesStatementMergeList,
|
6
|
+
:title => "MyString"
|
7
|
+
))
|
8
|
+
end
|
9
|
+
|
10
|
+
it "renders the edit series_statement_merge_list 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 => series_statement_merge_lists_path(@series_statement_merge_list), :method => "post" do
|
15
|
+
assert_select "input#series_statement_merge_list_title", :name => "series_statement_merge_list[title]"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "series_statement_merge_lists/index.html.erb" do
|
4
|
+
before(:each) do
|
5
|
+
assign(:series_statement_merge_lists, [
|
6
|
+
stub_model(SeriesStatementMergeList,
|
7
|
+
:title => "Title",
|
8
|
+
:created_at => Time.zone.now
|
9
|
+
),
|
10
|
+
stub_model(SeriesStatementMergeList,
|
11
|
+
:title => "Title",
|
12
|
+
:created_at => Time.zone.now
|
13
|
+
)
|
14
|
+
].paginate(:page => 1))
|
15
|
+
end
|
16
|
+
|
17
|
+
it "renders a list of series_statement_merge_lists" do
|
18
|
+
render
|
19
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
20
|
+
assert_select "tr>td", :text => "Title".to_s, :count => 2
|
21
|
+
end
|
22
|
+
end
|