Sha256: 206e12625a9f012c60093fc59c226accc230d3094a2a89e4e76c5ed396c29d52

Contents?: true

Size: 1.34 KB

Versions: 19

Compression:

Stored size: 1.34 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'taskwarrior-web/services/builder'

RSpec::Mocks::setup(TaskwarriorWeb::Config)

describe TaskwarriorWeb::CommandBuilder do
  describe '.included' do
    context 'when v2 is reported' do
      it 'should include CommandBuilder V2 module' do
        TaskwarriorWeb::Config.should_receive(:version).and_return(Versionomy.parse('2.0.0'))
        TestCommandClass.class_eval { include TaskwarriorWeb::CommandBuilder }
        TestCommandClass.should include(TaskwarriorWeb::CommandBuilder::V2)
      end
    end

    context 'when v1 is reported' do
      it 'should include CommandBuilder V1 module' do
        TaskwarriorWeb::Config.should_receive(:version).and_return(Versionomy.parse('1.0.0'))
        TestCommandClass.class_eval { include TaskwarriorWeb::CommandBuilder }
        TestCommandClass.should include(TaskwarriorWeb::CommandBuilder::V1)
      end
    end

    context 'when an invalid version number is reported' do
      it 'should throw an UnrecognizedTaskVersion exception' do
        TaskwarriorWeb::Config.should_receive(:version).and_return(Versionomy.parse('9.0.0'))
        expect { 
          TestCommandClass.class_eval { include TaskwarriorWeb::CommandBuilder }
        }.to raise_exception(TaskwarriorWeb::UnrecognizedTaskVersion)
      end
    end
  end
end

class TestCommandClass; end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
taskwarrior-web-1.1.12 spec/services/builder_spec.rb
taskwarrior-web-1.1.11 spec/services/builder_spec.rb
taskwarrior-web-1.1.10 spec/services/builder_spec.rb
taskwarrior-web-1.1.9 spec/services/builder_spec.rb
taskwarrior-web-1.1.8 spec/services/builder_spec.rb
taskwarrior-web-1.1.7 spec/services/builder_spec.rb
taskwarrior-web-1.1.6 spec/services/builder_spec.rb
taskwarrior-web-1.1.5 spec/services/builder_spec.rb
taskwarrior-web-1.1.4 spec/services/builder_spec.rb
taskwarrior-web-1.1.3 spec/services/builder_spec.rb
taskwarrior-web-1.1.2 spec/services/builder_spec.rb
taskwarrior-web-1.1.1 spec/services/builder_spec.rb
taskwarrior-web-1.1.0 spec/services/builder_spec.rb
taskwarrior-web-1.0.14 spec/services/builder_spec.rb
taskwarrior-web-1.0.13 spec/services/builder_spec.rb
taskwarrior-web-1.0.12 spec/services/builder_spec.rb
taskwarrior-web-1.0.11 spec/services/builder_spec.rb
taskwarrior-web-1.0.10 spec/services/builder_spec.rb
taskwarrior-web-1.0.9 spec/services/builder_spec.rb