Sha256: e7cb879b99ad665e063238ae91f449ad53896f1f2469ab54f7551553a394b1ce
Contents?: true
Size: 1.46 KB
Versions: 9
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' describe Bueller::Generator::Application do before :each do # opts = {} # opts.stub!(:opts).and_return({}) # Bueller::Generator::Options.stub!(:new).and_return(opts) end context "when options indicate help usage" do let(:application) { App.run_application('-h') } it "should exit with code 1" do application.should == 1 end it 'should should puts option usage' do application App.stderr.should =~ /Usage:/ end it 'should not display anything on stdout' do application App.stdout.squeeze.strip.should == '' end end context "when options indicate an invalid argument" do let(:application) { App.run_application('--invalid-argument') } it "should exit with code 1" do application.should == 1 end it 'should display invalid argument' do application App.stderr.should =~ /--invalid-argument/ end it 'should display usage on stderr' do application App.stderr.should =~ /Usage:/ end it 'should not display anything on stdout' do App.stdout.squeeze.strip.should == '' end end context "when options are good" do let(:application) { App.run_application 'foo' } before :each do Bueller::Generator.stub!(:run) end it "should exit with code 1" do application.should == 0 end it "should run generator" do Bueller::Generator.should_receive :run application end end end
Version data entries
9 entries across 9 versions & 1 rubygems