我测试方法last_photo: def last_photo
@last_photo ||= user_updates.latest.where("photo_front IS NOT NULL and photo_front != ''").first.try(:photo_front)
end
规格: context "instance method" do
let
我在做什么错? Failures: 1) AccountsController POST :create an account that already exists renders the :new template Failure/Error: expect(response).to render_template(:new) expecting <"new"> but rendering w
我想使用around hook来使用临时目录运行我的规范,并在之后清理临时目录。 describe FileManipulatingClass do
around(:each) do |example|
Dir.mktmpdir do |dir|
example.run
end
end
subject { described_cla
我试图设置控制器测试以确认我的一个实例变量(@template)接收到给定函数调用(deliver)。 用下面的代码,但是,assigns获取posts之前评估,所以assigns是nil: it 'calls @template.deliver' do
assigns(:template).should_receive(:deliver).and_call_original