Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rspec_delivery

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rspec_delivery

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

RSpec Delivery

RSpec Delivery is a gem designed to post to a web-service the results of your rspec test. (still in development)

Installation

Add this line to your application's Gemfile:

gem 'rspec_delivery'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec_delivery

Usage

Setting the Formatter

Once you have the RSpec Delivery gem installed, you need to specify 'RspecDelivery' as the formatter to be used when running your rspec tests.

in a Rakefile:

RSpec::Core::RakeTask.new do |t|
  t.rspec_opts = "-r post_rspec/formatter -f RspecDelivery::Formatter"
end

or within your .rspec file:

--format RspecDelivery::Formatter
--color

or from the command line:

rspec -r rspec_delivery/formatter --format RspecDelivery::Formatter --color

or from within your spec_helper.rb

require 'rspec_delivery/formatter'

RSpec.configure do |config|
	config.add_formatter(RspecDelivery::Formatter)
	config.color_enabled = true
end
Setting the POST endpoint

You also need to add a config var within the Rspec.config block to specify an endpoint to post to:

RSpec.configure do |config|
  config.add_setting :rspec_delivery_endpoint
  config.rspec_delivery_endpoint = 'http://localhost:3000/...'
end
Response / Summary

Once your rspec suite finishes running, it will send a POST to your specified endpoint with a body that looks like:

{
	"rspec_data"=>{
		"duration"=>184.146366, 
		"example_count"=>9, 
		"failure_count"=>4, 
		"pending_count"=>0
	}, 
	"errors"=>[
		{
			"description"=>"Example description #1...", 
			"status"=>"failed", 
			"run_time"=>15.583829, 
			"file_path"=>"./spec/models/example_1.rb", 
			"line_number"=>"10"
		}, {
			"description"=>"Example description #2", 
			"status"=>"failed", 
			"run_time"=>22.671084, 
			"file_path"=>"./spec/controllers/example_2.rb", 
			"line_number"=>"38"
		}, 
		....
	], 
	"successes"=>[
		{
			"description"=>"Example description #3", 
			"status"=>"passed", 
			"run_time"=>22.481478, 
			"file_path"=>"./app/specs/models/example_3.rb", 
			"line_number"=>"5"
		}, 
		....
	], 
	"pending"=>nil
}

After the POST is sent, a message will be displayed within your terminal that contains the rspec suite summary (total time spent running tests, number of tests, number of failed tests, number of pending tests, and success rate) and two additional line items including the server response status and the server response body.

TODO

  • error handling
  • still needs some stabilization / refactoring
  • would like to setup a config block to set things like endpoint, config vars, etc...
  • would like to setup the ability to send an email instead of http POST
  • setup other HTTP methods (such as 'GET')
  • ability to customize POST body

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 24 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc