闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
957 B

7 years ago
  1. require 'simplecov'
  2. SimpleCov.start 'rails' do
  3. add_group 'Services', 'app/services'
  4. add_group 'Presenters', 'app/presenters'
  5. add_group 'Validators', 'app/validators'
  6. end
  7. RSpec.configure do |config|
  8. config.expect_with :rspec do |expectations|
  9. expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  10. end
  11. config.mock_with :rspec do |mocks|
  12. mocks.verify_partial_doubles = true
  13. config.around(:example, :without_verify_partial_doubles) do |example|
  14. mocks.verify_partial_doubles = false
  15. example.call
  16. mocks.verify_partial_doubles = true
  17. end
  18. end
  19. config.before :each do
  20. stub_request(:post, 'https://fcm.googleapis.com/fcm/send').to_return(status: 200, body: '')
  21. end
  22. config.after :suite do
  23. FileUtils.rm_rf(Dir["#{Rails.root}/spec/test_files/"])
  24. end
  25. end
  26. def body_as_json
  27. json_str_to_hash(response.body)
  28. end
  29. def json_str_to_hash(str)
  30. JSON.parse(str, symbolize_names: true)
  31. end