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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2143c81f22d7a3f9960dc3837090b51ab7585be
4
- data.tar.gz: 6a840d4100def12e51b86bbc7ef1760700602829
3
+ metadata.gz: 9ce064cc2d8bc8241d368d5645fd1256f857eb3b
4
+ data.tar.gz: e9944b07b7f8c5b1812af9202832064c0aa5d1d5
5
5
  SHA512:
6
- metadata.gz: 6db7613814a00244c952440c0d83b5b17f9693f34a64817ba3d21ed4da8a7c1973c2379b1051766229805f5f3042e9e1f5361db9434740de7a96734fdaff3283
7
- data.tar.gz: 0c1f0e99cfd4d008a6c5d3a282cfe79e1c52eda003406c85fa2d4fa432bee9cc4966bf999810d84a066ca7974817d43c0f2393b62ed06004ddf29954f56fd258
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.3.3. It is highly unstable and has a limited feature set. Use at your own risk and please file issue reports if they come up!
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.3.3'
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
- <% resp_method = @options[:rails] ? "response" : "last_response" %>
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(<%= resp_method %>.body)) }
28
+ File.open(output_file, "w+") {|file| file.puts JSON.pretty_generate(JSON.parse(last_response.body)) }
30
29
 
31
- expect(<%= resp_method %>.body).to <%= has_schema ? "match_schema response_schema" : "eql response_body" %>
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(<%= resp_method %>.status).to eql <%= method.responses.first.status_code %>
35
+ expect(last_response.status).to eql <%= method.responses.first.status_code %>
37
36
  end
38
37
  end<%- end %>
39
38
  end
@@ -11,5 +11,5 @@ require_relative "./support/matchers/rambo_matchers"
11
11
  end
12
12
 
13
13
  RSpec.configure do |config|
14
- config.include ApiHelper, type: :request
14
+ config.include ApiHelper, type: :rambo
15
15
  end<% end %>
@@ -1,6 +1,6 @@
1
1
  require "rambo_helper"
2
2
 
3
- RSpec.describe "<%= @raml.title %>", type: :request do
3
+ RSpec.describe "<%= @raml.title %>", type: :rambo do
4
4
 
5
5
  # Delete output files from previous test run prior to running tests again
6
6
  before(:all) do
data/lib/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Rambo
2
2
  MAJOR = '0'
3
- MINOR = '3'
4
- PATCH = '3'
3
+ MINOR = '4'
4
+ PATCH = '0'
5
5
 
6
6
  def self.version
7
7
  [Rambo::MAJOR, Rambo::MINOR, Rambo::PATCH].join('.')
@@ -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(response.body).to match_schema response_schema")
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(response.body).to eql response_body")
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.3.3
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-09 00:00:00.000000000 Z
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.5.1
287
+ rubygems_version: 2.6.6
288
288
  signing_key:
289
289
  specification_version: 4
290
- summary: rambo_ruby-0.3.3
290
+ summary: rambo_ruby-0.4.0
291
291
  test_files:
292
292
  - features/create_files.feature
293
293
  - features/error_modes.feature