Sha256: eeabf7f1ce7fbf44d48f5eb356b7902fe64223dce003d439eead0a1383080d21

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")

describe ScaffoldGenerator do
  
  before(:each) do
    args = ["product", "name:string", "value:double"]
    @generator = ScaffoldGenerator.new(args)
    
    @model_generator = mock(ModelGenerator)
    ModelGenerator.stub!(:new).with(@generator.model, @generator.attributes).and_return(@model_generator)
    
    @controller_generator = mock(ControllerGenerator)
    
    ControllerGenerator.stub!(:new).with(@generator.model, @generator.attributes).and_return(@controller_generator)
    @freemarker_generator = mock(FreemarkerGenerator)
    FreemarkerGenerator.stub!(:new).with(@generator.model, @generator.attributes).and_return(@freemarker_generator)
    
    @model_generator.stub!(:build)
    @controller_generator.stub!(:build)
    @freemarker_generator.stub!(:build)
  end
  
  context "build scaffold" do
    it "should call model generator" do
      @model_generator.should_receive(:build)
      @generator.build
    end
    
    it "should call controller generator" do
      @controller_generator.should_receive(:build)
      @generator.build
    end
    
   it "should call freemarker generator" do
      @freemarker_generator.should_receive(:build)
      @generator.build
    end
  end
end	

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vraptor-scaffold-0.0.1.beta2 spec/lib/generators/scaffold_generator/scaffold_generator_spec.rb