Sha256: 4825cdb4ccf1c0b06a687d2290ac7f2e9177782345a0f5e754847b1ea5e0c956

Contents?: true

Size: 1.72 KB

Versions: 2

Compression:

Stored size: 1.72 KB

Contents

describe 'straptible gem' do
  before :all do
    rel_tmp = '../../tmp/spec'
    @tmpdir = File.expand_path(rel_tmp, File.dirname(__FILE__))
    FileUtils.mkdir_p @tmpdir
    FileUtils.rm_rf File.join(@tmpdir, 'foobar')

    rel_straptible = '../../bin/straptible'
    @straptible = File.expand_path(rel_straptible, File.dirname(__FILE__))
  end

  context 'with a simple gem name' do
    before :all do
      `#{@straptible} gem #{File.join(@tmpdir, 'foobar')}`
    end

    after :all do
      FileUtils.rm_r File.join(@tmpdir, 'foobar')
    end

    it 'includes an appropriate README.md' do
      readme = File.join(@tmpdir, 'foobar', 'README.md')
      expect(File.exist?(readme)).to eq true
      expect(File.read(readme)).to match(/\#.*icon-60px.png.*Foobar/)
    end
  end

  context 'with a complex gem name' do
    before :all do
      `#{@straptible} gem #{File.join(@tmpdir, 'foobar/foo_bar-baz')}`
    end

    after :all do
      FileUtils.rm_r File.join(@tmpdir, 'foobar')
    end

    it 'includes an appropriate gemspec' do
      gemdir = File.join(@tmpdir, 'foobar', 'foo_bar-baz')
      gemspec = File.join(gemdir, 'foo_bar-baz.gemspec')
      expect(File.exist?(gemspec)).to eq true
      expect(File.read(gemspec)).to match(/FooBar::Baz/)
    end
  end

  context 'executing bundle install' do
    before :all do
      # TODO: Figure out how to do this offline
      `#{@straptible} gem #{File.join(@tmpdir, 'foobar')}`
      `cd #{File.join(@tmpdir, 'foobar')} && bundle install`
    end

    after :all do
      FileUtils.rm_rf File.join(@tmpdir, 'foobar')
    end

    it 'passes Rubocop muster' do
      `cd #{File.join(@tmpdir, 'foobar')} && bundle exec rake rubocop`
      expect($CHILD_STATUS.exitstatus).to eq 0
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
straptible-0.2.4 spec/integration/gem_spec.rb
straptible-0.2.3 spec/integration/gem_spec.rb