daze wrote in post #969974: > I'm using Shoulda. > After copying the code here.... > .... > http://joshuaclayton.github.com/code/2009/07/14/should-act-as-list.html.... > into my test_helper file so I can test acts_as_list, I came across > issues. For one I realized I had to get rid of the _ between the > "should" and "have" in past cases, but here, I get this error when I > run my unit test: > > ./test/test_helper.rb:28:in `should_act_as_list': undefined method > `have_instance_methods' for ArticleTest:Class (NoMethodError) > > What's the Rails 3 way to test acts_as_list with Shoulda?
Well, that whole way of testing is wrongheaded and always was. You shouldn't be testing for implementation details like instance methods; rather, you should be testing for behavior. (Although I sometimes test for acts_as_list by making sure the appropriate module was included into the class.) Usually, if you're trying to poke into internals, something is wrong with your tests. The object being tested should generally be considered a black box. (BTW, consider RSpec instead of Shoulda. I believe even Shoulda's own developers have switched.) Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

