Sha256: 94629d0a5e06cc4b42c01172b9a51a4bf96506f70698f353e0f78fc531240a84

Contents?: true

Size: 1.39 KB

Versions: 5

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'
require 'tempfile'

describe Gondler::Gomfile do
  let(:gomfile) { described_class.new(path) }
  let(:file) do
    Tempfile.open('Gomfile').tap do|f|
      f.print(content)
      f.flush
    end
  end
  let(:path) { file.path }
  let(:content) { '' }
  after { file.close! }

  describe '#initialize' do
    let(:path) { 'Gomfile' }

    subject(:init) { described_class.new(path) }

    context 'without Gomfile' do
      let(:path) { '' }

      it 'raises Gondler::Gomfile::NotFound' do
        expect { init }.to raise_error(Gondler::Gomfile::NotFound)
      end
    end
  end

  describe '#gom' do
    let(:content) do
      <<-CONTENT
      gom 'github.com/golang/glog'
      CONTENT
    end

    it 'packages should include glog' do
      expect(gomfile.packages).to have(1).package
    end
  end

  describe '#group' do
    let(:content) do
      <<-CONTENT
      group :development, :test do
        gom 'github.com/golang/glog'
      end
      CONTENT
    end

    it 'package group should == development and test' do
      expect(gomfile.packages.first.group).to eq(%w(development test))
    end
  end

  describe '#os' do
    let(:content) do
      <<-CONTENT
      os :darwin, :linux do
        gom 'github.com/golang/glog'
      end
      CONTENT
    end

    it 'package os should == darwin and linux' do
      expect(gomfile.packages.first.os).to eq(%w(darwin linux))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gondler-0.1.3 spec/gondler/gomfile_spec.rb
gondler-0.1.2 spec/gondler/gomfile_spec.rb
gondler-0.1.1 spec/gondler/gomfile_spec.rb
gondler-0.1.0 spec/gondler/gomfile_spec.rb
gondler-0.0.3 spec/gondler/gomfile_spec.rb