Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 5e27d2141b1482697c9e835f96383a6e02f9c78e @cldwalker committed Jul 15, 2010
Showing with 134 additions and 0 deletions.
  1. +19 −0 .gemspec
  2. +2 −0 CHANGELOG.rdoc
  3. +22 −0 LICENSE.txt
  4. +21 −0 README.rdoc
  5. +35 −0 Rakefile
  6. +35 −0 lib/bacon/bits.rb
@@ -0,0 +1,19 @@
+# -*- encoding: utf-8 -*-
+require 'rubygems' unless Object.const_defined?(:Gem)
+require File.dirname(__FILE__) + "/lib/bacon/bits"
+
+Gem::Specification.new do |s|
+ s.name = "bacon-bits"
+ s.version = Bacon::Bits::VERSION
+ s.authors = ["Gabriel Horner"]
+ s.email = "gabriel.horner@gmail.com"
+ s.homepage = "http://github.com/cldwalker/bacon-bits"
+ s.summary = "Making bacon a little tastier."
+ s.description = "This extends the bacon testing framework with useful extensions to disable tests, have before and after blocks that run once and more."
+ s.required_rubygems_version = ">= 1.3.6"
+ s.rubyforge_project = 'tagaholic'
+ s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c}]) + %w{Rakefile .gemspec}
+ s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
+ s.add_dependency 'bacon', '>=1.1.0'
+ s.license = 'MIT'
+end
@@ -0,0 +1,2 @@
+== 0.0.1
+* Initial release
@@ -0,0 +1,22 @@
+The MIT LICENSE
+
+Copyright (c) 2010 Gabriel Horner
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,21 @@
+== Description
+
+This extends the bacon testing framework with useful extensions to disable tests, have before and after
+blocks that run once and more. For examples in the wild, see the tests for
+boson{http://github.com/cldwalker/boson} or bond{http://github.com/cldwalker/bond}.
+
+== Install
+
+Install the gem with:
+
+ sudo gem install bacon-bits
+
+== Usage
+
+Use in tests with:
+
+ require 'bacon/bits'
+
+== Bugs/Issues
+
+Please report them {on github}[http://github.com/cldwalker/bacon-bits/issues].
@@ -0,0 +1,35 @@
+require 'rake'
+require 'fileutils'
+
+def gemspec
+ @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
+end
+
+desc "Build the gem"
+task :gem=>:gemspec do
+ sh "gem build .gemspec"
+ FileUtils.mkdir_p 'pkg'
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
+end
+
+desc "Install the gem locally"
+task :install => :gem do
+ sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
+end
+
+desc "Generate the gemspec"
+task :generate do
+ puts gemspec.to_ruby
+end
+
+desc "Validate the gemspec"
+task :gemspec do
+ gemspec.validate
+end
+
+desc 'Run tests'
+task :test do |t|
+ sh 'bacon -q -Ilib -I. test/*_test.rb'
+end
+
+task :default => :test
@@ -0,0 +1,35 @@
+require 'bacon'
+
+module Bacon
+ module Bits
+ VERSION = '0.0.1'
+
+ # Will remove this once the latest bacon (which contains this) is released as a gem
+ def self.included(mod)
+ mod.module_eval do
+ # nested context methods automatically inherit methods from parent contexts
+ def describe(*args, &block)
+ context = Bacon::Context.new(args.join(' '), &block)
+ (parent_context = self).methods(false).each {|e|
+ class<<context; self end.send(:define_method, e) {|*args| parent_context.send(e, *args)}
+ }
+ @before.each { |b| context.before(&b) }
+ @after.each { |b| context.after(&b) }
+ context.run
+ end
+ end
+ end
+
+ def xit(*args); end
+ def xdescribe(*args); end
+ def before_all; yield; end
+ def after_all; yield; end
+ def assert(description, &block)
+ it(description) do
+ block.call.should == true
+ end
+ end
+ end
+end
+
+Bacon::Context.send :include, Bacon::Bits

0 comments on commit 5e27d21

Please sign in to comment.