Sha256: ab2502f0ffc288d77c90c4068735af255f4fa1051ba2a2d864de9463607fb90a

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8
require 'cliver'

describe Cliver::Detector do
  let(:detector) { Cliver::Detector.new(*args) }
  let(:defaults) do
    {
      :version_pattern => Cliver::Detector::DEFAULT_VERSION_PATTERN,
      :command_arg =>     Cliver::Detector::DEFAULT_COMMAND_ARG,
    }
  end
  let(:args) { [] }
  subject { detector }

  it { should respond_to :to_proc }

  its(:command_arg) { should eq defaults[:command_arg] }
  its(:version_pattern) { should eq defaults[:version_pattern] }

  context 'with one string argument' do
    let(:version_arg) { '--release-version' }
    let(:args) { [version_arg] }

    its(:command_arg) { should eq [version_arg] }
    its(:version_pattern) { should eq defaults[:version_pattern] }
  end

  context 'with one regexp argument' do
    let(:regexp_arg) { /.*/ }
    let(:args) { [regexp_arg] }

    its(:command_arg) { should eq defaults[:command_arg] }
    its(:version_pattern) { should eq regexp_arg }
  end

  context 'with both arguments' do
    let(:version_arg) { '--release-version' }
    let(:regexp_arg) { /.*/ }
    let(:args) { [version_arg, regexp_arg] }

    its(:command_arg) { should eq [version_arg] }
    its(:version_pattern) { should eq regexp_arg }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cliver-0.2.2 spec/cliver/detector_spec.rb
cliver-0.2.1 spec/cliver/detector_spec.rb
cliver-0.2.0 spec/cliver/detector_spec.rb