Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. require "rails_helper"
  2.  
  3. RSpec.describe StaticPagesController, type: :controller do
  4. describe "GET #home" do
  5. it "returns http success" do
  6. get :home
  7. expect(response).to have_http_status(:success)
  8. end
  9. it "should have the right title" do
  10. get :home
  11. assert_select "title", "Ruby on Rails Tutorial Sample App"
  12. end
  13. end
  14.  
  15. describe "GET #help" do
  16. it "returns http success" do
  17. get :help
  18. expect(response).to have_http_status(:success)
  19. end
  20. it "should have the right title" do
  21. get :help
  22. assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
  23. end
  24. end
  25.  
  26. describe "GET #about" do
  27. it "returns http success" do
  28. get :about
  29. expect(response).to have_http_status(:success)
  30. end
  31. it "should have the right title" do
  32. get "about"
  33. assert_select "title", "About | Ruby on Rails Tutorial Sample App"
  34. end
  35. end
  36. end
  37.  
  38. require 'test_helper'
  39.  
  40. class StaticPagesControllerTest < ActionController::TestCase
  41.  
  42. test "should get home" do
  43. get :home
  44. assert_response :success
  45. assert_select "title", "Ruby on Rails Tutorial Sample App"
  46. end
  47.  
  48. test "should get help" do
  49. get :help
  50. assert_response :success
  51. assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
  52. end
  53.  
  54. test "should get about" do
  55. get :about
  56. assert_response :success
  57. assert_select "title", "About | Ruby on Rails Tutorial Sample App"
  58. end
  59. end
  60.  
  61. StaticPagesController GET #home should have the right title
  62. Failure/Error: assert_select "title", "Ruby on Rails Tutorial Sample App"
  63.  
  64. NoMethodError:
  65. undefined method `document' for nil:NilClass
  66. # ./spec/controllers/static_pages_controller_spec.rb:11:in `block (3 levels)
  67. in <top (required)>'
  68.  
  69. require 'test_helper'
  70.  
  71. class UsersSignupTest < ActionDispatch::IntegrationTest
  72. get signup_path
  73. assert_no_difference 'User.count' do
  74. post users_path, user: { name: "",
  75. email: "user@invalid",
  76. password: "foo",
  77. password_confirmation: "bar" }
  78. end
  79. assert_template 'users/new'
  80. end
  81.  
  82. rake aborted!
  83. NameError: undefined local variable or method `signup_path' for UsersSignupTest:Class
  84. /Users/andela/Desktop/sample_app/test/integration/users_signup_test.rb:4:in `<class:UsersSignupTest>'
  85.  
  86. rake aborted!
  87. NoMethodError: undefined method `assert_no_difference' for UsersSignupTest:Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement