Sha256: c6bd5b2efd9794cbb7eed3bf88814147a19d18459152df387b6de2f6b3d89bdc

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

require "spec_helper"

describe VraptorScaffold::Runner::Scaffold do

  before(:all) do
    @help = VraptorScaffold::Runner::Help
    @runner_scaffold = VraptorScaffold::Runner::Scaffold
  end

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

  context "scaffold generator" do
    before(:each) do
      @generator = mock(ScaffoldGenerator)
      @args = ["product", "name:string", "value:double"]
    end

    it "should invoke all scaffold generator tasks" do
      File.stub!(:exist?).and_return(true)
      ScaffoldGenerator.stub!(:new).with(@args).and_return(@generator)
      @generator.should_receive(:invoke_all)
      @runner_scaffold.new.run(@args)
    end

    it "cannot invoke scaffold generator outsite root folder" do
      File.stub!(:exist?).and_return(false)
      ScaffoldGenerator.should_not_receive(:new)
      @runner_scaffold.new.run(@args)
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

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