Sha256: 0149727fad50229e05fa7088a0d5b2fd7dd1e9c26822cc3921ca0b4897f0ee2c

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 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 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 & 1 rubygems

Version Path
vraptor-scaffold-1.2.3 spec/vraptor-scaffold/execution_spec.rb
vraptor-scaffold-1.2.1 spec/vraptor-scaffold/execution_spec.rb
vraptor-scaffold-1.2.0 spec/vraptor-scaffold/execution_spec.rb