系统:rails 3.2.3
1.9.2p320
ubuntu 12.04 32位
我正在尝试将我的rspec测试分解为到配置文件页面的不同路由的上下文,但是rspec不喜欢上下文。我是Rails和Rspec的新手,非常感谢你的帮助。
的Gemfile:
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
答案 0 :(得分:2)
context
区内无法it
。