openstax_salesforce 3.1.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -46
- data/Rakefile +2 -5
- data/config/initializers/openstax_salesforce.rb +11 -36
- data/db/migrate/0_install_openstax_salesforce.rb +1 -0
- data/db/migrate/1_drop_openstax_salesforce_users.rb +14 -0
- data/lib/openstax/salesforce/active_force.rb +0 -4
- data/lib/openstax/salesforce/client.rb +11 -17
- data/lib/openstax/salesforce/engine.rb +5 -3
- data/lib/openstax/salesforce/remote/campaign.rb +0 -2
- data/lib/openstax/salesforce/remote/campaign_member.rb +0 -1
- data/lib/openstax/salesforce/remote/opportunity.rb +0 -2
- data/lib/openstax/salesforce/remote/school.rb +5 -1
- data/lib/openstax/salesforce/remote/term_year.rb +0 -2
- data/lib/openstax/salesforce/remote/tutor_course_period.rb +0 -2
- data/lib/openstax/salesforce/spec_helpers.rb +142 -26
- data/lib/openstax/salesforce/version.rb +1 -1
- data/lib/openstax_salesforce.rb +13 -29
- data/lib/tasks/openstax_salesforce_tasks.rake +1 -26
- metadata +15 -182
- data/app/controllers/openstax/salesforce/application_controller.rb +0 -7
- data/app/controllers/openstax/salesforce/settings_controller.rb +0 -20
- data/app/helpers/openstax/salesforce/application_helper.rb +0 -11
- data/app/models/openstax/salesforce/user.rb +0 -31
- data/app/views/openstax/salesforce/settings/show.html.erb +0 -33
- data/config/initializers/omniauth.rb +0 -8
- data/config/routes.rb +0 -11
- data/lib/openstax/salesforce/spec_helpers/salesforce_proxy.rb +0 -121
- data/lib/openstax/salesforce/user_missing.rb +0 -3
- data/spec/client_spec.rb +0 -10
- data/spec/dummy/README.md +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/bin/setup +0 -29
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -25
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -4
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/db/schema.rb +0 -25
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +0 -2673
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/user.rb +0 -17
- data/spec/openstax/salesforce/controllers/application_controller_spec.rb +0 -22
- data/spec/openstax/salesforce/controllers/settings_controller_spec.rb +0 -80
- data/spec/openstax/salesforce/remote/opportunity_spec.rb +0 -11
- data/spec/openstax/salesforce/remote/term_year_spec.rb +0 -81
- data/spec/openstax/salesforce/remote/tutor_course_period_spec.rb +0 -30
- data/spec/openstax/salesforce/spec_helpers_spec.rb +0 -31
- data/spec/rails_helper.rb +0 -99
- data/spec/routing_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -86
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
require 'openstax/salesforce/spec_helpers'
|
3
|
-
|
4
|
-
include OpenStax::Salesforce::SpecHelpers
|
5
|
-
|
6
|
-
RSpec.describe OpenStax::Salesforce::SpecHelpers do
|
7
|
-
|
8
|
-
context '#limit_salesforce_queries' do
|
9
|
-
it 'limits by one wildcard' do
|
10
|
-
limit_salesforce_queries(OpenStax::Salesforce::Remote::Contact, email: "%foo.com")
|
11
|
-
expect(OpenStax::Salesforce::Remote::Contact.select(:id).to_s).to eq(
|
12
|
-
"SELECT Id FROM Contact WHERE (Email LIKE '%foo.com')"
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'limit by multiple wildcards' do
|
17
|
-
limit_salesforce_queries(OpenStax::Salesforce::Remote::Contact, email: "%foo.com", first_name: 'JP%')
|
18
|
-
expect(OpenStax::Salesforce::Remote::Contact.select(:id).to_s).to eq(
|
19
|
-
"SELECT Id FROM Contact WHERE (Email LIKE '%foo.com') AND (FirstName LIKE 'JP%')"
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'limits by wildcard and another condition' do
|
24
|
-
limit_salesforce_queries(OpenStax::Salesforce::Remote::Contact, email: "%foo.com", first_name: 'Bob')
|
25
|
-
expect(OpenStax::Salesforce::Remote::Contact.select(:id).to_s).to eq(
|
26
|
-
"SELECT Id FROM Contact WHERE (Email LIKE '%foo.com') AND (FirstName = 'Bob')"
|
27
|
-
)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
data/spec/rails_helper.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] ||= 'test'
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
5
|
-
require 'rspec/rails'
|
6
|
-
require 'factory_bot_rails'
|
7
|
-
require 'faker'
|
8
|
-
require 'byebug'
|
9
|
-
require 'database_cleaner'
|
10
|
-
|
11
|
-
# Add additional requires below this line. Rails is not loaded until this point!
|
12
|
-
|
13
|
-
# Requires supporting ruby files with custom matchers and macros, etc, in
|
14
|
-
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
15
|
-
# run as spec files by default. This means that files in spec/support that end
|
16
|
-
# in _spec.rb will both be required and run as specs, causing the specs to be
|
17
|
-
# run twice. It is recommended that you do not name files matching this glob to
|
18
|
-
# end with _spec.rb. You can configure this pattern with the --pattern
|
19
|
-
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
20
|
-
#
|
21
|
-
# The following line is provided for convenience purposes. It has the downside
|
22
|
-
# of increasing the boot-up time by auto-requiring all files in the support
|
23
|
-
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
24
|
-
# require only the support files necessary.
|
25
|
-
#
|
26
|
-
# Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
27
|
-
|
28
|
-
# Checks for pending migrations before tests are run.
|
29
|
-
# If you are not using ActiveRecord, you can remove this line.
|
30
|
-
ActiveRecord::Migration.maintain_test_schema!
|
31
|
-
|
32
|
-
RSpec.configure do |config|
|
33
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
34
|
-
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
35
|
-
|
36
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
37
|
-
# examples within a transaction, remove the following line or assign false
|
38
|
-
# instead of true.
|
39
|
-
config.use_transactional_fixtures = false
|
40
|
-
|
41
|
-
# RSpec Rails can automatically mix in different behaviours to your tests
|
42
|
-
# based on their file location, for example enabling you to call `get` and
|
43
|
-
# `post` in specs under `spec/controllers`.
|
44
|
-
#
|
45
|
-
# You can disable this behaviour by removing the line below, and instead
|
46
|
-
# explicitly tag your specs with their type, e.g.:
|
47
|
-
#
|
48
|
-
# RSpec.describe UsersController, :type => :controller do
|
49
|
-
# # ...
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# The different available types are documented in the features, such as in
|
53
|
-
# https://relishapp.com/rspec/rspec-rails/docs
|
54
|
-
config.infer_spec_type_from_file_location!
|
55
|
-
|
56
|
-
# Use DatabaseCleaner instead of rspec transaction rollbacks
|
57
|
-
# http://tomdallimore.com/blog/taking-the-test-trash-out-with-databasecleaner-and-rspec/
|
58
|
-
|
59
|
-
config.prepend_before(:suite) do
|
60
|
-
DatabaseCleaner.clean_with(:truncation)
|
61
|
-
end
|
62
|
-
|
63
|
-
config.prepend_before(:all) do
|
64
|
-
DatabaseCleaner.start
|
65
|
-
end
|
66
|
-
|
67
|
-
config.prepend_before(:all, js: true) do
|
68
|
-
DatabaseCleaner.strategy = :truncation
|
69
|
-
end
|
70
|
-
|
71
|
-
config.prepend_before(:all, truncation: true) do
|
72
|
-
DatabaseCleaner.strategy = :truncation
|
73
|
-
end
|
74
|
-
|
75
|
-
config.prepend_before(:all) do
|
76
|
-
DatabaseCleaner.strategy = :transaction
|
77
|
-
end
|
78
|
-
|
79
|
-
config.prepend_before(:each) do
|
80
|
-
DatabaseCleaner.start
|
81
|
-
end
|
82
|
-
|
83
|
-
# https://github.com/DatabaseCleaner/database_cleaner#rspec-with-capybara-example says:
|
84
|
-
# "It's also recommended to use append_after to ensure DatabaseCleaner.clean
|
85
|
-
# runs after the after-test cleanup capybara/rspec installs."
|
86
|
-
config.append_after(:each) do
|
87
|
-
DatabaseCleaner.clean
|
88
|
-
end
|
89
|
-
|
90
|
-
config.append_after(:all) do
|
91
|
-
DatabaseCleaner.clean
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def mock_admin_user
|
96
|
-
allow(OpenStax::Salesforce.configuration).to receive(:authenticate_admin_proc) {
|
97
|
-
->(controller) { return true }
|
98
|
-
}
|
99
|
-
end
|
data/spec/routing_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'rspec/core'
|
2
|
-
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
3
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
4
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
5
|
-
# file to always be loaded, without a need to explicitly require it in any 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 it.
|
13
|
-
#
|
14
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
15
|
-
# users commonly want.
|
16
|
-
#
|
17
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
-
RSpec.configure do |config|
|
19
|
-
# rspec-expectations config goes here. You can use an alternate
|
20
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
-
# assertions if you prefer.
|
22
|
-
config.expect_with :rspec do |expectations|
|
23
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
-
# and `failure_message` of custom matchers include text for helper methods
|
25
|
-
# defined using `chain`, e.g.:
|
26
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
-
# # => "be bigger than 2 and smaller than 4"
|
28
|
-
# ...rather than:
|
29
|
-
# # => "be bigger than 2"
|
30
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
-
end
|
32
|
-
|
33
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
-
config.mock_with :rspec do |mocks|
|
36
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
-
# a real object. This is generally recommended, and will default to
|
38
|
-
# `true` in RSpec 4.
|
39
|
-
mocks.verify_partial_doubles = true
|
40
|
-
end
|
41
|
-
|
42
|
-
# The settings below are suggested to provide a good initial experience
|
43
|
-
# with RSpec, but feel free to customize to your heart's content.
|
44
|
-
=begin
|
45
|
-
# These two settings work together to allow you to limit a spec run
|
46
|
-
# to individual examples or groups you care about by tagging them with
|
47
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
48
|
-
# get run.
|
49
|
-
config.filter_run :focus
|
50
|
-
config.run_all_when_everything_filtered = true
|
51
|
-
|
52
|
-
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
53
|
-
# For more details, see:
|
54
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
55
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
56
|
-
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
57
|
-
config.disable_monkey_patching!
|
58
|
-
|
59
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
60
|
-
# file, and it's useful to allow more verbose output when running an
|
61
|
-
# individual spec file.
|
62
|
-
if config.files_to_run.one?
|
63
|
-
# Use the documentation formatter for detailed output,
|
64
|
-
# unless a formatter has already been configured
|
65
|
-
# (e.g. via a command-line flag).
|
66
|
-
config.default_formatter = 'doc'
|
67
|
-
end
|
68
|
-
|
69
|
-
# Print the 10 slowest examples and example groups at the
|
70
|
-
# end of the spec run, to help surface which specs are running
|
71
|
-
# particularly slow.
|
72
|
-
config.profile_examples = 10
|
73
|
-
|
74
|
-
# Run specs in random order to surface order dependencies. If you find an
|
75
|
-
# order dependency and want to debug it, you can fix the order by providing
|
76
|
-
# the seed, which is printed after each run.
|
77
|
-
# --seed 1234
|
78
|
-
config.order = :random
|
79
|
-
|
80
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
81
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
82
|
-
# test failures related to randomization by passing the same `--seed` value
|
83
|
-
# as the one that triggered the failure.
|
84
|
-
Kernel.srand config.seed
|
85
|
-
=end
|
86
|
-
end
|