Sha256: 29604f85d983bd0a5447a980c0cc4c55c03b86f176eef53b257dbb8e249931ef

Contents?: true

Size: 1.67 KB

Versions: 23

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'
require 'sandbox'
require 'sniff/rake_tasks'

describe Sniff::RakeTasks do
  def git(cmd, dir = nil, &blk)
    full_cmd = ''
    full_cmd << "cd #{dir} && " if dir
    full_cmd << "unset GIT_DIR && unset GIT_INDEX_FILE && unset GIT_WORK_TREE && git #{cmd}"
    `#{full_cmd}`
  end

  let(:tasks) { Sniff::RakeTask.new }
  let(:emitter_path) { File.expand_path '../../../', File.dirname(__FILE__) }
  let(:rakefile) do
    rakefile = <<-RAKEFILE
require '#{emitter_path}/lib/sniff/rake_tasks'

Sniff::RakeTasks.define_tasks
    RAKEFILE
  end

  describe '#define' do
    describe 'docs task' do
      it 'should generate docs' do
        Sandbox.play do |path|
          flight_path = File.join(path, 'flight')
          git "clone git://github.com/brighterplanet/flight.git #{flight_path}"
          File.open(File.join(flight_path, 'Rakefile'), 'w') do |f|
            f.puts rakefile
          end

          `cd #{flight_path} && rake docs`
          Dir.entries(File.join(flight_path, 'docs')).
            count.should > 2
        end
      end
    end

    describe 'pages task' do
      it 'should commit any changed doc files' do
        Sandbox.play do |path|
          flight_path = File.join(path, 'flight')
          git "clone git://github.com/brighterplanet/flight.git #{flight_path}"
          File.open(File.join(flight_path, 'Rakefile'), 'w') do |f|
            f.puts rakefile
          end

          `cd #{flight_path} && mkdir docs && echo "<html>" > docs/foobar.html`
          `cd #{flight_path} && NO_PUSH=true rake pages`

          git('log -n 1', File.join(flight_path, 'docs')).
            should =~ /rebuild pages/
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
sniff-0.6.6 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.6.5 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.6.4 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.6.3 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.6.2 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.6.1 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.6.0 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.5.3 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.5.2 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.5.1 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.5.0 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.12 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.11 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.10 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.9 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.7 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.6 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.5 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.4 spec/lib/sniff/rake_tasks_spec.rb
sniff-0.4.3 spec/lib/sniff/rake_tasks_spec.rb