匹配的行我已經寫了一組23個測試我的用戶模型和所有的人都用下面的錯誤而失敗:Rspec的錯誤不能找到回溯
Failure/Error: Unable to find matching line from backtrace
ArgumentError:
block not supplied
我曾嘗試與不同版本的水豚的梅辛,rspec-rails和咆哮,但是說實話,我真的不知道我在這裏做什麼,也不太瞭解錯誤。任何能夠指引我走向正確的人的幫助,我都會很感激。
這裏有一個例子從我user_spec.rb
文件
require 'spec_helper'
describe User do
before @user = User.new(name: 'example', password: 'foobar', password_confirmation: 'foobar',
email: '[email protected]', description: 'Lorem ipsum dolor...')
subject { @user }
it { should respond_to(:name) }
it { should respond_to(:email) }
it { should respond_to(:password) }
it { should respond_to(:password_confirmation) }
it { should respond_to(:password_digest) }
it { should respond_to(:description) }
it { should respond_to(:admin) }
it { should respond_to(:remember_token) }
describe "when name is not present" do
before { @user.name = " " }
it { should_not be_valid }
end
.
.
.
end
這裏是我的Gemfile
的相關部分:
group :development do
gem 'rspec-rails', '2.11.0'
gem 'guard'
gem 'guard-spork', :github => 'guard/guard-spork'
gem 'guard-rspec'
gem 'spork'
gem 'sqlite3'
end
group :test do
gem 'capybara', '1.1.2'
gem 'rb-fsevent', '0.9.1', :require => false
gem 'growl', '1.0.3'
gem 'factory_girl_rails', '4.1.0'
end
感謝您的閱讀!
非常感謝!那個愚蠢的小語法錯誤讓我發瘋。 – mattmattmatt