ruby on rails - functional test: NomethodError -
I am starting Rails on Rails (and English :)), and I try to use functional testing I'm doing, but test_should_get_new (MicropostControllerTest) NoMethodError: 'microposts' the undefined method for zero: NilClass
I fist my micropost_controller_test.rb
1) There was an error in the error requires the 'test_helper' class MicropostControllerTest & lt; ActionController :: testcase test should get "new" tax: new assert_response: success end end
my micropost_controller.rb
class micropostController & lt; (: Content = & gt; parameter [: content]) ApplicationController def new @post = Micropost.new @posts = current_user.microposts.all end DEF @post = current_user.microposts.create create logger.debug "new post: # { @ Post.attributes.inspect} "logger.debug" post should be valid: #{@post.valid} "If @post redirect_to micropost_new_path any other end end end
In tried Microposts.yml but it did not work So, where can I find a microprot method for functional testing and how can I fix it? Please help me
P / S: my application is still local host
If you are using Devise for user authentication, then you have to do your work
Comments
Post a Comment