Sha256: 35e6e71243ee9ae4b23a8223b1c38256078ea7d9743e70037cfcd190c4fb2712

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

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

describe VraptorScaffold::Main do
  
  context "new application" do
    before(:each) do
      @project_name = "vraptor-scaffold"
      @generator = mock(AppGenerator)
      AppGenerator.stub!(:new).and_return(@generator)
      @args = ["new", @project_name]
    end 
    
    it "should call app generator when typed new" do
      @generator.should_receive(:build).with(@project_name)
      VraptorScaffold::Main.execute(@args)
    end
    
    it "cannot call app generator when not typed new" do
      @args.shift
      @generator.should_not_receive(:build)
      VraptorScaffold::Main.execute(@args)
    end
  end
  
  context "scaffold" do
    before(:each) do
      @generator = mock(ScaffoldGenerator)
      @args = ["scaffold", "product", "name:string", "value:doulbe"]
      ScaffoldGenerator.stub!(:new).with(@args).and_return(@generator)
    end
    
    it "should call scaffold generator" do
      @generator.should_receive(:build)
      VraptorScaffold::Main.execute(@args)
    end
  end
  
  context "web server" do
    it "should start server when typed start" do
      VraptorScaffold::Main.should_receive(:exec).with("mvn compile war:inplace jetty:run")
      VraptorScaffold::Main.execute(["start"])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vraptor-scaffold-0.0.1.rc spec/lib/vraptor-scaffold_spec.rb
vraptor-scaffold-0.0.1.beta5 spec/lib/vraptor-scaffold_spec.rb
vraptor-scaffold-0.0.1.beta4 spec/lib/vraptor-scaffold_spec.rb
vraptor-scaffold-0.0.1.beta3 spec/lib/vraptor-scaffold_spec.rb