File tree 4 files changed +85
-4
lines changed
4 files changed +85
-4
lines changed Original file line number Diff line number Diff line change @@ -38,12 +38,12 @@ def shutdown
38
38
end
39
39
40
40
def setup_stub stub_pactfile_paths
41
- stub_pactfile_paths . each do | pactfile_path |
41
+ interactions = stub_pactfile_paths . collect do | pactfile_path |
42
42
$stdout. puts "INFO: Loading interactions from #{ pactfile_path } "
43
43
hash_interactions = JSON . parse ( File . read ( pactfile_path ) ) [ 'interactions' ]
44
- interactions = hash_interactions . collect { | hash | Interaction . from_hash ( hash ) }
45
- @session . set_expected_interactions interactions
46
- end
44
+ hash_interactions . collect { | hash | Interaction . from_hash ( hash ) }
45
+ end . flatten
46
+ @session . set_expected_interactions interactions
47
47
end
48
48
49
49
def write_pact_if_configured
Original file line number Diff line number Diff line change
1
+ require 'support/integration_spec_support'
2
+
3
+ describe "The pact-stub-service command line interface with multiple pacts" , mri_only : true do
4
+
5
+ include Pact ::IntegrationTestSupport
6
+
7
+ PORT = 5556
8
+
9
+ before :all do
10
+ clear_dirs
11
+ @pid = start_stub_server PORT , "spec/support/pact-for-stub-1.json spec/support/pact-for-stub-2.json"
12
+ end
13
+
14
+ it "includes the interactions from the first pact file" do
15
+ response = Faraday . get "http://localhost:#{ PORT } /path1"
16
+ puts response . body if response . status != 200
17
+ expect ( response . status ) . to eq 200
18
+ end
19
+
20
+ it "includes the interactions from the second pact file" do
21
+ response = Faraday . get "http://localhost:#{ PORT } /path2"
22
+ puts response . body if response . status != 200
23
+ expect ( response . status ) . to eq 200
24
+ end
25
+
26
+ after :all do
27
+ kill_server @pid
28
+ end
29
+ end
Original file line number Diff line number Diff line change
1
+ {
2
+ "provider" : {
3
+ "name" : " a provider"
4
+ },
5
+ "consumer" : {
6
+ "name" : " a consumer"
7
+ },
8
+ "interactions" : [
9
+ {
10
+ "description" : " request one" ,
11
+ "request" : {
12
+ "method" : " get" ,
13
+ "path" : " /path1"
14
+ },
15
+ "response" : {
16
+ "status" : 200
17
+ },
18
+ "providerState" : " state one"
19
+ }
20
+ ],
21
+ "metadata" : {
22
+ "pactSpecification" : {
23
+ "version" : " 2.0"
24
+ }
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "provider" : {
3
+ "name" : " a provider"
4
+ },
5
+ "consumer" : {
6
+ "name" : " a consumer"
7
+ },
8
+ "interactions" : [
9
+ {
10
+ "description" : " request two" ,
11
+ "request" : {
12
+ "method" : " get" ,
13
+ "path" : " /path2"
14
+ },
15
+ "response" : {
16
+ "status" : 200
17
+ },
18
+ "providerState" : " state two"
19
+ }
20
+ ],
21
+ "metadata" : {
22
+ "pactSpecification" : {
23
+ "version" : " 2.0"
24
+ }
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments