Sha256: aa0e81172f1b4d56dec2cf86d8c42370c360ce6054935bd9a08920bc032066bc

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

require "spec_helper"

describe VraptorScaffold::Execution do

  before(:each) do
    @execution = VraptorScaffold::Execution.new
  end

  context "discover runner for action" do
    it "should be commands help when no action" do
      @execution.runner_for(nil).should == VraptorScaffold::Runner::CommandsHelp
    end

    it "should be app generator when -h action" do
      @execution.runner_for("-h").should == VraptorScaffold::Runner::Generator
    end

    it "should be app generator when --help action" do
      @execution.runner_for("--help").should == VraptorScaffold::Runner::Generator
    end

    it "should be app generator when new action" do
      @execution.runner_for("new").should == VraptorScaffold::Runner::Generator
    end

    it "should be app generator when scaffold action" do
      @execution.runner_for("scaffold").should == VraptorScaffold::Runner::Scaffold
    end

    it "should be plugin generator when plugin action" do
      @execution.runner_for("plugin").should == VraptorScaffold::Runner::Plugin
    end

    it "should be start application when start action" do
      @execution.runner_for("start").should == VraptorScaffold::Runner::Start
    end

    it "should be commands help when scaffold when unknown action" do
      @execution.runner_for("xpto").should == VraptorScaffold::Runner::CommandsHelp
    end
  end

  it "should discover runner and run" do
    runner = mock(VraptorScaffold::Runner::Generator)
    runner.stub!(:new).and_return runner
    runner.should_receive(:run).with(['app'])
    @execution.stub!(:runner_for).with('new').and_return(runner)
    @execution.run(['new', 'app'])
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
heroku-vraptor-scaffold-0.9.0 spec/vraptor-scaffold/execution_spec.rb
vraptor-scaffold-1.3.0 spec/vraptor-scaffold/execution_spec.rb
vraptor-scaffold-1.3.0.rc spec/vraptor-scaffold/execution_spec.rb