rambo_ruby 0.3.3 → 0.4.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 +2 -2
- data/lib/rambo/rspec/templates/example_group_template.erb +4 -5
- data/lib/rambo/rspec/templates/rambo_helper_file_template.erb +1 -1
- data/lib/rambo/rspec/templates/spec_file_template.erb +1 -1
- data/lib/version.rb +2 -2
- data/spec/lib/rambo/rspec/example_group_spec.rb +2 -16
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ce064cc2d8bc8241d368d5645fd1256f857eb3b
|
4
|
+
data.tar.gz: e9944b07b7f8c5b1812af9202832064c0aa5d1d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a27c1224771eb0dffa78f983935dbf748749a4367e87e8a597d4937d209dc20af10a9328c13eb868adafa88b0dda0a681dc9ea0d94c737b265b44aca719a83d0
|
7
|
+
data.tar.gz: d507dde0826b9cf97eaeb4a4c97d742c42659d5f8057e248dd7445a086fd212ae96f014d459230bf6dd7766944bddee517f1fcc251ce18c2129209678c6043cb
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Rambo is a gem that generates API contract tests from API docs in [RAML](http://raml.org/). Rambo is being developed to test APIs complying with standard REST practices. Mileage may vary with other architectures, but I'm happy to consider pull requests.
|
6
6
|
|
7
|
-
#### The current version of Rambo is 0.
|
7
|
+
#### The current version of Rambo is 0.4.0. It is highly unstable and has a limited feature set. Use at your own risk and please file issue reports if they come up!
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
You can install Rambo using:
|
@@ -14,7 +14,7 @@ gem install rambo_ruby
|
|
14
14
|
You can also add it to your project's Gemfile:
|
15
15
|
```ruby
|
16
16
|
group :development, :test do
|
17
|
-
gem 'rambo_ruby', '~> 0.
|
17
|
+
gem 'rambo_ruby', '~> 0.4'
|
18
18
|
end
|
19
19
|
```
|
20
20
|
There are three options for generating tests from Rambo: The command line tool, the rake task, and the Ruby API. In all cases, Rambo will look for a `.rambo.yml` file in the root directory of your project for configuration options. Options may also be passed in through the command line as arguments or the Ruby API as a hash. There is currently no option to pass arguments to the Rake task, but Rambo comes pre-loaded with sensible defaults, and the `.rambo.yml` file is always an option.
|
@@ -7,7 +7,6 @@
|
|
7
7
|
<%= headers.join(",\n ") %>
|
8
8
|
}
|
9
9
|
end<% end %><% if method.request_body %>
|
10
|
-
|
11
10
|
let(:request_body) do
|
12
11
|
File.read("<%= "spec/support/examples/#{@resource.to_s.gsub("/", "")}_#{method.method}_request_body.json" %>")
|
13
12
|
end<% end %><% if has_schema = method.responses.first.bodies.first.schema %>
|
@@ -22,18 +21,18 @@
|
|
22
21
|
let(:output_file) do
|
23
22
|
"<%= "spec/contract/output/#{@resource.to_s.gsub("/", "")}_#{method.method}_response.json" %>"
|
24
23
|
end
|
25
|
-
|
24
|
+
|
26
25
|
it "<%= method.description && method.description.downcase || "#{method.method}s the resource" %>" do
|
27
26
|
<%= method.method %> route<% if method.request_body %>, request_body<% end %><% if method.headers %>, headers<% end %>
|
28
27
|
|
29
|
-
File.open(output_file, "w+") {|file| file.puts JSON.pretty_generate(JSON.parse(
|
28
|
+
File.open(output_file, "w+") {|file| file.puts JSON.pretty_generate(JSON.parse(last_response.body)) }
|
30
29
|
|
31
|
-
expect(
|
30
|
+
expect(last_response.body).to <%= has_schema ? "match_schema response_schema" : "eql response_body" %>
|
32
31
|
end
|
33
32
|
|
34
33
|
it "returns status <%= method.responses.first.status_code %>" do
|
35
34
|
<%= method.method %> route<% if method.request_body %>, request_body<% end %><% if method.headers %>, headers<% end %>
|
36
|
-
expect(
|
35
|
+
expect(last_response.status).to eql <%= method.responses.first.status_code %>
|
37
36
|
end
|
38
37
|
end<%- end %>
|
39
38
|
end
|
data/lib/version.rb
CHANGED
@@ -36,7 +36,7 @@ RSpec.describe Rambo::RSpec::ExampleGroup do
|
|
36
36
|
it "creates a response schema object" do
|
37
37
|
aggregate_failures do
|
38
38
|
expect(subject.render).to include("let(:response_schema) do")
|
39
|
-
expect(subject.render).to include("expect(
|
39
|
+
expect(subject.render).to include("expect(last_response.body).to match_schema response_schema")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -45,7 +45,7 @@ RSpec.describe Rambo::RSpec::ExampleGroup do
|
|
45
45
|
it "creates a response_body object" do
|
46
46
|
aggregate_failures do
|
47
47
|
expect(subject.render).to include("let(:response_body) do")
|
48
|
-
expect(subject.render).to include("expect(
|
48
|
+
expect(subject.render).to include("expect(last_response.body).to eql response_body")
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -69,19 +69,5 @@ RSpec.describe Rambo::RSpec::ExampleGroup do
|
|
69
69
|
expect(subject.render).to include("let(:headers) do")
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
73
|
-
context "Rails app" do
|
74
|
-
it "uses response" do
|
75
|
-
expect(subject.render).to include("expect(response.body)")
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
context "non-Rails app" do
|
80
|
-
let(:options) { { rails: false } }
|
81
|
-
|
82
|
-
it "uses last_response" do
|
83
|
-
expect(subject.render).to include("expect(last_response.body)")
|
84
|
-
end
|
85
|
-
end
|
86
72
|
end
|
87
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rambo_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Scheider
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -284,10 +284,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
284
|
version: '0'
|
285
285
|
requirements: []
|
286
286
|
rubyforge_project:
|
287
|
-
rubygems_version: 2.
|
287
|
+
rubygems_version: 2.6.6
|
288
288
|
signing_key:
|
289
289
|
specification_version: 4
|
290
|
-
summary: rambo_ruby-0.
|
290
|
+
summary: rambo_ruby-0.4.0
|
291
291
|
test_files:
|
292
292
|
- features/create_files.feature
|
293
293
|
- features/error_modes.feature
|