Ruby on rails 当前路径未定义方法或变量capybara

Ruby on rails 当前路径未定义方法或变量capybara,ruby-on-rails,testing,rspec,capybara,Ruby On Rails,Testing,Rspec,Capybara,这是我的请求/配置文件\u页面\u spec.rb: require 'spec_helper' describe "ProfilePages" do subject { page } describe "edit" do let(:user) { FactoryGirl.create(:user) } let(:profile) { FactoryGirl.create(:profile, user: user) } before do login user visit

这是我的
请求/配置文件\u页面\u spec.rb

require 'spec_helper'

describe "ProfilePages" do

subject { page }

describe "edit" do
   let(:user) { FactoryGirl.create(:user) }
let(:profile) { FactoryGirl.create(:profile, user: user) }

before do
  login user
  visit edit_profile_path(profile)
end

it { should have_selector('h2', text: 'Заполните информацию о себе') }

describe "change information" do
  let(:new_city)  { "Ulan-Bator" }
  let(:new_phone) { 1232442 }
  let(:new_gamelevel) { "M2" }
  let(:new_aboutme)   { "nfsfsdfds" }
  let(:submit) { "Сохранить" }
  before do
    fill_in "Город",             with: new_city
    fill_in "Телефон",           with: new_phone
    select new_gamelevel,        from: "Уровень игры"
    fill_in "О себе",            with: new_aboutme
    click_button submit
  end
  specify { profile.reload.city.should  == new_city }
  specify { profile.reload.phone.should == new_phone }
  specify { profile.reload.gamelevel.should == new_gamelevel }
  specify { profile.reload.aboutme.should == new_aboutme }
end

describe "submitting to the update action" do
  before  { put profile_path(profile) }
  current_path.should == user_path(user)
end
end
end
我有一个错误:

spec/requests/profile_pages_spec.rb:40:in block(3级)in:undefined局部变量或#的“current_path”方法(NameError)

为什么我不能用这个方法

我使用gem'capybara'、'1.1.2'和'
gem'rspec rails','2.11.0'

您不是在it块中工作

describe "submitting to the update action" do
  before  { put profile_path(profile) }
  it "redirects to show path" do
    current_path.should == user_path(user)
  end
end

是的,谢谢,我理解了,因为
subject{page}
btw,您也可以使用指定块