Vigia

Build Status Code Climate Test Coverage

What is it?

Vigia logo

Vigia is a gem to perform integration tests on an API server using RSpec and a compatible adapter (See Adapters). The adapter creates the structure of the test (groups and context) and sets up all the variables (See Context variables) used to perform the http request.

These results and expectations objects can be used to run examples that will compare the expected value with the server response value. Vigia allows to use a variety of different ways to execute these comparisons (See Vigia Examples and Custom Shared Examples)

Installation

Include Vigia as gem inside :test group


group :test do
  gem 'vigia'
end

Run bundle install

$ bundle install

Now, Vigia can be used inside your application.

Getting started

This example shows an easy way to start a rails server and perform you apibs test.

# Your lib/tasks/vigia.rake
namespace :spec do
  desc 'Run Vigia tests'
  task :vigia => :environment do

    # start rails server by the easiest way
    system("bundle exec rails s -e #{ Rails.env } -d")
    # give some time to the server
    sleep 10

    Vigia.configure do |config|
      config.source_file = "#{ Rails.root }/apibs/my_api.apib"
      config.host        = 'http://localhost:3000'
    end

    Vigia.rspec!
  end
end