1

rails と emberjs アプリケーションでテストを実行しており、テストで :js => true を設定しています。仕様に binding.pry をドロップすると、REPL が正常に開きますが、アプリに binding.pry をドロップすると、コンソールに REPL が表示されますが、仕様は続行します。これは、ドライバーとしてポルターガイストを使用して、カピバラが 1 つのスレッドで仕様を実行し、別のスレッドでアプリケーションを実行するために発生すると私は信じています。アプリケーション コードで binding.pry を使用して REPL を開き、アプリと仕様の両方を一時停止できるように設定する方法はありますか?

以下は、問題なく動作する binding.pry ステートメントと取り残されるステートメントの例です。

作品:

employee_signs_in_spec.rb

require 'spec_helper'
feature 'Visitor signs in', :js => true do
  scenario 'Success' do
    visit '/sign_in'
    sign_in_as(FactoryGirl.create(:employee, confirmed_at: Time.now))
    binding.pry
    page.should have_content('Example Content')
  end
end

取り残される:

sessions_controller.rb

class SessionsController < Devise::SessionsController
  include Devise::Controllers::Helpers

  respond_to :json

  def create
    binding.pry
    # code for create action
  end
end
4

1 に答える 1