Skip to content

Commit 5408f89

Browse files
committed
Added a test app and Travis-CI.
1 parent 01350e7 commit 5408f89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+797
-1
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
before_install:
2+
- "export DISPLAY=:99.0"
3+
- "sh -e /etc/init.d/xvfb start"
4+
5+
language: ruby
6+
7+
cache: bundler
8+
9+
rvm:
10+
- 2.1.2

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# GrapeSwaggerRails
22

3+
[![Build Status](https://travis-ci.org/BrandyMint/grape-swagger-rails.svg)](https://travis-ci.org/BrandyMint/grape-swagger-rails)
4+
35
Swagger UI as Rails Engine for grape-swagger gem
46

57
## Installation

Rakefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
require "bundler/gem_tasks"
2+
3+
desc "Run tests within test-app."
4+
task :tests do
5+
path = File.expand_path('../test-app', __FILE__)
6+
Bundler.clean_exec "cd #{path}; bundle install; bundle exec rake"
7+
end
8+
9+
task :default => :tests

grape-swagger-rails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
1212
spec.summary = %q{grape grape-swagger swagger-ui rails integration}
1313
spec.homepage = ''
1414
spec.license = 'MIT'
15-
spec.files = `git ls-files`.split($/)
15+
spec.files = `git ls-files`.split($/) - `git ls-files test-app`.split($/)
1616
spec.require_paths = %w(lib)
1717

1818
spec.add_development_dependency 'bundler', '~> 1.3'

test-app/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore the default SQLite database.
11+
/db/*.sqlite3
12+
/db/*.sqlite3-journal
13+
14+
# Ignore all logfiles and tempfiles.
15+
/log/*.log
16+
/tmp

test-app/.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--color
2+
--require spec_helper
3+
--format documentation

test-app/Gemfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'rails', '4.1.5'
4+
gem 'sass-rails', '~> 4.0.3'
5+
gem 'uglifier', '>= 1.3.0'
6+
gem 'coffee-rails', '~> 4.0.0'
7+
gem 'jquery-rails'
8+
gem 'jbuilder', '~> 2.0'
9+
gem 'turbolinks'
10+
gem 'grape'
11+
gem 'grape-swagger'
12+
gem 'grape-swagger-ui'
13+
gem 'grape-swagger-rails', path: '../..'
14+
15+
group :development, :test do
16+
gem 'rspec-rails'
17+
gem 'capybara'
18+
gem 'selenium-webdriver'
19+
end

test-app/README.rdoc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
== README
2+
3+
This README would normally document whatever steps are necessary to get the
4+
application up and running.
5+
6+
Things you may want to cover:
7+
8+
* Ruby version
9+
10+
* System dependencies
11+
12+
* Configuration
13+
14+
* Database creation
15+
16+
* Database initialization
17+
18+
* How to run the test suite
19+
20+
* Services (job queues, cache servers, search engines, etc.)
21+
22+
* Deployment instructions
23+
24+
* ...
25+
26+
27+
Please feel free to use a different markup language if you do not plan to run
28+
<tt>rake doc:app</tt>.

test-app/Rakefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require File.expand_path('../config/application', __FILE__)
5+
6+
Rails.application.load_tasks
7+
8+
if Rails.env.test? || Rails.env.development?
9+
task default: [:spec]
10+
end

test-app/app/api/api.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class API < Grape::API
2+
format :json
3+
prefix 'api'
4+
5+
namespace :foos do
6+
desc 'Get foos.'
7+
get do
8+
[{ id: 1, name: 'Foo' }]
9+
end
10+
11+
desc 'Get a foo.'
12+
params do
13+
requires :id, type: String, desc: 'Foo id.'
14+
end
15+
get :id do
16+
{ id: 1, name: 'Foo' }
17+
end
18+
end
19+
20+
add_swagger_documentation
21+
end

0 commit comments

Comments
 (0)