Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "rails_helper"
- RSpec.describe StaticPagesController, type: :controller do
- describe "GET #home" do
- it "returns http success" do
- get :home
- expect(response).to have_http_status(:success)
- end
- it "should have the right title" do
- get :home
- assert_select "title", "Ruby on Rails Tutorial Sample App"
- end
- end
- describe "GET #help" do
- it "returns http success" do
- get :help
- expect(response).to have_http_status(:success)
- end
- it "should have the right title" do
- get :help
- assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
- end
- end
- describe "GET #about" do
- it "returns http success" do
- get :about
- expect(response).to have_http_status(:success)
- end
- it "should have the right title" do
- get "about"
- assert_select "title", "About | Ruby on Rails Tutorial Sample App"
- end
- end
- end
- require 'test_helper'
- class StaticPagesControllerTest < ActionController::TestCase
- test "should get home" do
- get :home
- assert_response :success
- assert_select "title", "Ruby on Rails Tutorial Sample App"
- end
- test "should get help" do
- get :help
- assert_response :success
- assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
- end
- test "should get about" do
- get :about
- assert_response :success
- assert_select "title", "About | Ruby on Rails Tutorial Sample App"
- end
- end
- StaticPagesController GET #home should have the right title
- Failure/Error: assert_select "title", "Ruby on Rails Tutorial Sample App"
- NoMethodError:
- undefined method `document' for nil:NilClass
- # ./spec/controllers/static_pages_controller_spec.rb:11:in `block (3 levels)
- in <top (required)>'
- require 'test_helper'
- class UsersSignupTest < ActionDispatch::IntegrationTest
- get signup_path
- assert_no_difference 'User.count' do
- post users_path, user: { name: "",
- email: "user@invalid",
- password: "foo",
- password_confirmation: "bar" }
- end
- assert_template 'users/new'
- end
- rake aborted!
- NameError: undefined local variable or method `signup_path' for UsersSignupTest:Class
- /Users/andela/Desktop/sample_app/test/integration/users_signup_test.rb:4:in `<class:UsersSignupTest>'
- rake aborted!
- NoMethodError: undefined method `assert_no_difference' for UsersSignupTest:Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement