https://github.com/cldwalker/bahia
commandline acceptance testing - aruba for non-cucumber test frameworks
https://github.com/cldwalker/bahia
Last synced: about 1 year ago
JSON representation
commandline acceptance testing - aruba for non-cucumber test frameworks
- Host: GitHub
- URL: https://github.com/cldwalker/bahia
- Owner: cldwalker
- License: mit
- Created: 2011-12-12T05:48:40.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-04-09T05:36:30.000Z (about 14 years ago)
- Last Synced: 2025-03-11T06:46:48.886Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 143 KB
- Stars: 51
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rdoc
- License: LICENSE.txt
Awesome Lists containing this project
README
Description
===========
Bahia - where commandline acceptance tests are easy, the people are festive and
onde nasceu capoeira. In other words, aruba for any non-cucumber test framework.
Works across rubies on 1.8 and 1.9.
Usage
=====
Say you want to test your gem's executable, blarg:
describe "blarg" do
it "prints usage without args" do
blarg
stdout.should == 'Usage: blarg COMMAND'
end
it 'prints error for double blarging' do
blarg "blarg"
stderr.should == "Bad human! No double blarging allowed"
process.success?.should == false
end
it "prints message for quoted args" do
blarg %[please handle 'blarg multiple' "blarg words"]
stdout.should == "Why u like quote so much?"
process.success?.should == true
end
end
As you can see, bahia provided helpers stdout, stderr and process as well as
automatically creates a method to invoke your executable.
Setting it up in your {test,spec}/helper.rb is just a simple include:
require 'bahia'
# for rspec
Rspec.configure {|c| c.include Bahia }
# for minitest
class MiniTest::Unit::TestCase
include Bahia
end
# for bacon
class Bacon::Context
include Bahia
end
# for your preferred framework
include some shit ...
If the above doesn't automagically work for you, configure Bahia before
including it:
Bahia.command = 'blarg 3.0'
Bahia.command_method = 'not blarg'
Bahia.project_directory = '/path/to/gem/root/dir'
About
=====
Bahia uses open3 and is dead simple - so simple that you probably should've read
the source instead of this readme. Ha!
Edit: open3 don't work for 1.9 rubies so the joke is on me.
Limitations
===========
Can't capture process in jruby yet.
Contributing
============
[See here](http://tagaholic.me/contributing.html)
Credits
=======
* @spicycode - initial testing
* @rsanheim - allow project\_directory override