Skip to content

Commit

Permalink
Add post_bundler method to clean up recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
kfaustino committed Jan 29, 2011
1 parent 5d37610 commit 16a6f10
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
7 changes: 5 additions & 2 deletions lib/rails_templater/templater.rb
@@ -1,8 +1,7 @@
module RailsTemplater
class Templater

attr_accessor :post_bundler_strategies
attr_reader :template_options
attr_reader :post_bundler_strategies, :template_options

def initialize
@post_bundler_strategies = []
Expand All @@ -18,6 +17,10 @@ def orm
@orm ||= Orm.new
end

def post_bundler(&block)
@post_bundler_strategies << block
end

def recipe(name)
File.expand_path("recipes/#{name}.rb", @template_framework_path)
end
Expand Down
19 changes: 16 additions & 3 deletions spec/rails_templater/templater_spec.rb
Expand Up @@ -21,7 +21,7 @@
end

describe "#load_snippet" do

let(:snippet_name) { 'sample_snippet' }

before(:each) do
Expand All @@ -33,9 +33,9 @@
end

end

describe "#load_template" do

let(:template_name) { 'sample_template.rb' }

before(:each) do
Expand All @@ -48,4 +48,17 @@

end

describe "#post_bundler" do

it "adds blocks to post_bundler_strategies" do
subject.post_bundler do
"Hi"
end
subject.post_bundler_strategies.should have(1).item
result = subject.post_bundler_strategies.first.call
result.should == 'Hi'
end

end

end

0 comments on commit 16a6f10

Please sign in to comment.