Browse files

using rspec, started to change to a gem

  • Loading branch information...
1 parent 29deab8 commit 565cdb615525bcf97e1d8bb5a01b7c1c76633116 ian asaff committed Aug 14, 2011
View
BIN .DS_Store
Binary file not shown.
View
13 Gemfile
@@ -0,0 +1,13 @@
+source "http://rubygems.org"
+# Add dependencies required to use your gem here.
+# Example:
+# gem "activesupport", ">= 2.3.5"
+
+# Add dependencies to develop your gem here.
+# Include everything needed to run rake, tests, features, etc.
+group :development do
+ gem "rspec", "~> 2.3.0"
+ gem "bundler", "~> 1.0.0"
+ gem "jeweler", "~> 1.5.2"
+ gem "rcov", ">= 0"
+end
View
28 Gemfile.lock
@@ -0,0 +1,28 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.2)
+ git (1.2.5)
+ jeweler (1.5.2)
+ bundler (~> 1.0.0)
+ git (>= 1.2.5)
+ rake
+ rake (0.9.2)
+ rcov (0.9.10)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (~> 1.0.0)
+ jeweler (~> 1.5.2)
+ rcov
+ rspec (~> 2.3.0)
View
20 LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2011 ian asaff
+
+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.
View
19 README.rdoc
@@ -0,0 +1,19 @@
+= blirb
+
+Description goes here.
+
+== Contributing to blirb
+
+* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
+* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
+* Fork the project
+* Start a feature/bugfix branch
+* Commit and push until you are happy with your contribution
+* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
+* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
+
+== Copyright
+
+Copyright (c) 2011 ian asaff. See LICENSE.txt for
+further details.
+
View
52 Rakefile
@@ -1,4 +1,50 @@
-load 'test/tasks.rake'
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+require 'rake'
-desc 'Default: run unit tests'
-task :default => :test
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
+ gem.name = "blirb"
+ gem.homepage = "http://github.com/montague/blirb"
+ gem.license = "MIT"
+ gem.summary = %Q{TODO: one-line summary of your gem}
+ gem.description = %Q{TODO: longer description of your gem}
+ gem.email = "iasaff@where.com"
+ gem.authors = ["ian asaff"]
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
+end
+Jeweler::RubygemsDotOrgTasks.new
+
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
+end
+
+RSpec::Core::RakeTask.new(:rcov) do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
+ spec.rcov = true
+end
+
+task :default => :spec
+
+require 'rake/rdoctask'
+Rake::RDocTask.new do |rdoc|
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
+
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "blirb #{version}"
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
View
4 blirb_tasks/tasks.rb
@@ -31,11 +31,11 @@ def fist_bump
}
task "Give 'Bro' a class method called 'protein_shake' that returns the string 'getting hyooge!'", %{
- Bro.protein_shake == 'getting hyooge'
+ Bro.protein_shake == 'getting hyooge!'
}, %{
class Bro
def self.protein_shake
- "getting hyooge"
+ "getting hyooge!"
end
end
}
View
7 spec/blirb_spec.rb
@@ -0,0 +1,7 @@
+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+
+describe "Blirb" do
+ it "fails" do
+ # fail "hey buddy, you should probably rename this file and start specing for real"
+ end
+end
View
16 test/test_helper.rb → spec/spec_helper.rb
@@ -1,8 +1,14 @@
-Dir.chdir File.expand_path('../..', __FILE__) #for textmate's cmd+R
-require_relative '../lib/blirb'
-require 'test/unit'
-class Test::Unit::TestCase
- include Blirb
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+require 'rspec'
+require 'blirb'
+
+# Requires supporting files with custom matchers and macros, etc,
+# in ./support/ and its subdirectories.
+Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
+
+RSpec.configure do |config|
+
end
class TaskTester
View
9 spec/task_spec.rb
@@ -0,0 +1,9 @@
+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+
+describe "each task" do
+ it "has verification code that allows it to pass" do
+ TaskTester.new.tasks.each do |task|
+ task.verify!(binding).should be_true
+ end
+ end
+end
View
7 tasks.txt
@@ -1,7 +0,0 @@
--Modularization
- -interface for a user to write his own tasks. how does it work?
- -initial idea
- -on the command line, user passes a file that contains a
- list of tasks (yml?)
- -blirb parses them and drops them into the app logic?
-
View
12 test/coordinator_test.rb
@@ -1,12 +0,0 @@
-require_relative 'test_helper'
-class CoordinatorTest < Test::Unit::TestCase
-
- def test_coordinator_basics
- bc = Coordinator.new 'test/fixtures/tasks.rb'
- assert_equal 1, bc.tasks.length, "bc should have tasks"
- assert Object.class_eval { @blirb }, "bc should set Object class variable"
- end
-
-
-
-end
View
8 test/fixtures/tasks.rb
@@ -1,8 +0,0 @@
-task "define a method 'herp_derp' that returns 'sup foo'", %{
- begin herp_derp == 'sup foo' rescue false end
-}, %{
- def herp_derp
- 'sup foo'
- end
-}
-
View
14 test/task_test.rb
@@ -1,14 +0,0 @@
-require_relative 'test_helper'
-class TasksTest < Test::Unit::TestCase
- def setup
- @tester = TaskTester.new
- end
-
- # make sure that each task defined is verifiable
- def test_tasks
- @tester.tasks.each do |task|
- assert task.verify!(binding), task.description
- end
- end
-
-end
View
8 test/tasks.rake
@@ -1,8 +0,0 @@
-require 'rake/testtask'
-
-desc 'Test blirb'
-Rake::TestTask.new(:test) do |t|
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
- t.libs << 'test'
-end

0 comments on commit 565cdb6

Please sign in to comment.