【发布时间】:2012-06-09 10:05:42
【问题描述】:
由于某种原因,我的规范没有通过。 @categories 似乎没有达到规范。
这是控制器:
class CategoriesController < ApplicationController
def index
@categories = Category.all
end
end
还有我的规格:
require 'spec_helper'
describe CategoriesController do
describe "GET #index" do
category = FactoryGirl.create(:category)
subject { get :index }
it { @categories.should include category }
end
end
错误:
Failure/Error: @categories.should include category
NoMethodError:
undefined method `include?' for nil:NilClass
【问题讨论】:
-
实际错误是什么?
标签: ruby-on-rails ruby testing rspec controller