ruby on rails - Rspec controller testing for update of article does not work -



ruby on rails - Rspec controller testing for update of article does not work -

here controller_spec file portion of relevant code.....

login_user context 'update article valid attributes' 'update article'do article = article.create!(attributes_for(:article)) set :update, id:article.to_param, :article => attributes_for(:article, title: "title changed") article.reload expect(article.first.title).to eq("title changed") end end end

i getting error failure/error: expect(article.first.title).to eq("title changed")

expected: "title changed" got: "my first post" (compared using ==)

the controller code of update

# ..articlescontroller#update def update @article = article.find(params[:id]) if @article.update(article_params) redirect_to @article else render 'edit' end end

ruby-on-rails rspec

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -