pacto 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
- data/Guardfile +2 -2
- data/README.md +8 -8
- data/lib/pacto/file_pre_processor.rb +1 -1
- data/lib/pacto/rake_task.rb +3 -3
- data/lib/pacto/version.rb +1 -1
- metadata +1 -1
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
guard 'rspec', :cli => '--color --require spec_helper', :version => 2 do
|
2
|
-
watch(%r{^spec/
|
2
|
+
watch(%r{^spec/pacto/.+_spec\.rb$})
|
3
3
|
watch(%r{^spec/json/.+_spec\.rb$})
|
4
|
-
watch(%r{^lib/
|
4
|
+
watch(%r{^lib/pacto\.rb$}) { |m| "spec" }
|
5
5
|
watch(%r{^lib/json-generator\.rb$}) { |m| "spec" }
|
6
6
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
7
|
watch('spec/spec_helper.rb') { "spec" }
|
data/README.md
CHANGED
@@ -70,11 +70,11 @@ There are two ways to validate a contract against a provider: through a Rake tas
|
|
70
70
|
|
71
71
|
Pacto includes a default Rake task. To use it, include it in your Rakefile:
|
72
72
|
|
73
|
-
require '
|
73
|
+
require 'pacto/rake_task'
|
74
74
|
|
75
75
|
Validating a contract against a provider is as simple as running:
|
76
76
|
|
77
|
-
$ rake
|
77
|
+
$ rake pacto:validate[host,dir] # Validates all contracts in a given directory against a given host
|
78
78
|
|
79
79
|
It is recommended that you also include [colorize](https://github.com/fazibear/colorize) to get prettier, colorful output.
|
80
80
|
|
@@ -82,7 +82,7 @@ It is recommended that you also include [colorize](https://github.com/fazibear/c
|
|
82
82
|
|
83
83
|
The easiest way to load a contract from a file and validate it against a host is by using the builder interface:
|
84
84
|
|
85
|
-
require '
|
85
|
+
require 'pacto'
|
86
86
|
|
87
87
|
WebMock.allow_net_connect!
|
88
88
|
contract = Pacto.build_from_file('/path/to/contract.json', 'http://dummyprovider.com')
|
@@ -97,7 +97,7 @@ with the entire JSON Schema specification.
|
|
97
97
|
|
98
98
|
First, register the contracts that are going to be used in the acceptance tests suite:
|
99
99
|
|
100
|
-
require '
|
100
|
+
require 'pacto'
|
101
101
|
|
102
102
|
contract = Pacto.build_from_file('/path/to/contract.json', 'http://dummyprovider.com')
|
103
103
|
Pacto.register('my_contract', contract)
|
@@ -115,10 +115,10 @@ The values are merged using [hash-deep-merge](https://github.com/Offirmo/hash-de
|
|
115
115
|
|
116
116
|
## Code status
|
117
117
|
|
118
|
-
[](https://travis-ci.org/thoughtworks/pacto)
|
119
|
+
[](https://codeclimate.com/github/thoughtworks/pacto)
|
120
|
+
[](https://gemnasium.com/thoughtworks/pacto)
|
121
|
+
[](https://coveralls.io/r/thoughtworks/pacto)
|
122
122
|
|
123
123
|
## Contributing
|
124
124
|
|
data/lib/pacto/rake_task.rb
CHANGED
@@ -17,8 +17,8 @@ module Pacto
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def install
|
20
|
-
desc "Tasks for
|
21
|
-
namespace :
|
20
|
+
desc "Tasks for Pacto gem"
|
21
|
+
namespace :pacto do
|
22
22
|
validate_task
|
23
23
|
end
|
24
24
|
end
|
@@ -27,7 +27,7 @@ module Pacto
|
|
27
27
|
desc "Validates all contracts in a given directory against a given host"
|
28
28
|
task :validate, :host, :dir do |t, args|
|
29
29
|
if args.to_a.size < 2
|
30
|
-
fail "USAGE: rake
|
30
|
+
fail "USAGE: rake pacto:validate[<host>, <contract_dir>]".colorize(:yellow)
|
31
31
|
end
|
32
32
|
|
33
33
|
validate_contracts(args[:host], args[:dir])
|
data/lib/pacto/version.rb
CHANGED