NoMethodError:rspec 测试中未定义的方法"上下文"



系统: rails 3.2.3

1.9.2p320

乌班图 12.04 32 位

我正在尝试将我的 rspec 测试拆分为上下文,以便将通往配置文件页面的不同路由,但 rspec 不喜欢上下文。我是 Rails 和 Rspec 的新手,希望得到一些帮助。

宝石文件:

source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'mysql2'
gem 'will_paginate', '3.0.3'
gem 'composite_primary_keys'
gem "nifty-generators", :group => :development
# Gems used only for assets and not required
# in production environments by default.
group :assets do
 gem 'sass-rails',   '~> 3.2.3'
 gem 'coffee-rails', '~> 3.2.1'
 gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'devise'
gem "devise_openid_authenticatable"
gem 'savon'
# To use debugger
gem 'ruby-debug-base19'
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'ruby-debug-ide19'
group :development, :test do
 # Read our readme for detail on our test environment.
 gem 'rspec-rails'
 gem 'capybara'
 gem 'launchy'
 gem 'spork', '~> 0.9.0.rc'
 gem 'guard'
 gem 'guard-rspec'
 gem 'syntax'
 gem "mocha"
 gem 'factory_girl_rails'
 gem 'faker'
# Guard-spork doesn't work with windows but it's
# awesome for other Operating System's.
gem 'guard-spork'
# Gnome notifications
gem 'libnotify'
end

法典: 需要"spec_helper"

describe "qm profile page" do    
 it "shows personalized header text for the profile route" do    
  user = login_user
  context "when using profile route" do
   get path "/profile"
   assert_select("html:root>head>title", "#{user.username}'s Profile")
   assert_select("h1", "#{user.username}'s QM Profile")
   end
  user.destroy
 end
end

你不能在it块内有context

最新更新