Sha256: e1a6d078168c41fd7969ddcd961933740f56c2da8be76d70c9e000201a97046d
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' require 'taskwarrior-web/services/runner' describe TaskwarriorWeb::Runner do before do TestCommandClass.class_eval do |class_name| include TaskwarriorWeb::Runner end @object = TestCommandClass.new end describe 'include' do it 'should make the class respond to the run command' do @object.should respond_to(:run) end it 'should add a TASK_VERSION constant' do @object.class.const_defined?(:TASK_BIN).should be_true end end describe '#run' do before do @object.should_receive(:`).and_return('{"new_thing" => "old_thing"}') end context 'when the command has not been built' do it 'should build the command' do @object.should_receive(:build).and_return('build command') @object.run end end context 'when the command has been built' do it 'should not build the command' do @object.instance_variable_set(:@built, 'command set manually') @object.should_not_receive(:build) @object.run end end it 'should return the stdout' do @object.should_receive(:build).and_return('build command') @object.run.should eq('{"new_thing" => "old_thing"}') end end end class TestCommandClass; end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
taskwarrior-web-1.1.2 | spec/services/runner_spec.rb |
taskwarrior-web-1.1.1 | spec/services/runner_spec.rb |
taskwarrior-web-1.1.0 | spec/services/runner_spec.rb |