Sha256: eff730215c2cddb7fb3ac3ed5698af9d5e7da4b90ca9acfc49d5fbd66b5aa13d
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
require "spec_helper" require "teaspoon/console" describe Guard::Teaspoon::Runner do before do Teaspoon::Console.stub(:new) end describe "#initialize" do it "assigns options" do options = {foo: "bar"} subject = Guard::Teaspoon::Runner.new(options) expect(subject.instance_variable_get(:@options)).to be(options) end it "aborts with a message on Teaspoon::EnvironmentNotFound" do Teaspoon::Console.should_receive(:new).and_raise(Teaspoon::EnvironmentNotFound) Guard::Teaspoon::Runner.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") Guard::Teaspoon::Runner.new end end describe "#run_all" do let(:console) { mock(execute: nil) } before do subject.console = console subject.instance_variable_set(:@options, {foo: "bar"}) end it "calls execute on console" do console.should_receive(:execute).with({foo: "bar", baz: "teaspoon"}) subject.run_all(baz: "teaspoon") end end describe "#run" do let(:console) { mock(execute: nil) } before do subject.console = console subject.instance_variable_set(:@options, {foo: "bar"}) end it "calls execute on console" do files = ["file1", "file2"] console.should_receive(:execute).with({foo: "bar", baz: "teaspoon"}, files) subject.run(files, baz: "teaspoon") end it "does nothing if there's no paths" do console.should_not_receive(:execute) subject.run([], baz: "teaspoon") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
guard-teaspoon-0.0.3 | spec/guard/teaspoon/runner_spec.rb |