Sha256: 00ede07d8bd313f9a00a85067d5d31cf85ab361180179925d6e920e84289ed86
Contents?: true
Size: 1.63 KB
Versions: 5
Compression:
Stored size: 1.63 KB
Contents
require "spec_helper" require "teaspoon/command_line" require "teaspoon/console" describe Teaspoon::CommandLine do describe "#initialize" do let(:console) { double(execute: false) } let(:parser) { double(parse!: ["file1", "file2"]) } before do Teaspoon::CommandLine.any_instance.stub(:abort) Teaspoon::Console.stub(:new).and_return(console) Teaspoon::CommandLine.any_instance.stub(:opt_parser).and_return(parser) end it "assigns @options" do instance = Teaspoon::CommandLine.new expect(instance.instance_variable_get(:@options)).to eq({}) end it "assigns @files" do instance = Teaspoon::CommandLine.new expect(instance.instance_variable_get(:@files)).to eq(["file1", "file2"]) end it "aborts with a message on Teaspoon::EnvironmentNotFound" do Teaspoon::Console.should_receive(:new).and_raise(Teaspoon::EnvironmentNotFound) Teaspoon::CommandLine.any_instance.should_receive(:abort) STDOUT.should_receive(:print).with("Unable to load Teaspoon environment in {spec/teaspoon_env.rb, test/teaspoon_env.rb, teaspoon_env.rb}.\n") STDOUT.should_receive(:print).with("Consider using -r path/to/teaspoon_env\n") Teaspoon::CommandLine.new end it "executes using Teaspoon::Console" do Teaspoon::Console.should_receive(:new).with({}, ["file1", "file2"]) console.should_receive(:execute) Teaspoon::CommandLine.new end it "aborts if Teaspoon::Console fails" do Teaspoon::CommandLine.any_instance.should_receive(:abort) console.should_receive(:execute).and_return(true) Teaspoon::CommandLine.new end end end
Version data entries
5 entries across 5 versions & 1 rubygems