Sha256: 425ce0f03b18ebea535708ef902ad95faa6103e07f83458daa2ba41a6a0a46b2

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require "spec_helper"

describe VraptorScaffold::Runner::Generator do

  before(:all) do
    @help = VraptorScaffold::Runner::Help
    @generator_runner =  VraptorScaffold::Runner::Generator
  end

  it "should print help command" do
    @help.stub!(:help).with("--help").and_return true
    AppGenerator.should_receive(:start).with(["-h"])
    @generator_runner.new.run(["--help"])
  end

  context "default app generator" do
    before(:each) do
      @generator = mock(AppGenerator)
      project_name = "vraptor-scaffold"
      option = "--package=br.com.caelum"
      @args = [project_name, option]
      AppGenerator.stub!(:new).with(project_name, [option]).and_return(@generator)
    end

    it "should invoke all app generator tasks when typed new" do
      @help.stub!(:help).and_return false
      @generator.should_receive(:invoke_all)
      @generator_runner.new.run(@args)
    end
  end

  context "gae app generator" do
    before(:each) do
      @generator = mock(GaeAppGenerator)
      project_name = "gae-project"
      option = "--gae"
      @args = [project_name, option]
      GaeAppGenerator.stub!(:new).with(project_name, [option]).and_return(@generator)
    end

    it "should invoke all app generator tasks when typed new" do
      @help.stub!(:help).and_return false
      @generator.should_receive(:invoke_all)
      @generator_runner.new.run(@args)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vraptor-scaffold-1.3.0 spec/vraptor-scaffold/runner/generator_spec.rb