Sha256: b4518c8b0b30df6927a60cf6c02c482c401a284df0049770d061fbf79360f9c9

Contents?: true

Size: 1.23 KB

Versions: 15

Compression:

Stored size: 1.23 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'
    invoke_cmd 'yarn_install'

    announce 'Running specs'

    if Util.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']
      command << if File.exists?('script/spec')
        'spec -c' # RSpec 1
      elsif File.exists?('bin/rspec')
        'bin/rspec'
      else
        'rspec'
      end
      command << '-r rspec_spinner -f RspecSpinner::Bar' if Util.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

15 entries across 15 versions & 1 rubygems

Version Path
geordi-2.12.3 lib/geordi/commands/rspec.rb
geordi-2.12.2 lib/geordi/commands/rspec.rb
geordi-2.12.1 lib/geordi/commands/rspec.rb
geordi-2.12.0 lib/geordi/commands/rspec.rb
geordi-2.11.0 lib/geordi/commands/rspec.rb
geordi-2.10.1 lib/geordi/commands/rspec.rb
geordi-2.10.0 lib/geordi/commands/rspec.rb
geordi-2.9.0 lib/geordi/commands/rspec.rb
geordi-2.8.0 lib/geordi/commands/rspec.rb
geordi-2.7.0 lib/geordi/commands/rspec.rb
geordi-2.6.0 lib/geordi/commands/rspec.rb
geordi-2.5.0 lib/geordi/commands/rspec.rb
geordi-2.4.0 lib/geordi/commands/rspec.rb
geordi-2.3.0 lib/geordi/commands/rspec.rb
geordi-2.2.0 lib/geordi/commands/rspec.rb