Wire up capybara & add simple feature spec for swagger-ui

This commit is contained in:
richie 2016-11-08 12:38:51 -08:00
parent 8315eda8b2
commit 99be8135f7
5 changed files with 37 additions and 0 deletions

View File

@ -7,4 +7,8 @@ env:
- "RAILS_VERSION=5.0.0"
cache: bundler
install: bundle update
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
script: ./ci/test.sh

View File

@ -25,6 +25,8 @@ group :test do
gem 'test-unit'
gem 'rspec-rails'
gem 'generator_spec'
gem 'capybara'
gem 'capybara-webkit'
gem 'rswag-specs', path: './rswag-specs'
end

View File

@ -51,6 +51,16 @@ GEM
addressable (2.4.0)
arel (3.0.3)
builder (3.0.4)
capybara (2.10.1)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-webkit (1.1.0)
capybara (~> 2.0, >= 2.0.2)
json
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.7.0)
@ -68,7 +78,10 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
mini_portile2 (2.1.0)
multi_json (1.12.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
polyglot (0.3.5)
power_assert (0.3.1)
rack (1.4.7)
@ -138,11 +151,15 @@ GEM
tzinfo (0.3.51)
uglifier (3.0.2)
execjs (>= 0.3.0, < 3)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
capybara
capybara-webkit
generator_spec
rails (= 3.2.22)
rspec-rails

View File

@ -0,0 +1,12 @@
require 'rails_helper'
feature 'swagger-ui', js: true do
scenario 'browsing api-docs' do
visit '/api-docs'
expect(page).to have_content('GET /blogs Searches blogs')
expect(page).to have_content('POST /blogs Creates a blog')
expect(page).to have_content('GET /blogs/{id} Retrieves a blog')
end
end

View File

@ -50,4 +50,6 @@ RSpec.configure do |config|
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")
Capybara.javascript_driver = :webkit
end