Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added spec.

  • Loading branch information...
commit 8ab36ca2f014183dc30b5c7ff36a712d94b4f7d2 1 parent 9ae3636
@jingweno authored
View
1  .rspec
@@ -0,0 +1 @@
+--colour --format documentation
View
9 jekyll_and_hyde.gemspec
@@ -20,8 +20,11 @@ Gem::Specification.new do |s|
s.add_development_dependency('cucumber')
s.add_development_dependency('fakefs')
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ #s.files = Dir['lib/**/*.rb'] + Dir['bin/*'] + Dir['[A-Z]*'] + Dir['spec/**/*']
+ #s.test_files = Dir['spec/**/*']
+ #s.executables = Dir['bin/*']
+ #s.files = `git ls-files`.split("\n")
+ #s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ #s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
end
View
9 lib/jekyll_and_hyde/generators.rb
@@ -2,12 +2,13 @@ module JekyllAndHyde
module Generators
autoload :New, 'jekyll_and_hyde/generators/new'
- class GroupTask < Thor::Group; end
+ class GroupTask < Thor::Group;
+ end
class << self
def invoke(task_name, *args)
task = find_task_by(task_name)
- task.invoke("jekyll_and_hyde:generators:#{task_name}", args) unless task.nil?
+ task.invoke(task_to_invoke(task_name), args) unless task.nil?
end
def find_task_by(task_name)
@@ -18,6 +19,10 @@ def find_task_by(task_name)
nil
end
end
+
+ def task_to_invoke(task_name)
+ "jekyll_and_hyde:generators:#{task_name}"
+ end
end
end
end
View
16 spec/jekyll_and_hyde/generators_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+
+module JekyllAndHyde
+ describe Generators do
+ describe "#invoke" do
+ it "should invoke the generator task with the given name" do
+ args = anything()
+ task = JekyllAndHyde::Generators::New.new
+ task.should_receive(:invoke).with("jekyll_and_hyde:generators:task_name", [args])
+ JekyllAndHyde::Generators.stub(:find_task_by).and_return(task)
+
+ JekyllAndHyde::Generators.invoke("task_name", args)
+ end
+ end
+ end
+end
View
1  spec/spec_helper.rb
@@ -0,0 +1 @@
+require 'jekyll_and_hyde'
Please sign in to comment.
Something went wrong with that request. Please try again.