0

私が走るとき

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

ターミナルが戻ります:

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'

私は本当にこの問題に取り組む方法を知りませんが、ここに私の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

前もって感謝します

4

1 に答える 1

1

これが正確なコードである場合end、下部にさらに 2 つのコードがありません。それを追加して、もう一度やり直してください。

あなたのコードを切り取ってvimに貼り付け、自動インデントを行って原因を見つけました。

アップデート:

さらに、元のエラーはmissing end. 最初のものはオンline 66ですが、コメントにここにリストした次のエラーはline 67. これらはまさにあなたendが欠けている行です。

于 2012-06-06T17:39:15.943 に答える