rspec - Rails ActionController::UrlGenerationError -


i have basic rspec tests client model. , broke after assigned current_user. have problems figuring out what's wrong. looking help.

problem exist show, edit , delete actions

require 'spec_helper'  describe 'clientpage'   subject {page}   let(:user) {factorygirl.create(:user)}   let(:client) {user.clients.build(client_name: client_name, client_secondname: client_secondname,        budget: budget, project: project)}   let(:client_name) {'client'}   let(:client_secondname) {'first'}   let(:budget) {3000}   let(:project) {'project'}    before {sign_in(user)}   #==============================new page===========>>    describe 'new client page'      before {visit new_client_path}      {should have_title('new client')}      let(:submit) {"create"}      describe 'create'       context 'invalid creation'         'should not create client'           expect{click_button submit}.not_to change(client, :count)         end       end        context 'valid client creation'         before           fill_in 'client name',               with: client_name           fill_in 'client secondname',         with: client_secondname           fill_in 'budget',                    with: budget           fill_in 'project',                   with: project         end         'should create client'           expect{click_button submit}.to change(client, :count).by(1)         end       end     end     end    #==============================show page===========>>    describe 'show'     before {visit client_path(client)}     {should have_title("#{client.combine_names} profile")}   end    #==============================edit page===========>>    describe 'edit'     let(:reload_cn) {client_name*2}     let(:reload_csn) {client_secondname*2}     let(:reload_bgt) {client.budget*2}     let(:reload_prg) {client.project*2}      before {visit edit_client_path(client)}      {should have_title('edit client panel')}      context 'successfull edit'         before         fill_in 'client name',              with: reload_cn         fill_in 'client secondname',        with: reload_csn         fill_in 'budget',                   with: reload_bgt         fill_in 'project',                  with: reload_prg         click_button('save')       end       {should have_content(reload_cn)}       {should have_content(reload_csn)}       {should have_content(reload_bgt)}       {should have_content(reload_prg)}     end   end    #==============================delete action===========>>      describe 'delete'         before             @client = user.clients.build(client_name: client_name, client_secondname: client_secondname, budget: budget, project: project)             visit root_path         end          'should delete client'             expect{@client.delete}.to change(client, :count).by(-1)         end     end end 

solved. i've missed 1 thing - build not save database example won't have id. create or factorygirl hepls.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -