rambo_ruby 0.6.0 → 0.7.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: ee4fdbe74465d4823e09b8cd7861e8f251b1d2e2
4
- data.tar.gz: 730738e5726b1674529c8da1b319d78272354d06
3
+ metadata.gz: d53775d081fb87382d73c486abc857cd932bb47a
4
+ data.tar.gz: c2fba09af8ffb9985cbb6bebec256dae4d6e536d
5
5
  SHA512:
6
- metadata.gz: d8e41a3b323913fc4a513d928bd192b6735bf7beb2b0c3dbb0b9c64fde3e46990e843ef86df279250446df68161555d8dde18c532f79208d2da162fc33619a5c
7
- data.tar.gz: d1dec7fda7fc463ca23937d8e5c9fa23ef790e11d7222842a04dbef92a1ae04090dd0a079b45de6d8610b11e6d9c93d183a6a07048cba1f7deb576b5e9a768ba
6
+ metadata.gz: a9cb776b2abee5c010f330a0161003af2426feedccd5e72c46fb03e9ffb740600758e21eddbbd01c85cafbae70fcca9d100057112ed712017f1a2ef1cf4dc33a
7
+ data.tar.gz: 610be83c6b01c5030816e26419c2c2c2003351dfdf50cbde6af1c2273fdec150bb986e1495a9753152b3118c9c6e7d4e4d610570167803f50907f9f9d9c785a7
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.6.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!
7
+ #### Rambo is still in development. It is 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.6'
17
+ gem 'rambo_ruby', '~> 0.7'
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.
@@ -37,7 +37,7 @@ $ rambo foobar.raml
37
37
  Replace `foobar.raml` with the path of the actual RAML file from which you want to generate tests.
38
38
 
39
39
  #### Options
40
- By default, Rambo assumes you are testing a Rails app and generates tests using syntax that will work for Rails apps. If you are testing a non-Rails app, you can use the `--framework` flag to indicate a `sinatra:classic`, `sinatra:modular`, or `grape` app. If you are using a different framework, please open an issue to let us know which, or submit a PR adding support for the framework you are using.
40
+ By default, Rambo assumes you are testing a Rails app and generates tests using syntax that will work for Rails apps. If you are testing a non-Rails app, you can use the `--framework` flag to indicate a `sinatra:classic`, `sinatra:modular`, `grape`, or `rory` app. If you are using a different framework, please open an issue to let us know which, or submit a PR adding support for the framework you are using.
41
41
 
42
42
  If your app uses an API token header, you can also pass in the token to be used as an option using the `-T` or `--token` flag:
43
43
  ```
@@ -64,7 +64,7 @@ require "rambo"
64
64
 
65
65
  Rambo.generate_contract_tests!(File.expand_path("doc/foobar.raml"), {})
66
66
  ```
67
- You can pass any options in as a hash. Currently, the available options are `:framework` and `:token`. Valid values for the `:framework` option are `:grape`, `:"sinatra:classic"`, `:"sinatra:modular"`, and `:rails`, with `:rails` being the default. The `:token` option takes an API token as a string.
67
+ You can pass any options in as a hash. Currently, the available options are `:framework` and `:token`. Valid values for the `:framework` option are `:grape`, `:"sinatra:classic"`, `:"sinatra:modular"`, `:rory`, and `:rails`, with `:rails` being the default. The `:token` option takes an API token as a string.
68
68
 
69
69
  ## The .rambo.yml File
70
70
  By default, Rambo will always check for a `.rambo.yml` file in the root directory of your projects and load options from there. If there is no `.rambo.yml` file, default values will be used (see below).
@@ -79,7 +79,7 @@ The three possible keys are:
79
79
  - `raml` - specifies the RAML file to use to generate the tests. The default, relative
80
80
  to the root of your project directory, is `doc/raml/foobar.raml`, where `foobar.raml` is the first RAML file found in the `doc/raml` directory.
81
81
  - `framework` - specifies the framework you are using. The default value is `rails`; other available
82
- frameworks are `sinatra:classic`, `sinatra:modular`, and `grape`.
82
+ frameworks are `sinatra:classic`, `sinatra:modular`, `grape`, and `rory`.
83
83
  - `token` - the API key or token to be included in the security headers. This value will be
84
84
  used for any header whose name matches either "token" or "key" (not case-sensitive).
85
85
 
@@ -91,7 +91,7 @@ In order to provide the best user experience to a majority of users, Rambo comes
91
91
  ### RAML File
92
92
  In the present version, Rambo only generates tests from a single RAML file. If you're using the command line tool, the name of this file is passed in as an argument. If you're not using the command line tool and don't specify by another means (Ruby hash, `.rambo.yml` file) which RAML file to use, Rambo will look in `your_project/doc/raml` and use the first RAML file it finds.
93
93
 
94
- As noted above, Rambo currently supports only Rails, Sinatra, and Grape apps. Since Rails is the most popular Ruby framework, it assumes your app is a Rails app unless specified otherwise. Since Rack::Test syntax differs when testing Rails and non-Rails apps, you will need to tell Rambo if your app is not a Rails app using the `--framework` flag on the command line, the `:framework` option for the Ruby API, or specifying `framework: <framework>` in your `.rambo.yml` file.
94
+ As noted above, Rambo currently supports only [Rails](https://github.com/rails/rails), [Sinatra](https://github.com/sinatra/sinatra), [Grape](https://github.com/ruby-grape/grape), and [Rory](https://github.com/screamingmuse/rory) apps. Since Rails is the most popular Ruby framework, it assumes your app is a Rails app unless specified otherwise. Since Rack::Test syntax differs when testing Rails and non-Rails apps, you will need to tell Rambo if your app is not a Rails app using the `--framework` flag on the command line, the `:framework` option for the Ruby API, or specifying `framework: <framework>` in your `.rambo.yml` file. Note that for Sinatra apps, you must choose either `sinatra:classic` or `sinatra:modular`.
95
95
 
96
96
  ## Using Rambo with Grape or Sinatra
97
97
  Rambo is able to generate tests for apps written in Rails, Grape, or Sinatra. However, it has one important limitation when working with non-Rails frameworks. Specifically, Rambo does not support multiple subclasses of `Sinatra::Base`, `Sinatra::Application`, or `Grape::API`. In order to identify the class of your app (which is required to configure Rack::Test), the Rambo-generated test configuration will use the first subclass of one of these classes that it finds. There is currently no option to override this behavior. (If you are building a classic Sinatra app instead of the modular type, `Sinatra::Application` will be used.)
@@ -20,7 +20,8 @@ module Rambo
20
20
  :rails => "Rails.application",
21
21
  :"sinatra:classic" => "Sinatra::Application",
22
22
  :"sinatra:modular" => "Sinatra::Base.descendants.find {|klass| klass != Sinatra::Application } || Sinatra::Application",
23
- :grape => "Grape::API.descendants.first"
23
+ :grape => "Grape::API.descendants.first",
24
+ :rory => "Rory.application"
24
25
  }
25
26
  end
26
27
 
@@ -1,4 +1,4 @@
1
- <% rails = @options.fetch(:framework, :rails) == :rails %> describe "<%= @resource.to_s %>" do
1
+ <% rails, rory = @options.fetch(:framework, :rails) == :rails, @options.fetch(:framework, :rails) == :rory %> describe "<%= @resource.to_s %>" do
2
2
  let(:route) { "<%= @resource.to_s %>" }
3
3
  <%- @resource.http_methods.each do |method| %>
4
4
  describe "<%= method.method.upcase %>" do
@@ -9,7 +9,7 @@
9
9
  end<% end %>
10
10
  <% if method.request_body %>
11
11
  let(:request_body) do
12
- <% if rails %>JSON.parse(
12
+ <% if rails || rory %>JSON.parse(
13
13
  File.read("<%= "spec/support/examples/#{@resource.to_s.gsub("/", "")}_#{method.method}_request_body.json" %>"),
14
14
  symbolize_names: true
15
15
  )<% else %>File.read("<%= "spec/support/examples/#{@resource.to_s.gsub("/", "")}_#{method.method}_request_body.json" %>")<% end %>
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Rambo
2
2
  MAJOR = '0'
3
- MINOR = '6'
3
+ MINOR = '7'
4
4
  PATCH = '0'
5
5
 
6
6
  def self.version
@@ -64,6 +64,16 @@ framework: rails
64
64
  end
65
65
  end
66
66
 
67
+ context "framework set to Rory" do
68
+ it "sets the framework to Rory" do
69
+ allow(Rambo).to receive(:yaml_options).and_return({ framework: :rory })
70
+ expect(Rambo::DocumentGenerator)
71
+ .to receive(:generate!)
72
+ .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { framework: :rory })
73
+ Rambo.generate_contract_tests!
74
+ end
75
+ end
76
+
67
77
  context "framework set to Grape" do
68
78
  it "sets framework to Grape" do
69
79
  allow(Rambo).to receive(:yaml_options).and_return({ framework: :grape })
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rambo_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dana Scheider
@@ -287,7 +287,7 @@ rubyforge_project:
287
287
  rubygems_version: 2.6.6
288
288
  signing_key:
289
289
  specification_version: 4
290
- summary: rambo_ruby-0.6.0
290
+ summary: rambo_ruby-0.7.0
291
291
  test_files:
292
292
  - features/create_files.feature
293
293
  - features/error_modes.feature