2016-09-26 52 views
1

我有一個測試控制器的rspec的文件

當我在此單擊鼠標右鍵。 RSpec的文件,並選擇我的文件Run/Debug,它顯示在控制檯以下:

Fast Debugger (ruby-debug-ide 0.6.1.beta2, debase 0.2.2.beta8, file filtering is supported) listens on 0.0.0.0:64675 
Uncaught exception: /develop/warranty-web/bin/rspec:2: `$(' is not allowed as a global variable name 

Process finished with exit code 0 

我斌/ rspec的文件有bash腳本的兩條線:

#!/usr/bin/env bash 
exec $(dirname $0)/spring rspec "[email protected]" 

所以[R ubymine(或rspec?不確定)正在解釋bash腳本,就像它是ruby一樣。爲什麼它這樣做,我怎樣才能解決它,所以我可以調試文件?

- 編輯: -

如果有幫助,這裏是spec文件。

require 'spec_helper' 
require 'ruby-debug' 

describe Api::V1::Internal::SessionsController do 
    before do 
    @request.env['devise.mapping'] = Devise.mappings['api_v1_internal_user'] 
    end 

    context 'when invalid email' do 
    it 'returns a 401 (invalid credentials)' do 
     post :create, user: { email: '[email protected]', password: 'madeuppassword' } 
     expect(response.status).to eq(401) 
    end 
    end 
    context 'when valid email but invalid password' do 
    it 'returns a 401 (invalid credentials)' do 
     post :create, user: { email: '[email protected]', password: 'madeuppassword' } 
     expect(response.status).to eq(401) 
    end 
    end 
    context 'when valid email and password' do 
    it 'returns a 200 (ok)' do 
     post :create, user: { email: '[email protected]', password: 'metova' } 
     expect(response.status).to eq(200) 
    end 
    end 
end 

回答

0

對於任何人誰具有同樣的問題......我落得這樣做,我的一個朋友給我重新命名rspec的到rspec.rb所以它實際上只是運行紅寶石。然後將其內容更改爲:

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')