spec: Move generic consumer tests into pact folder
This also moves the pact_config.rb file into the pact folder. The line filtering :pact tests has been removed from spec_helper.rb, since rspec won't try to run them anyway now that they aren't in the spec folder. Change-Id: I1d8f27f4f30aa2cdc85e570deb7e0aa2cdb89c66 Reviewed-on: https://gerrit.instructure.com/152144 Reviewed-by: Michael Hargiss <mhargiss@instructure.com> Tested-by: Jenkins Product-Review: Tucker McKnight <tmcknight@instructure.com> QA-Review: Tucker McKnight <tmcknight@instructure.com>
This commit is contained in:
parent
7f301937ea
commit
72bc724fb3
|
@ -5,11 +5,10 @@ set -e
|
|||
if [ -f ../config/consul.yml ]; then # canvas is running in docker
|
||||
docker-compose run --rm --no-deps \
|
||||
-e RAILS_ENV=test \
|
||||
-e RUN_API_CONTRACT_TESTS=1 \
|
||||
web bundle exec rspec spec/contracts/service_providers \
|
||||
web bundle exec rspec pact/spec \
|
||||
--tag pact --format doc
|
||||
else
|
||||
RAILS_ENV=test RUN_API_CONTRACT_TESTS=1 \
|
||||
bundle exec rspec spec/contracts/service_providers \
|
||||
RAILS_ENV=test \
|
||||
bundle exec rspec pact/spec \
|
||||
--tag pact --format doc
|
||||
fi
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require 'pact/consumer/rspec'
|
||||
require_relative '../pact_config'
|
||||
require_relative 'pact_config'
|
||||
|
||||
# see https://github.com/realestate-com-au/pact/blob/master/documentation/configuration.md
|
||||
Pact.configure do |config|
|
||||
|
@ -27,15 +27,11 @@ Pact.configure do |config|
|
|||
config.pactfile_write_order = :chronological
|
||||
end
|
||||
|
||||
# Only load this code block when running API contract tests, otherwise the Pact
|
||||
# mock server will cause the canvas specs to fail.
|
||||
if ENV.fetch('RUN_API_CONTRACT_TESTS', '0') == '1'
|
||||
Pact.service_consumer PactConfig::Consumers::GENERIC_CONSUMER do
|
||||
has_pact_with PactConfig::Providers::CANVAS_LMS_API do
|
||||
mock_service :canvas_lms_api do
|
||||
port PactConfig.mock_provider_service_port
|
||||
pact_specification_version '2.0.0'
|
||||
end
|
||||
Pact.service_consumer PactConfig::Consumers::GENERIC_CONSUMER do
|
||||
has_pact_with PactConfig::Providers::CANVAS_LMS_API do
|
||||
mock_service :canvas_lms_api do
|
||||
port PactConfig.mock_provider_service_port
|
||||
pact_specification_version '2.0.0'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
require 'httparty'
|
||||
require 'json'
|
||||
require_relative '../../../../pact_config'
|
||||
require_relative '../../../pact_config'
|
||||
|
||||
module Helper
|
||||
module ApiClient
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
require 'httparty'
|
||||
require 'json'
|
||||
require_relative '../../../../pact_config'
|
||||
require_relative '../../../pact_config'
|
||||
|
||||
module Helper
|
||||
module ApiClient
|
|
@ -18,7 +18,7 @@
|
|||
ENV["RAILS_ENV"] = ENV["RACK_ENV"]= "test"
|
||||
|
||||
require 'pact/provider/rspec'
|
||||
require_relative '../../pact_config'
|
||||
require_relative '../../../../pact/pact_config'
|
||||
require_relative '../../../spec_helper'
|
||||
require_relative 'provider_states_for_consumer'
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require_relative '../../pact_config'
|
||||
require_relative '../../../../pact/pact_config'
|
||||
require_relative 'pact_setup'
|
||||
|
||||
PactConfig::Consumers::ALL.each do |consumer|
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#
|
||||
|
||||
require 'pact/messages'
|
||||
require_relative '../../pact_config'
|
||||
require_relative '../../../../pact/pact_config'
|
||||
require_relative '../../../spec_helper'
|
||||
|
||||
Pact::Messages.pact_broker_url = PactConfig.broker_uri
|
||||
|
|
|
@ -320,7 +320,6 @@ RSpec.configure do |config|
|
|||
|
||||
# The Pact specs have prerequisite setup steps so we exclude them by default
|
||||
config.filter_run_excluding :pact_live_events if ENV.fetch('RUN_LIVE_EVENTS_CONTRACT_TESTS', '0') == '0'
|
||||
config.filter_run_excluding :pact if ENV.fetch('RUN_API_CONTRACT_TESTS', '0') == '0'
|
||||
|
||||
config.include Helpers
|
||||
config.include Factories
|
||||
|
|
Loading…
Reference in New Issue