Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • C chouette-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 36
    • Merge requests 36
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Administrator
  • chouette-core
  • Merge requests
  • !20

Merged
Created May 31, 2017 by Administrator@rootMaintainer

Add 'spring-commands-rspec'

  • Overview 0
  • Commits 1
  • Changes 2

Created by: teddywing

This gem allows RSpec to be used with the Spring preloader, eliminating the Rails startup time when running tests. Was getting really annoyed at the 10-second startup times every time I wanted to run any tests.

Here's a sample comparison running a single test file:

Before:

rspec spec/models/chouette/vehicle_journey_at_stops_day_offset_spec.rb
Run options:
  include {:wip=>true}
  exclude {:js=>true, :meta=>true}

All examples were filtered out; ignoring {:wip=>true}
...

Finished in 2.01 seconds (files took 9.41 seconds to load)
3 examples, 0 failures

---

After:

spring rspec spec/models/chouette/vehicle_journey_at_stops_day_offset_spec.rb
Running via Spring preloader in process 45340
Run options:
  include {:wip=>true}
  exclude {:js=>true, :meta=>true}

All examples were filtered out; ignoring {:wip=>true}
...

Finished in 2 seconds (files took 0.76843 seconds to load)
3 examples, 0 failures

When doing TDD this is a huge workflow improvement.

Since the /bin/ directory is ignored by .gitignore, you'll have to generate the binstub manually to get this working:

$ bundle exec spring binstub rspec
$ git checkout bin/spring  # since this file is in the repo but is
$                          # also in .gitignore so shouldn't be
$                          # committed.
$ bundle exec spring rspec  # enjoy!

To use with rspec.vim, add this to your Vim config:

let g:rspec_command = "!bundle exec spring rspec {spec}"
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: add-spring-commands-rspec--rb201705311828