Help us understand the problem. What is going on with this article?

SpringでRSpecを高速化する

More than 5 years have passed since last update.

1. Gemfileにspring-commands-rspecを追加する

gem 'spring-commands-rspec'

2. bin/rspecを作成する

spring-commands-rspecの場合

$ bundle exec spring binstub rspec

bin/rspec

#!/usr/bin/env ruby
begin
  load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require 'bundler/setup'
load Gem.bin_path('rspec-core', 'rspec')

注意:すでにbundleのbinstubsを使ってbin/rspecがある場合は、一度削除する

$ bundle binstubs rspec-core

binstubsで生成したbin/rspec

#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rspec-core', 'rspec')

このbin/rspecはspringが使われない

3. 測定

Springなし

実行

$ bundle exec spring status
Spring is not running.

出力結果

bundle exec rspec  3.83s user 0.94s system 97% cpu 4.887 total

Springあり

実行

$ time bundle exec bin/rspec

出力結果

bundle exec bin/rspec  0.53s user 0.10s system 45% cpu 1.379 total
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした