Guest User

Untitled

a guest
Apr 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. context "creating a new tweet" do
  2. setup do
  3. login_as :sonnyjitsu
  4. post :create, :tweet => {:tweet => "This is my tweet"}
  5. end
  6.  
  7. current_user = mock('user')
  8.  
  9. should_change("the number of tweets", :from => 0, :to => 1) { Tweet.count }
  10. should_redirect_to("the tweet page") {tweet_path(Tweet.last)}
  11. end
  12.  
  13. The error is this:
  14.  
  15. sonnyjitsu@ubuntuboy:~/Development/barter140$ rake
  16. (in /home/sonnyjitsu/Development/barter140)
  17. /usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/helpers/tweets_helper_test.rb" "test/unit/tweet_test.rb"
  18. Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
  19. Started
  20.  
  21. Finished in 0.000353 seconds.
  22.  
  23. 0 tests, 0 assertions, 0 failures, 0 errors
  24. /usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/functional/tweets_controller_test.rb"
  25. /usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:398:in `send': undefined method `mock' for TweetsControllerTest:Class (NoMethodError)
  26. from /usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:398:in `method_missing'
  27. from ./test/functional/tweets_controller_test.rb:43:in `__bind_1258776323_452708'
  28. from /usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:293:in `call'
  29. from /usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:293:in `merge_block'
  30. from /usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:288:in `initialize'
  31. from /usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:169:in `new'
  32. from /usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:169:in `context'
  33. from ./test/functional/tweets_controller_test.rb:37
  34. from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
  35. from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
  36. from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
  37. from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
  38. /usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
  39. Errors running test:functionals!
  40.  
  41.  
  42. mocha (0.9.8)
  43. thoughtbot-shoulda (2.10.2)
  44. rails 2.3.4
  45.  
  46.  
  47.  
  48. ===SOLUTION===
  49. Should run any non-shoulda code (such as mocks and stubs) in the setup block
Add Comment
Please, Sign In to add comment