Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,19 @@ jobs:
with:
run: |
bundle exec rake spec
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.ruby }}
parallel: true

finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.irbrc
.bundle
log
vendor
vendor
coverage
16 changes: 16 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

if ENV['CI'] # only when running CI
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = 'coverage/lcov.info'
end

SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
end

SimpleCov.start do
enable_coverage :branch
add_filter '/spec/'
end
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ group :test do
gem 'rack-test'
gem 'rspec'
gem 'selenium-webdriver'
gem 'simplecov', require: false
gem 'simplecov-lcov', require: false
end
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ GEM
rubyzip (>= 1.2.2, < 4.0)
websocket (~> 1.0)
shellany (0.0.1)
simplecov (1.1.1)
simplecov-lcov (0.9.0)
spoon (0.0.6)
ffi
thor (1.5.0)
Expand Down Expand Up @@ -246,6 +248,8 @@ DEPENDENCIES
rubocop-rake
rubocop-rspec
selenium-webdriver
simplecov
simplecov-lcov

BUNDLED WITH
4.0.16
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Grape API on Rack
=================

[![Test](https://github.com/ruby-grape/grape-on-rack/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/ruby-grape/grape-on-rack/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/ruby-grape/grape-on-rack/badge.svg?branch=master)](https://coveralls.io/github/ruby-grape/grape-on-rack?branch=master)

A [Grape](http://github.com/ruby-grape/grape) API mounted on Rack.

Expand Down
4 changes: 4 additions & 0 deletions app/acme_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ class App
def initialize
@filenames = ['', '.html', 'index.html', '/index.html']
@rack_static = ::Rack::Static.new(
# Rack::Static requires a fallback app, but since urls: ['/'] matches every
# request, it never falls back to this and the lambda is never called.
# simplecov:disable
-> { [404, {}, []] },
# simplecov:enable
root: File.expand_path('../public', __dir__),
urls: ['/']
)
Expand Down
7 changes: 7 additions & 0 deletions spec/api/get_json_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ def app
{ id: 2, reticulated: false }
].to_json)
end

it 'leaves a non-JSON param unchanged' do
get '/api/reticulated_splines', 'splines' => [
{ id: 1, reticulated: false }
].to_json, 'not_json' => 'not valid json'
expect(last_response.status).to eq(200)
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'rubygems'
require 'simplecov'

ENV['RACK_ENV'] ||= 'test'

Expand Down
Loading