Sha256: f385415e33eb670d137f58f6c37031cdf1f38ea4e69c5a9b9b48dfc8184dbc80

Contents?: true

Size: 1.37 KB

Versions: 16

Compression:

Stored size: 1.37 KB

Contents

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

Runs RSpec with version 1/2 support, parallel_tests detection and `bundle exec`.

In order to limit processes in a parallel run, you can set an environment
variable like this: `PARALLEL_TEST_PROCESSORS=6 geordi rspec`
LONGDESC

def rspec(*files)
  if File.exist?('spec/spec_helper.rb')
    invoke_geordi 'bundle_install'
    invoke_geordi 'yarn_install'

    Interaction.announce 'Running specs'

    if Util.file_containing?('Gemfile', /parallel_tests/) && files.empty?
      Interaction.note 'All specs at once (using parallel_tests)'
      Util.run!([Util.binstub_or_fallback('rake'), 'parallel:spec'], fail_message: 'Specs failed.')

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

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

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
geordi-9.4.1 lib/geordi/commands/rspec.rb
geordi-9.4.0 lib/geordi/commands/rspec.rb
geordi-9.3.1 lib/geordi/commands/rspec.rb
geordi-9.3.0 lib/geordi/commands/rspec.rb
geordi-9.2.0 lib/geordi/commands/rspec.rb
geordi-9.1.0 lib/geordi/commands/rspec.rb
geordi-9.0.0 lib/geordi/commands/rspec.rb
geordi-8.0.0 lib/geordi/commands/rspec.rb
geordi-7.0.2 lib/geordi/commands/rspec.rb
geordi-7.0.1 lib/geordi/commands/rspec.rb
geordi-7.0.0 lib/geordi/commands/rspec.rb
geordi-6.1.0 lib/geordi/commands/rspec.rb
geordi-6.0.1 lib/geordi/commands/rspec.rb
geordi-6.0.0 lib/geordi/commands/rspec.rb
geordi-6.0.0.pre.rc1 lib/geordi/commands/rspec.rb
geordi-5.4.0 lib/geordi/commands/rspec.rb