NoMethodError: undefined method `context' in rspec test

System: rails 3.2.3

1.9.2p320

ubuntu 12.04 32 bit

I am trying to split up my rspec tests into contexts for different routes to the profile page but rspec is not liking context. I am new to Rails and Rspec and would appreciate some help.

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

code: require '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

Answers


You can't have a context inside an it block.


Need Your Help

Share with Facebook Messenger

android facebook-sdk-4.0

I have updated the dependency of Facebook SDK to 4.1.0. They changed a lot and now I cannot find a way to share text and image with Messenger.