Skip to content

Commit

Permalink
Fix from_mongo for existing recipes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed Mar 14, 2011
1 parent 448a331 commit 48b2db3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
8 changes: 2 additions & 6 deletions lib/rails_wizard/recipe.rb
Expand Up @@ -94,12 +94,8 @@ def self.to_mongo(value)
end

def self.from_mongo(key)
case key
when String
RailsWizard::Recipes[key]
when RailsWizard::Recipe
key
end
return key if key.respond_to?(:superclass) && key.superclass == RailsWizard::Recipe
RailsWizard::Recipes[key]
end

def self.get_binding
Expand Down
2 changes: 1 addition & 1 deletion recipes/hoptoad.rb
Expand Up @@ -24,7 +24,7 @@
- use_heroku:
type: boolean
prompt: "Use the Hoptoad Heroku addon?"

if_recipe: heroku
- api_key:
prompt: "Enter Hoptoad API Key:"
type: string
Expand Down
9 changes: 9 additions & 0 deletions spec/rails_wizard/template_spec.rb
@@ -1,6 +1,15 @@
require 'spec_helper'

describe RailsWizard::Template do
subject{ RailsWizard::Template }
let(:recipe){ RailsWizard::Recipe.generate('name','# test') }

describe '#initialize' do
it 'should work with classes' do
subject.new([recipe]).should == recipe
end
end

describe '#recipes_with_dependencies' do
def r(*deps)
mock(:Class, :requires => deps)
Expand Down
2 changes: 0 additions & 2 deletions spec/support/template_runner.rb
@@ -1,5 +1,3 @@
require 'file_utils'

class TemplateRunner
def initialize(template, config)
@template = template
Expand Down

0 comments on commit 48b2db3

Please sign in to comment.