items_controller.rb

def new @item = current_user.items.build end 

problem with be_a_new (Item)

items_controller_spec.rb

 require 'rails_helper' RSpec.describe ItemsController, type: :controller do describe '#new' do let!(:user) { FactoryGirl.create(:user) } subject { response } before do session[:current_user_id] = user.token get :new end it { expect(assigns(:item).user).to be_a_new(Item) } it { is_expected.to have_http_status :ok } it { is_expected.to render_template('new') } end end 

log

http://pastebin.com/dm7eh2wJ

  • it { expect(assigns(:item).user).to be_a_new(Item) } are you checking that the .user of the Item class? - D-side
  • I wanted to check through the association, but now I realized that in some places I confused - Andrey Shostyk
  • So, all sorted out? Debugger, by the way, mastered? - D-side
  • @ D-side, I already figured out the test, I use pry, but when I write a band in tests, then when I try to deduce the meaning of let, an error appears, so I didn’t figure it out with debugging in teska - Andrei Shostik
  • @ Andrei Shostik how do you write a bandage in years? - Mal Skrylev

0