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.2.3 lib/geordi/commands/rspec.rb
geordi-1.2.2 lib/geordi/commands/rspec.rb
geordi-1.2.1 lib/geordi/commands/rspec.rb
geordi-1.2.0 lib/geordi/commands/rspec.rb
geordi-1.1.4 lib/geordi/commands/rspec.rb
geordi-1.1.3 lib/geordi/commands/rspec.rb
geordi-1.1.2 lib/geordi/commands/rspec.rb
geordi-1.1.1 lib/geordi/commands/rspec.rb
geordi-1.1.0 lib/geordi/commands/rspec.rb
geordi-1.0.3 lib/geordi/commands/rspec.rb
geordi-1.0.2 lib/geordi/commands/rspec.rb
geordi-1.0.1 lib/geordi/commands/rspec.rb
geordi-1.0.0 lib/geordi/commands/rspec.rb