RSpec DSL helpers
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/rspec
spec
.gitignore
.rspec
Gemfile
LICENSE.txt
README.md
Rakefile
rspec-launchbox.gemspec

README.md

Rspec::Launchbox

Bundle of RSpec DSL helpers, providing timeout matchers, service runners. Work in progress.

Installation

Add this line to your application's Gemfile:

gem 'rspec-launchbox'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec-launchbox

Usage

Documentation

in_presence_of

#spec/spec_helper.rb

require 'rspec/launchbox'

RSpec.configure do |config|
#...
  config.extend RSpec::InPresenceOf
  config.include RSpec::Matchers::Timeout
end
include RSpec::DescribeExecutable

Then in spec file:

describe MyClass do
  in_presence_of 'external_program' do
    it 'should listen on port' do
      #here goes expectation
    end
  end
end

describe_executable

describe_executable 'ls' do
  its_stdout do
    it { is_expected.to be_a String }
  end
end

expect { }.to persist

expect do
  #routine
end.to persist.at_least(3) # or 3.seconds if you use ActiveSupport

This snippet runs binary called external_program (should be in path, or pass absolute path), and makes sure process started by that command is dead.

TODO: One day there will be optional parameters e.g. signal to send to process.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/rspec-launchbox/fork )
  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 a new Pull Request