简体   繁体   English

Ruby on Rails迈克尔·哈特尔(turfary)。 测试失败9.3章

[英]Ruby on Rails Michael Hartl turorial. Failing test Chapter 9.3

When I run 当我跑步

bundle exec rspec spec/requests/user_pages_spec.rb -e "edit page"

Terminal returns: 终端退货:

sis-macbook-pro:sample_app Lagaspi$ bundle exec rspec spec/requests/user_pages_spec.rb -e "edit page"
/Users/Lagaspi/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load': /Users/Lagaspi/rails_projects/sample_app/spec/requests/user_pages_spec.rb:66: syntax error, unexpected $end, expecting keyword_end (SyntaxError)
from /Users/Lagaspi/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /Users/Lagaspi/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `map'
from /Users/Lagaspi/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /Users/Lagaspi/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/Lagaspi/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
from /Users/Lagaspi/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'

I really do not know how to tackle this problem, but here is my spec/requests/user_pages_spec.rb 我真的不知道该如何解决这个问题,但这是我的spec / requests / user_pages_spec.rb

require 'spec_helper'

describe "User pages" do

subject { page }

describe "profile page" do
let(:user) { FactoryGirl.create(:user) }
before { visit user_path(user) }

describe "signup" do
before { visit signup_path }

it { should have_selector('h1',    text: 'Sign up') }
it { should have_selector('title', text: full_title('Sign up')) }
end

it { should have_selector('h1',    text: user.name) }
it { should have_selector('title', text: user.name) }
end

describe "signup" do

before { visit signup_path }

let(:submit) { "Create my account" }

describe "with invalid information" do
it "should not create a user" do
expect { click_button submit }.not_to change(User, :count)
end
end

describe "with valid information" do
  before do
fill_in "Name",         with: "Example User"
fill_in "Email",        with: "user@example.com"
fill_in "Password",     with: "foobar"
fill_in "Confirmation", with: "foobar"
end

it "should create a user" do
  expect { click_button submit }.to change(User, :count).by(1)
end

 describe "after saving the user" do
before { click_button submit }
it { should have_link('Sign out') }
  end
describe "edit" do
let(:user) { FactoryGirl.create(:user) }
before { visit edit_user_path(user) }

describe "page" do
  it { should have_selector('h1',    text: "Update your profile") }
  it { should have_selector('title', text: "Edit user") }
  it { should have_link('change', href: 'http://gravatar.com/emails') }
end

describe "with invalid information" do
  before { click_button "Save changes" }

  it { should have_content('error') }
    end
  end
end

Thanks in advance 提前致谢

If this is the exact code then you're missing two more end at the bottom. 如果这是确切的代码,那么您将在底部缺少另外两个end Add that and try again. 添加该内容,然后重试。

I cut/pasted your code into vim and did auto-indent to find the culprit. 我将您的代码剪切/粘贴到了vim中,并自动缩进找到了罪魁祸首。

Update: 更新:

Plus, your original error says missing end . 另外,您的原始错误表示missing end The first one is on line 66 while the next error you listed here in the comments says line 67 . 第一个在line 66而您在注释中列出的下一个错误则在第line 67 These are exactly the lines where your end are missing. 这些正是您未找到end的那几行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM