Sha256: 0cc0be55885170507516645daa078cb8591bd3f8626dbb09f7f5b515127f0555

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'
require 'semantic_puppet/dependency/unsatisfiable_graph'

describe SemanticPuppet::Dependency::UnsatisfiableGraph do

  let(:modules) { %w[ foo bar baz ] }
  let(:graph) { double('Graph', :modules => modules) }
  let(:instance) { described_class.new(graph) }

  subject { instance }

  describe '#message' do
    subject { instance.message }

    it { should match /#{instance.send(:sentence_from_list, modules)}/ }
  end

  describe '#sentence_from_list' do

    subject { instance.send(:sentence_from_list, modules) }

    context 'with a list of one item' do
      let(:modules) { %w[ foo ] }
      it { should eql 'foo' }
    end

    context 'with a list of two items' do
      let(:modules) { %w[ foo bar ] }
      it { should eql 'foo and bar' }
    end

    context 'with a list of three items' do
      let(:modules) { %w[ foo bar baz ] }
      it { should eql 'foo, bar, and baz' }
    end

    context 'with a list of more than three items' do
      let(:modules) { %w[ foo bar baz quux ] }
      it { should eql 'foo, bar, baz, and quux' }
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
semantic_puppet-1.0.2 spec/unit/semantic_puppet/dependency/unsatisfiable_graph_spec.rb
semantic_puppet-1.0.1 spec/unit/semantic_puppet/dependency/unsatisfiable_graph_spec.rb
semantic_puppet-1.0.0 spec/unit/semantic_puppet/dependency/unsatisfiable_graph_spec.rb
semantic_puppet-0.1.4 spec/unit/semantic_puppet/dependency/unsatisfiable_graph_spec.rb
semantic_puppet-0.1.3 spec/unit/semantic_puppet/dependency/unsatisfiable_graph_spec.rb
semantic_puppet-0.1.2 spec/unit/semantic_puppet/dependency/unsatisfiable_graph_spec.rb
semantic_puppet-0.1.1 spec/unit/semantic_puppet/dependency/unsatisfiable_graph_spec.rb
semantic_puppet-0.1.0 spec/unit/semantic_puppet/dependency/unsatisfiable_graph_spec.rb