Commit b8d7d6a0 by andrew morton Committed by GitHub

Merge pull request #9 from drewish/rake-task

Add a rake task and railtie to load it
parents 2edc9cee 40005c27
...@@ -55,9 +55,8 @@ end ...@@ -55,9 +55,8 @@ end
## Generate the docs ## Generate the docs
Eventually [this will become a rake task](https://github.com/drewish/rspec-rails-swagger/issues/2):
``` ```
bundle exec rspec -f RSpec::Rails::Swagger::Formatter --order defined -t swagger_object bundle exec rake swagger
``` ```
## Running tests ## Running tests
......
...@@ -10,6 +10,14 @@ module RSpec ...@@ -10,6 +10,14 @@ module RSpec
module Rails module Rails
module Swagger module Swagger
initialize_configuration RSpec.configuration initialize_configuration RSpec.configuration
if defined?(::Rails)
class Railtie < ::Rails::Railtie
rake_tasks do
load 'rspec/rails/swagger/tasks/swagger.rake'
end
end
end
end end
end end
end end
......
require 'rspec/core/rake_task'
desc "Regenerate Swagger docs"
RSpec::Core::RakeTask.new(:swagger) do |t|
t.verbose = false
t.rspec_opts = "-f RSpec::Rails::Swagger::Formatter --order defined -t swagger_object"
end
...@@ -3,7 +3,7 @@ module RSpec ...@@ -3,7 +3,7 @@ module RSpec
# Version information for RSpec Swagger. # Version information for RSpec Swagger.
module Swagger module Swagger
module Version module Version
STRING = '0.1.0' STRING = '0.1.1'
end end
end end
end end
......
...@@ -17,6 +17,7 @@ Gem::Specification.new do |s| ...@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
'lib/rspec/rails/swagger/helpers.rb', 'lib/rspec/rails/swagger/helpers.rb',
'lib/rspec/rails/swagger/request_builder.rb', 'lib/rspec/rails/swagger/request_builder.rb',
'lib/rspec/rails/swagger/version.rb', 'lib/rspec/rails/swagger/version.rb',
'lib/rspec/rails/swagger/tasks/swagger.rake',
] ]
s.homepage = 'https://github.com/drewish/rspec-rails-swagger' s.homepage = 'https://github.com/drewish/rspec-rails-swagger'
......
require 'swagger_helper'
RSpec.describe RSpec::Rails::Swagger do
it "loads" do
expect(RSpec::Rails::Swagger::Version::STRING).to eq '0.1.0'
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment