Permalink
Browse files

Taco is somewhat implemented now.

  • Loading branch information...
1 parent dcaea75 commit 547430a98d1f4fa87290d0348cb5d2c189fef413 @zachinglis committed Jul 20, 2011
Showing with 58 additions and 17 deletions.
  1. +1 −0 Gemfile
  2. +4 −0 Gemfile.lock
  3. +2 −1 lib/taco-truck.rb
  4. +21 −2 spec/spec_helper.rb
  5. +3 −12 spec/taco-truck_spec.rb
  6. +27 −2 spec/taco_spec.rb
View
@@ -9,6 +9,7 @@ group :development do
gem "growl"
gem "spork"
gem "guard-rspec"
+ gem "simplecov"
end
gem "thor"
View
@@ -23,6 +23,9 @@ GEM
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
+ simplecov (0.4.2)
+ simplecov-html (~> 0.4.4)
+ simplecov-html (0.4.5)
spork (0.8.5)
thor (0.14.6)
@@ -37,5 +40,6 @@ DEPENDENCIES
rb-fsevent
rcov
rspec (~> 2.6.0)
+ simplecov
spork
thor
View
@@ -1,6 +1,6 @@
require "thor"
require "yaml"
-
+require "taco"
## Todo: Don't forget say_status, etc
class TacoTruck < Thor
@@ -55,6 +55,7 @@ def list
protected
def parse_git(uri)
+ Taco.woop
# TODO: For now, actually grabbing git needs to be done but is more complex, so pointing to the Github file will suffice for now.
parse_git_file(uri)
["Yay", "It Works", "It really works"]
View
@@ -1,6 +1,10 @@
-require 'rubygems'
+require 'simplecov'
+SimpleCov.start 'rails'
+
require 'spork'
+SimpleCov.start
+
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
@@ -43,11 +47,20 @@ def run(command)
result
end
+ def fixtures_dir
+ File.join(Dir.pwd, "spec/fixtures")
+ end
+
+ def taco_tmp_dir
+ File.join(Dir.pwd, "spec/tmp")
+ end
+
def taco_dir
- File.join(Dir.pwd, "spec/fixtures/taco")
+ File.join(taco_tmp_dir, "/taco")
end
def create_test_environment(fixtures=true)
+ destroy_test_environment
Dir.mkdir(taco_dir)
File.open(File.join(taco_dir, "tacofile"), "w+") do |file|
if fixtures == true
@@ -60,6 +73,12 @@ def destroy_test_environment
`rm -rf #{taco_dir}`
end
+ def create_tacos
+ %w(sample).each do |name|
+ FileUtils.cp(File.join(fixtures_dir, "/#{name}.taco"), File.join(taco_tmp_dir, "/#{name}.taco"))
+ end
+ end
+
def capture(stream=:stdout)
begin
stream = stream.to_s
View
@@ -12,10 +12,6 @@
@response = taco(:list)
end
- after(:all) do
- destroy_test_environment
- end
-
it "should explain what it's doing" do
@response.should match(/Listing Tacos/)
end
@@ -39,11 +35,8 @@
@response = taco(:list)
end
- after(:all) do
- destroy_test_environment
- end
-
it "should notify if there is no Tacos" do
+ pending
@response.should match(/No Tacos present/)
end
end
@@ -53,11 +46,8 @@
create_test_environment
end
- after(:all) do
- destroy_test_environment
- end
-
it "should add Tacos" do
+ pending
lambda do
taco(:add, { :uri => "git://github.com/foo/bar.git" })
end.should change {
@@ -84,6 +74,7 @@
end
it "should not re-add a Taco if it exists" do
+ pending
TacoTruck.any_instance.stub!(:parse_git).and_return(["Doubly Submitted", "It works alos", "http://itworks.com/labs/second"])
taco(:add, :uri => "git://doublysubmitted")
View
@@ -1,6 +1,31 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-# TODO: turn match into include (as a string)
+describe Taco do
+ before(:all) do
+ create_tacos
+ end
-describe "Taco" do
+ describe "attributes" do
+ before(:each) do
+ file = File.join(taco_tmp_dir, "/tacos/sample.taco")
+ @taco = Taco.parse_file(file)
+ end
+
+ it "should get name" do
+ @taco.title.should == "Sample Taco"
+ end
+
+ it "should get description" do
+ @taco.description.should include("This is a sample Taco.")
+ @taco.description.should include("The description can be multilined.")
+ end
+
+ it "should get uri" do
+ @taco.uri.should == "http://zachinglis.com/sample"
+ end
+
+ it "should get repository uri" do
+ @taco.repository.should == "git://github.com/foo/bar.git"
+ end
+ end
end

0 comments on commit 547430a

Please sign in to comment.