enju_purchase_request 0.1.1 → 0.2.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/controllers/concerns/enju_purchase_request/controller.rb +19 -0
  4. data/app/controllers/order_lists_controller.rb +13 -3
  5. data/app/controllers/orders_controller.rb +13 -3
  6. data/app/controllers/purchase_requests_controller.rb +15 -10
  7. data/app/models/concerns/enju_purchase_request/enju_user.rb +10 -0
  8. data/app/models/order.rb +3 -4
  9. data/app/models/order_list.rb +2 -2
  10. data/app/models/order_list_transition.rb +5 -4
  11. data/app/models/purchase_request.rb +7 -8
  12. data/app/policies/bookstore_policy.rb +23 -0
  13. data/app/policies/order_list_policy.rb +21 -0
  14. data/app/policies/order_policy.rb +21 -0
  15. data/app/policies/purchase_request_policy.rb +25 -0
  16. data/app/views/orders/index.html.erb +5 -3
  17. data/app/views/purchase_requests/_index.html.erb +7 -7
  18. data/app/views/purchase_requests/_index_order_list.html.erb +6 -4
  19. data/app/views/purchase_requests/show.html.erb +1 -1
  20. data/db/migrate/20160703190738_add_most_recent_to_order_list_transitions.rb +9 -0
  21. data/lib/enju_purchase_request/version.rb +1 -1
  22. data/lib/enju_purchase_request.rb +0 -25
  23. data/lib/tasks/enju_purchase_request_tasks.rake +8 -0
  24. data/spec/controllers/order_lists_controller_spec.rb +13 -11
  25. data/spec/controllers/orders_controller_spec.rb +9 -9
  26. data/spec/controllers/purchase_requests_controller_spec.rb +4 -4
  27. data/spec/dummy/app/controllers/application_controller.rb +7 -4
  28. data/spec/dummy/app/models/user.rb +2 -3
  29. data/spec/dummy/config/application.rb +7 -24
  30. data/spec/dummy/config/environments/development.rb +22 -18
  31. data/spec/dummy/config/environments/production.rb +46 -34
  32. data/spec/dummy/config/environments/test.rb +21 -14
  33. data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
  34. data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
  35. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
  36. data/spec/dummy/db/migrate/20081212151614_create_bookmark_stats.rb +0 -3
  37. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
  38. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
  39. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
  40. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +18 -0
  41. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +18 -0
  42. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -1
  43. data/spec/dummy/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +5 -1
  44. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -1
  45. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  46. data/spec/dummy/db/migrate/20141013152011_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
  47. data/spec/dummy/db/migrate/20141013152013_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
  48. data/spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +5 -0
  49. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  50. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  51. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  52. data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
  53. data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
  54. data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
  55. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  56. data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
  57. data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
  58. data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
  59. data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
  60. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  61. data/spec/dummy/db/migrate/20160815045420_add_most_recent_to_bookmark_stat_transitions.rb +9 -0
  62. data/spec/dummy/db/schema.rb +123 -10
  63. data/spec/fixtures/library_groups.yml +1 -0
  64. data/spec/fixtures/order_list_transitions.yml +10 -6
  65. data/spec/fixtures/order_lists.yml +2 -3
  66. data/spec/fixtures/orders.yml +3 -4
  67. data/spec/fixtures/purchase_requests.yml +6 -7
  68. data/spec/models/order_list_spec.rb +3 -4
  69. data/spec/models/order_spec.rb +4 -6
  70. data/spec/models/purchase_request_spec.rb +7 -9
  71. data/spec/rails_helper.rb +53 -0
  72. data/spec/spec_helper.rb +82 -43
  73. data/spec/support/devise.rb +2 -2
  74. metadata +261 -194
  75. data/app/models/enju_purchase_request/ability.rb +0 -30
  76. data/lib/enju_purchase_request/user.rb +0 -14
  77. data/spec/dummy/app/models/ability.rb +0 -30
  78. data/spec/dummy/app/views/page/403.html.erb +0 -9
  79. data/spec/dummy/app/views/page/403.mobile.erb +0 -5
  80. data/spec/dummy/app/views/page/403.xml.erb +0 -4
  81. data/spec/dummy/app/views/page/404.html.erb +0 -9
  82. data/spec/dummy/app/views/page/404.mobile.erb +0 -5
  83. data/spec/dummy/app/views/page/404.xml.erb +0 -4
  84. data/spec/dummy/config/application.yml +0 -38
data/spec/spec_helper.rb CHANGED
@@ -1,53 +1,92 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
- SimpleCov.start 'rails'
4
- Coveralls.wear!
5
-
6
- # This file is copied to spec/ when you run 'rails generate rspec:install'
7
- ENV["RAILS_ENV"] ||= 'test'
8
- require File.expand_path("../dummy/config/environment", __FILE__)
9
- require 'rspec/rails'
10
- require 'factory_girl'
11
- require 'sunspot-rails-tester'
12
-
13
- # Requires supporting ruby files with custom matchers and macros, etc,
14
- # in spec/support/ and its subdirectories.
15
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
16
-
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
19
  RSpec.configure do |config|
18
- # == Mock Framework
19
- #
20
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
21
- #
22
- # config.mock_with :mocha
23
- # config.mock_with :flexmock
24
- # config.mock_with :rr
25
- config.mock_with :rspec
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
26
33
 
27
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
28
- config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = false
41
+ end
29
42
 
30
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
31
- # examples within a transaction, remove the following line or assign false
32
- # instead of true.
33
- config.use_transactional_fixtures = true
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
34
52
 
35
- config.extend ControllerMacros, :type => :controller
53
+ # Allows RSpec to persist some state between runs in order to support
54
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
55
+ # you configure your source control system to ignore this file.
56
+ config.example_status_persistence_file_path = "spec/examples.txt"
36
57
 
37
- $original_sunspot_session = Sunspot.session
58
+ # Limits the available syntax to the non-monkey patched syntax that is
59
+ # recommended. For more details, see:
60
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
61
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
63
+ config.disable_monkey_patching!
38
64
 
39
- config.before do
40
- Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
65
+ # Many RSpec users commonly either run the entire suite or an individual
66
+ # file, and it's useful to allow more verbose output when running an
67
+ # individual spec file.
68
+ if config.files_to_run.one?
69
+ # Use the documentation formatter for detailed output,
70
+ # unless a formatter has already been configured
71
+ # (e.g. via a command-line flag).
72
+ config.default_formatter = 'doc'
41
73
  end
42
74
 
43
- config.before :each, :solr => true do
44
- Sunspot::Rails::Tester.start_original_sunspot_session
45
- Sunspot.session = $original_sunspot_session
46
- Sunspot.remove_all!
47
- end
75
+ # Print the 10 slowest examples and example groups at the
76
+ # end of the spec run, to help surface which specs are running
77
+ # particularly slow.
78
+ config.profile_examples = 10
48
79
 
49
- config.infer_spec_type_from_file_location!
50
- end
80
+ # Run specs in random order to surface order dependencies. If you find an
81
+ # order dependency and want to debug it, you can fix the order by providing
82
+ # the seed, which is printed after each run.
83
+ # --seed 1234
84
+ config.order = :random
51
85
 
52
- FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
53
- FactoryGirl.find_definitions
86
+ # Seed global randomization in this process using the `--seed` CLI option.
87
+ # Setting this allows you to use `--seed` to deterministically reproduce
88
+ # test failures related to randomization by passing the same `--seed` value
89
+ # as the one that triggered the failure.
90
+ Kernel.srand config.seed
91
+ =end
92
+ end
@@ -1,4 +1,4 @@
1
1
  RSpec.configure do |config|
2
- config.include Devise::TestHelpers, :type => :controller
3
- config.include Devise::TestHelpers, :type => :view
2
+ config.include Devise::Test::ControllerHelpers, type: :controller
3
+ config.include Devise::Test::ControllerHelpers, type: :view
4
4
  end