Sha256: d8c8682924851ea44073f974ca4ea37e5a6a2ab8afe584405462947653a795e2

Contents?: true

Size: 1.12 KB

Versions: 33

Compression:

Stored size: 1.12 KB

Contents

desc 'rspec [FILES]', 'Run RSpec'
long_desc <<-LONGDESC
Example: `geordi rspec spec/models/user_spec.rb:13`

Runs RSpec as you want: with RSpec 1/2 detection, `bundle exec`, rspec_spinner
detection, etc.
LONGDESC

def rspec(*files)
  if File.exists?('spec/spec_helper.rb')
    invoke_cmd 'bundle_install'

    announce 'Running specs'

    if file_containing?('Gemfile', /parallel_tests/) and files.empty?
      note 'All specs at once (using parallel_tests)'
      Util.system! 'bundle exec rake parallel:spec', :fail_message => 'Specs failed.'

    else
      # tell which specs will be run
      if files.empty?
        files << 'spec/'
        note 'All specs in spec/'
      else
        note 'Only: ' + files.join(', ')
      end

      command = ['bundle exec']
      # differentiate RSpec 1/2
      command << (File.exists?('script/spec') ? 'spec -c' : 'rspec')
      command << '-r rspec_spinner -f RspecSpinner::Bar' if file_containing?('Gemfile', /rspec_spinner/)
      command << files.join(' ')

      puts
      Util.system! command.join(' '), :fail_message => 'Specs failed.'
    end
  else
    note 'RSpec not employed.'
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
geordi-1.9.0 lib/geordi/commands/rspec.rb
geordi-1.8.0 lib/geordi/commands/rspec.rb
geordi-1.7.1 lib/geordi/commands/rspec.rb
geordi-1.7.0 lib/geordi/commands/rspec.rb
geordi-1.6.5 lib/geordi/commands/rspec.rb
geordi-1.6.4 lib/geordi/commands/rspec.rb
geordi-1.6.3 lib/geordi/commands/rspec.rb
geordi-1.6.2 lib/geordi/commands/rspec.rb
geordi-1.6.1 lib/geordi/commands/rspec.rb
geordi-1.6.0 lib/geordi/commands/rspec.rb
geordi-1.5.2 lib/geordi/commands/rspec.rb
geordi-1.5.1 lib/geordi/commands/rspec.rb
geordi-1.5.0 lib/geordi/commands/rspec.rb
geordi-1.4.3 lib/geordi/commands/rspec.rb
geordi-1.4.2 lib/geordi/commands/rspec.rb
geordi-1.4.1 lib/geordi/commands/rspec.rb
geordi-1.4.0 lib/geordi/commands/rspec.rb
geordi-1.3.2 lib/geordi/commands/rspec.rb
geordi-1.3.1 lib/geordi/commands/rspec.rb
geordi-1.3.0 lib/geordi/commands/rspec.rb