我是新來編碼,並希望我遵循所有的規則相應發佈此問題。保護意外的tIdentifier錯誤
我正在經歷一個Ruby on Rails的介紹,在我的一個示例中,GUARD運行時我收到以下'Unexpect tIDENTIFIER'消息,我似乎無法找出原因。
ERROR["test_should_get_about", StaticPagesControllerTest, 0.012288]
test_should_get_about#StaticPagesControllerTest (0.01s)
SyntaxError: SyntaxError: /Users/NateFeder/_projectbox/rails-tutorial/sample_app/app/controllers/static_pages_controller.rb:12: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
About |Ruby on Rails Tutorial Sample App
^
ERROR["test_should_get_home", StaticPagesControllerTest, 0.004128]
test_should_get_home#StaticPagesControllerTest (0.00s)
SyntaxError: SyntaxError: /Users/NateFeder/_projectbox/rails-tutorial/sample_app/app/controllers/static_pages_controller.rb:12: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
About |Ruby on Rails Tutorial Sample App
ERROR["test_should_get_help", StaticPagesControllerTest, 0.008452]
test_should_get_help#StaticPagesControllerTest (0.01s)
SyntaxError: SyntaxError: /Users/NateFeder/_projectbox/rails-tutorial/sample_app/app/controllers/static_pages_controller.rb:12: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
About |Ruby on Rails Tutorial Sample App
我StaticPagesControllerTest低於:
require 'test_helper'
class StaticPagesControllerTest < ActionController::TestCase
test "should get home" do
get :home
assert_response :success
assert_select "title", 'Home | 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
感謝
謝謝閃光。我在發佈問題並修復問題後看到了這一點。儘管如此,我仍然繼續得到錯誤。 – Nate