enju_library 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/app/controllers/shelves_controller.rb +2 -1
- data/app/helpers/shelves_helper.rb +9 -5
- data/app/models/library.rb +1 -2
- data/app/models/library_group.rb +7 -1
- data/app/models/shelf.rb +1 -0
- data/app/views/accepts/index.html.erb +2 -2
- data/app/views/bookstores/index.html.erb +3 -3
- data/app/views/bookstores/show.html.erb +1 -1
- data/app/views/budget_types/index.html.erb +2 -2
- data/app/views/libraries/_form.html.erb +1 -1
- data/app/views/libraries/index.html.erb +3 -3
- data/app/views/libraries/show.html.erb +1 -1
- data/app/views/library_groups/index.html.erb +1 -1
- data/app/views/request_status_types/index.html.erb +2 -2
- data/app/views/request_types/index.html.erb +2 -2
- data/app/views/search_engines/index.html.erb +2 -2
- data/app/views/shelves/_library_facet.html.erb +1 -4
- data/app/views/shelves/index.html.erb +2 -2
- data/app/views/shelves/show.mobile.erb +33 -0
- data/app/views/subscribes/index.html.erb +2 -2
- data/app/views/subscriptions/index.html.erb +2 -2
- data/app/views/subscriptions/show.html.erb +1 -1
- data/lib/enju_library/engine.rb +0 -8
- data/lib/enju_library/version.rb +1 -1
- data/lib/enju_library.rb +0 -2
- data/spec/controllers/bookstores_controller_spec.rb +447 -0
- data/spec/controllers/budget_types_controller_spec.rb +167 -0
- data/spec/controllers/libraries_controller_spec.rb +517 -0
- data/spec/controllers/library_groups_controller_spec.rb +133 -0
- data/spec/controllers/request_status_types_controller_spec.rb +447 -0
- data/spec/controllers/request_types_controller_spec.rb +447 -0
- data/spec/controllers/search_engines_controller_spec.rb +447 -0
- data/spec/controllers/shelves_controller_spec.rb +437 -0
- data/spec/controllers/subscribes_controller_spec.rb +441 -0
- data/spec/controllers/subscriptions_controller_spec.rb +442 -0
- data/{test → spec}/dummy/README.rdoc +0 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +59 -0
- data/spec/dummy/app/helpers/application_helper.rb +13 -0
- data/spec/dummy/app/models/ability.rb +51 -0
- data/spec/dummy/app/models/picture_file.rb +49 -0
- data/spec/dummy/app/models/role.rb +46 -0
- data/spec/dummy/app/models/user.rb +94 -0
- data/spec/dummy/app/models/user_group.rb +40 -0
- data/spec/dummy/app/models/user_has_role.rb +5 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -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/{test → spec}/dummy/config/application.rb +3 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +0 -0
- data/{test → spec}/dummy/config/environments/test.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/config/initializers/devise.rb +205 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/secret_token.rb +0 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/{test → spec}/dummy/config/routes.rb +2 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/001_create_patrons.rb +58 -0
- data/spec/dummy/db/migrate/005_create_manifestations.rb +61 -0
- data/spec/dummy/db/migrate/006_create_items.rb +31 -0
- data/spec/dummy/db/migrate/012_create_owns.rb +12 -0
- data/spec/dummy/db/migrate/015_create_creates.rb +12 -0
- data/spec/dummy/db/migrate/047_create_produces.rb +12 -0
- data/spec/dummy/db/migrate/073_create_carrier_types.rb +11 -0
- data/spec/dummy/db/migrate/077_create_user_groups.rb +16 -0
- data/spec/dummy/db/migrate/125_create_donates.rb +12 -0
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +13 -0
- data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +13 -0
- data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +12 -0
- data/spec/dummy/db/migrate/20081025083323_create_countries.rb +28 -0
- data/spec/dummy/db/migrate/20081025083905_create_languages.rb +23 -0
- data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +16 -0
- data/spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb +15 -0
- data/spec/dummy/db/migrate/20090812151902_create_patron_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +27 -0
- data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
- data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +13 -0
- data/spec/dummy/db/migrate/20100223121519_rename_series_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/20100525124311_create_manifestation_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +11 -0
- data/spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb +9 -0
- data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +11 -0
- data/spec/dummy/db/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb +13 -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/20110619064807_add_edition_string_to_manifestation.rb +9 -0
- data/{db → spec/dummy/db}/migrate/20110620173525_add_bookstore_id_to_item.rb +0 -0
- data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +9 -0
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +12 -0
- data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +13 -0
- data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +13 -0
- data/spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb +13 -0
- data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +13 -0
- data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20111124110059_create_create_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +7 -0
- data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +16 -0
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +44 -0
- data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
- data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +6 -0
- data/spec/dummy/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413100352_add_fingerprint_to_picture_file.rb +5 -0
- data/spec/dummy/db/schema.rb +642 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test → spec}/dummy/public/favicon.ico +0 -0
- data/{test → spec}/dummy/script/rails +0 -0
- data/spec/dummy/solr/conf/admin-extra.html +31 -0
- data/spec/dummy/solr/conf/elevate.xml +36 -0
- data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/spec/dummy/solr/conf/protwords.txt +21 -0
- data/spec/dummy/solr/conf/schema.xml +238 -0
- data/spec/dummy/solr/conf/scripts.conf +24 -0
- data/spec/dummy/solr/conf/solrconfig.xml +934 -0
- data/spec/dummy/solr/conf/spellings.txt +2 -0
- data/spec/dummy/solr/conf/stopwords.txt +58 -0
- data/spec/dummy/solr/conf/synonyms.txt +31 -0
- data/spec/dummy/solr/data/test/index/_k.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_k.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_k.fnm +3 -0
- data/spec/dummy/solr/data/test/index/_k.frq +1 -0
- data/spec/dummy/solr/data/test/index/_k.nrm +1 -0
- data/spec/dummy/solr/data/test/index/_k.prx +0 -0
- data/spec/dummy/solr/data/test/index/_k.tii +0 -0
- data/spec/dummy/solr/data/test/index/_k.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_18 +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments.gen +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
- data/spec/factories/bookstore.rb +5 -0
- data/spec/factories/budget_types.rb +5 -0
- data/spec/factories/carrier_types.yml +51 -0
- data/spec/factories/library.rb +13 -0
- data/spec/factories/manifestation.rb +6 -0
- data/spec/factories/request_status_type.rb +5 -0
- data/spec/factories/request_type.rb +5 -0
- data/spec/factories/search_engine.rb +9 -0
- data/spec/factories/shelf.rb +6 -0
- data/spec/factories/subscribe.rb +8 -0
- data/spec/factories/subscription.rb +6 -0
- data/spec/factories/user.rb +37 -0
- data/spec/fixtures/bookstores.yml +107 -0
- data/spec/fixtures/budget_types.yml +29 -0
- data/spec/fixtures/carrier_types.yml +51 -0
- data/spec/fixtures/languages.yml +1901 -0
- data/spec/fixtures/libraries.yml +102 -0
- data/spec/fixtures/library_groups.yml +33 -0
- data/spec/fixtures/manifestations.yml +2022 -0
- data/spec/fixtures/request_status_types.yml +63 -0
- data/spec/fixtures/request_types.yml +55 -0
- data/spec/fixtures/roles.yml +21 -0
- data/spec/fixtures/search_engines.yml +41 -0
- data/spec/fixtures/shelves.yml +47 -0
- data/spec/fixtures/subscribes.yml +45 -0
- data/spec/fixtures/subscriptions.yml +27 -0
- data/spec/fixtures/user_groups.yml +31 -0
- data/spec/fixtures/user_has_roles.yml +41 -0
- data/spec/fixtures/users.yml +129 -0
- data/spec/models/bookstore_spec.rb +26 -0
- data/spec/models/budget_type_spec.rb +22 -0
- data/spec/models/library_group_spec.rb +33 -0
- data/spec/models/library_spec.rb +47 -0
- data/spec/models/request_status_type_spec.rb +21 -0
- data/spec/models/request_type_spec.rb +21 -0
- data/spec/models/search_engine_spec.rb +29 -0
- data/spec/models/shelf_spec.rb +29 -0
- data/spec/models/subscribe_spec.rb +21 -0
- data/spec/models/subscription_spec.rb +26 -0
- data/spec/routing/budget_types_routing_spec.rb +35 -0
- data/spec/routing/libraries_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +55 -0
- data/spec/support/controller_macros.rb +46 -0
- data/spec/support/devise.rb +4 -0
- data/spec/support/vcr.rb +9 -0
- data/spec/views/budget_types/edit.html.erb_spec.rb +23 -0
- data/spec/views/budget_types/index.html.erb_spec.rb +28 -0
- data/spec/views/budget_types/new.html.erb_spec.rb +23 -0
- data/spec/views/budget_types/show.html.erb_spec.rb +24 -0
- metadata +372 -198
- data/lib/enju_library/master_model.rb +0 -19
- data/lib/enju_library/url_validator.rb +0 -10
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +0 -0
- data/test/enju_library_test.rb +0 -7
- data/test/integration/navigation_test.rb +0 -10
- data/test/test_helper.rb +0 -15
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe SearchEngine do
|
5
|
+
fixtures :search_engines
|
6
|
+
|
7
|
+
it "should respond to search_params" do
|
8
|
+
search_engines(:search_engine_00001).search_params('test').should eq({:submit => 'Search', :locale => 'ja', :keyword => 'test'})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# == Schema Information
|
13
|
+
#
|
14
|
+
# Table name: search_engines
|
15
|
+
#
|
16
|
+
# id :integer not null, primary key
|
17
|
+
# name :string(255) not null
|
18
|
+
# display_name :text
|
19
|
+
# url :string(255) not null
|
20
|
+
# base_url :text not null
|
21
|
+
# http_method :text not null
|
22
|
+
# query_param :text not null
|
23
|
+
# additional_param :text
|
24
|
+
# note :text
|
25
|
+
# position :integer
|
26
|
+
# created_at :datetime
|
27
|
+
# updated_at :datetime
|
28
|
+
#
|
29
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Shelf do
|
5
|
+
fixtures :all
|
6
|
+
|
7
|
+
it "should respond to web_shelf" do
|
8
|
+
shelves(:shelf_00001).web_shelf?.should be_true
|
9
|
+
shelves(:shelf_00002).web_shelf?.should_not be_true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# == Schema Information
|
14
|
+
#
|
15
|
+
# Table name: shelves
|
16
|
+
#
|
17
|
+
# id :integer not null, primary key
|
18
|
+
# name :string(255) not null
|
19
|
+
# display_name :text
|
20
|
+
# note :text
|
21
|
+
# library_id :integer default(1), not null
|
22
|
+
# items_count :integer default(0), not null
|
23
|
+
# position :integer
|
24
|
+
# created_at :datetime not null
|
25
|
+
# updated_at :datetime not null
|
26
|
+
# deleted_at :datetime
|
27
|
+
# closed :boolean default(FALSE), not null
|
28
|
+
#
|
29
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Subscribe do
|
5
|
+
#pending "add some examples to (or delete) #{__FILE__}"
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
# == Schema Information
|
10
|
+
#
|
11
|
+
# Table name: subscribes
|
12
|
+
#
|
13
|
+
# id :integer not null, primary key
|
14
|
+
# subscription_id :integer not null
|
15
|
+
# work_id :integer not null
|
16
|
+
# start_at :datetime not null
|
17
|
+
# end_at :datetime not null
|
18
|
+
# created_at :datetime
|
19
|
+
# updated_at :datetime
|
20
|
+
#
|
21
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Subscription do
|
5
|
+
fixtures :subscriptions, :manifestations, :subscribes
|
6
|
+
|
7
|
+
it "should_respond_to_subscribed" do
|
8
|
+
subscriptions(:subscription_00001).subscribed(manifestations(:manifestation_00001)).should be_true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# == Schema Information
|
13
|
+
#
|
14
|
+
# Table name: subscriptions
|
15
|
+
#
|
16
|
+
# id :integer not null, primary key
|
17
|
+
# title :text not null
|
18
|
+
# note :text
|
19
|
+
# user_id :integer
|
20
|
+
# order_list_id :integer
|
21
|
+
# deleted_at :datetime
|
22
|
+
# subscribes_count :integer default(0), not null
|
23
|
+
# created_at :datetime
|
24
|
+
# updated_at :datetime
|
25
|
+
#
|
26
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe BudgetTypesController do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "routes to #index" do
|
7
|
+
get("/budget_types").should route_to("budget_types#index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "routes to #new" do
|
11
|
+
get("/budget_types/new").should route_to("budget_types#new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "routes to #show" do
|
15
|
+
get("/budget_types/1").should route_to("budget_types#show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "routes to #edit" do
|
19
|
+
get("/budget_types/1/edit").should route_to("budget_types#edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "routes to #create" do
|
23
|
+
post("/budget_types").should route_to("budget_types#create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "routes to #update" do
|
27
|
+
put("/budget_types/1").should route_to("budget_types#update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "routes to #destroy" do
|
31
|
+
delete("/budget_types/1").should route_to("budget_types#destroy", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe LibrariesController do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "recognizes and generates #index" do
|
7
|
+
{ :get => "/libraries" }.should route_to(:controller => "libraries", :action => "index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "recognizes and generates #new" do
|
11
|
+
{ :get => "/libraries/new" }.should route_to(:controller => "libraries", :action => "new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "recognizes and generates #show" do
|
15
|
+
{ :get => "/libraries/1" }.should route_to(:controller => "libraries", :action => "show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "recognizes and generates #edit" do
|
19
|
+
{ :get => "/libraries/1/edit" }.should route_to(:controller => "libraries", :action => "edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "recognizes and generates #create" do
|
23
|
+
{ :post => "/libraries" }.should route_to(:controller => "libraries", :action => "create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "recognizes and generates #update" do
|
27
|
+
{ :put => "/libraries/1" }.should route_to(:controller => "libraries", :action => "update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "recognizes and generates #destroy" do
|
31
|
+
{ :delete => "/libraries/1" }.should route_to(:controller => "libraries", :action => "destroy", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
require 'vcr'
|
7
|
+
require 'factory_girl'
|
8
|
+
require 'sunspot-rails-tester'
|
9
|
+
|
10
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
11
|
+
# in spec/support/ and its subdirectories.
|
12
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
13
|
+
#Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
# ## Mock Framework
|
17
|
+
#
|
18
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
19
|
+
#
|
20
|
+
# config.mock_with :mocha
|
21
|
+
# config.mock_with :flexmock
|
22
|
+
# config.mock_with :rr
|
23
|
+
|
24
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
25
|
+
config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
|
26
|
+
|
27
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
28
|
+
# examples within a transaction, remove the following line or assign false
|
29
|
+
# instead of true.
|
30
|
+
config.use_transactional_fixtures = true
|
31
|
+
|
32
|
+
# If true, the base class of anonymous controllers will be inferred
|
33
|
+
# automatically. This will be the default behavior in future versions of
|
34
|
+
# rspec-rails.
|
35
|
+
config.infer_base_class_for_anonymous_controllers = false
|
36
|
+
|
37
|
+
config.extend ControllerMacros, :type => :controller
|
38
|
+
|
39
|
+
config.extend VCR::RSpec::Macros
|
40
|
+
|
41
|
+
$original_sunspot_session = Sunspot.session
|
42
|
+
|
43
|
+
config.before do
|
44
|
+
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
|
45
|
+
end
|
46
|
+
|
47
|
+
config.before :each, :solr => true do
|
48
|
+
Sunspot::Rails::Tester.start_original_sunspot_session
|
49
|
+
Sunspot.session = $original_sunspot_session
|
50
|
+
Sunspot.remove_all!
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
|
55
|
+
FactoryGirl.find_definitions
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module ControllerMacros
|
2
|
+
def login_admin
|
3
|
+
before(:each) do
|
4
|
+
@request.env["devise.mapping"] = Devise.mappings[:admin]
|
5
|
+
sign_in FactoryGirl.create(:admin)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def login_librarian
|
10
|
+
before(:each) do
|
11
|
+
@request.env["devise.mapping"] = Devise.mappings[:librarian]
|
12
|
+
sign_in FactoryGirl.create(:librarian)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def login_user
|
17
|
+
before(:each) do
|
18
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
19
|
+
sign_in FactoryGirl.create(:user)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def login_fixture_admin
|
24
|
+
before(:each) do
|
25
|
+
@request.env["devise.mapping"] = Devise.mappings[:admin]
|
26
|
+
@user = users(:admin)
|
27
|
+
sign_in @user
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def login_fixture_librarian
|
32
|
+
before(:each) do
|
33
|
+
@request.env["devise.mapping"] = Devise.mappings[:librarian]
|
34
|
+
@user = users(:librarian1)
|
35
|
+
sign_in @user
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def login_fixture_user
|
40
|
+
before(:each) do
|
41
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
42
|
+
@user = users(:user1)
|
43
|
+
sign_in @user
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "budget_types/edit" do
|
4
|
+
before(:each) do
|
5
|
+
@budget_type = assign(:budget_type, stub_model(BudgetType,
|
6
|
+
:name => "MyString",
|
7
|
+
:display_name => "MyText",
|
8
|
+
:note => "MyText",
|
9
|
+
:position => 1
|
10
|
+
))
|
11
|
+
end
|
12
|
+
|
13
|
+
it "renders the edit budget_type form" do
|
14
|
+
render
|
15
|
+
|
16
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
17
|
+
assert_select "form", :action => budget_types_path(@budget_type), :method => "post" do
|
18
|
+
assert_select "input#budget_type_name", :name => "budget_type[name]"
|
19
|
+
assert_select "textarea#budget_type_display_name", :name => "budget_type[display_name]"
|
20
|
+
assert_select "textarea#budget_type_note", :name => "budget_type[note]"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "budget_types/index" do
|
4
|
+
before(:each) do
|
5
|
+
assign(:budget_types, [
|
6
|
+
stub_model(BudgetType,
|
7
|
+
:name => "Public funds",
|
8
|
+
:display_name => "Public funds",
|
9
|
+
:note => "MyText",
|
10
|
+
:position => 1
|
11
|
+
),
|
12
|
+
stub_model(BudgetType,
|
13
|
+
:name => "Donation",
|
14
|
+
:display_name => "Donation",
|
15
|
+
:note => "MyText",
|
16
|
+
:position => 2
|
17
|
+
)
|
18
|
+
])
|
19
|
+
end
|
20
|
+
|
21
|
+
it "renders a list of budget_types" do
|
22
|
+
render
|
23
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
24
|
+
assert_select "tr>td", :text => "Public funds".to_s, :count => 1
|
25
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
26
|
+
assert_select "tr>td", :text => "MyText".to_s, :count => 2
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "budget_types/new" do
|
4
|
+
before(:each) do
|
5
|
+
assign(:budget_type, stub_model(BudgetType,
|
6
|
+
:name => "MyString",
|
7
|
+
:display_name => "MyText",
|
8
|
+
:note => "MyText",
|
9
|
+
:position => 1
|
10
|
+
).as_new_record)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "renders new budget_type form" do
|
14
|
+
render
|
15
|
+
|
16
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
17
|
+
assert_select "form", :action => budget_types_path, :method => "post" do
|
18
|
+
assert_select "input#budget_type_name", :name => "budget_type[name]"
|
19
|
+
assert_select "textarea#budget_type_display_name", :name => "budget_type[display_name]"
|
20
|
+
assert_select "textarea#budget_type_note", :name => "budget_type[note]"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "budget_types/show" do
|
4
|
+
before(:each) do
|
5
|
+
@budget_type = assign(:budget_type, stub_model(BudgetType,
|
6
|
+
:name => "Name",
|
7
|
+
:display_name => "MyText",
|
8
|
+
:note => "MyText",
|
9
|
+
:position => 1
|
10
|
+
))
|
11
|
+
end
|
12
|
+
|
13
|
+
it "renders attributes in <p>" do
|
14
|
+
render
|
15
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
16
|
+
rendered.should match(/Name/)
|
17
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
18
|
+
rendered.should match(/MyText/)
|
19
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
20
|
+
rendered.should match(/MyText/)
|
21
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
22
|
+
rendered.should match(/1/)
|
23
|
+
end
|
24
|
+
end
|