在进行Rspec 编译测试:

bundle exec rspec spec/requests/static_pages_spec.rb

提示错误:

FF

Failures:

1) Static pages Home page should have the content 'Sample App'
Failure/Error: visit '/static_pages/home'
NoMethodError:
undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0xba8829c>
# ./spec/requests/static_pages_spec.rb:5:in `block (3 levels) in <top (required)>'

2) Static pages Help page should have the content 'Help'
Failure/Error: visit '/static_pages/help'
NoMethodError:
undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_2:0xba8cd4c>
# ./spec/requests/static_pages_spec.rb:11:in `block (3 levels) in <top (required)>'

Finished in 0.00409 seconds
2 examples, 2 failures

Failed examples:

rspec ./spec/requests/static_pages_spec.rb:4 # Static pages Home page should have the content 'Sample App'
rspec ./spec/requests/static_pages_spec.rb:10 # Static pages Help page should have the content 'Help'

Randomized with seed 29742

解决办法:

在static_pages_spec.rb的末尾加入

module ::RSpec::Core
class ExampleGroup
include Capybara::DSL
include Capybara::RSpecMatchers
end
end

以上,解决~

[异常]undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1:0x16529f8 @example=nil>的更多相关文章

  1. undefined local variable or method ‘xxx’ for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0xbc88d6c>错误解决方案

    官方文档如下: https://github.com/rspec/rspec-rails/blob/master/Capybara.md Capybara 2.0 To use Capybara 2. ...

  2. [Ruby on Rails系列]4、专题:Rails应用的国际化[i18n]

    1. 什么是internationalization(i18n)? 国际化,英文简称i18n,按照维基百科的定义:国际化是指在设计软件,将软件与特定语言及地区脱钩的过程.当软件被移植到不同的语言及地区 ...

  3. undefined method `environment' for nil:NilClass when importing Bootstrap into rails

    今天做项目时往Gemfile里加了各gem, 然后bundle update了一下, 然后悲剧了,出现了undefined method `environment' for nil:NilClass ...

  4. "undefined method `root' for nil:NilClass" error when using "pod install" 解决办法

    如果pod undate 的时候报错"undefined method `root' for nil:NilClass" error when using "pod in ...

  5. [caffe]linux下安装caffe(无cuda)以及python接口

    昨天在mac上折腾了一天都没有安装成功,晚上在mac上装了一个ParallelDesktop虚拟机,然后装了linux,十分钟就安装好了,我也是醉了=.= 主要过程稍微记录一下: 1.安装BLAS s ...

  6. [Swift]基础

    [Swift]基础 一, 常用变量 var str = "Hello, playground" //变量 let str1="Hello xmj112288" ...

  7. gitlab ActionView::Template::Error (undefined method `[]' for nil:NilClass): 500错误

    Started GET "/mygroup/myproject/tree/master/MyDirectory" for 127.0.0.1 at 2014-10-22 22:42 ...

  8. [译]一个灵活的 Trello 敏捷工作流

    [译]一个灵活的 Trello 敏捷工作流 翻译自 An Agile Trello Workflow That Keeps Tasks Flexible Getting things done 可不只 ...

  9. iOS10收集IDFA,植入第三方广告[终结]--ADMob

    [PS: 前段时间,公司做ASO推广,需要在应用中收集IDFA值,跟广告平台做交互!于是有了这个需求--] 1.首先,考虑了一下情况(自己懒 -_-#),就直接在首页上写了一个Banner,循环加载广 ...

随机推荐

  1. certificate unknown(46) - 中间证书问题排查

    因为腾讯云的网站备案迟迟没有批下来,因此使用了朋友在阿里云的域名yk,我则申请了一台阿里云服务器,并将域名解析映射至该服务器.SSL证书则是在腾讯云上申请的,使用了Apache文件夹中的文件,放置在c ...

  2. 修改SO

    1.如果在jni中定义的是int型的数据,比如: JNIEXPORT jint JNICALL Java_com_ggndktest1_JniGg_getCoin (JNIEnv * env, job ...

  3. 【linux+C】神器 vim + 指针相关客串

    前篇回顾 上篇介绍了linux下C编程基本环境配置以及相关工具使用选择. 不过10个大牛9个用vim,那么咱们就来玩vim.linux下玩c就别依靠图形界面.好吧告别Ide,命令行才是c的王道. 本篇 ...

  4. Redis GEO 特性在 LBS 中的应用总结

    什么是LBS LBS(Location Based Service),基于位置的服务. Redis和GEO Redis 是最热门的 nosql 数据库之一,它的最大特点就是快.所以在 LBS 这种需要 ...

  5. CodeForces 1109E. Sasha and a Very Easy Test

    题目简述:给定$m \leq 10^9+9$,维护以下操作 1. "1 l r x":将序列$a[l], a[l+1], \dots, a[r]$都乘上$x$. 2. " ...

  6. c++中的友元重载

    1 语法 返回值类型 operator 运算符名称(形参列表) { 重载实体 } --------->operator和运算符名称在一起构造成新的函数名 2 案例 #include <io ...

  7. Jquery等待ajax执行完毕继续执行(断点调试正常,运行异常)

    以前写过一个程序,发现用断点调试的时候,一步步的运行,程序是可以的,但是去了断点程序就出现了问题. $(document).ready(function(){ var arra=new Array() ...

  8. C#基础:线程之异步委托

    线程:是程序中独立的指令流.在我们熟悉的Visual Studio编辑器中输入C# 代码的时候,系统会自动分析代码,提示你输入的代码出现的各种错误,这是一个后台线程完成的. 创建线程的一种简单的方式就 ...

  9. LeetCode: 412 Fizz Buzz(easy)

    题目: Write a program that outputs the string representation of numbers from 1 to n. But for multiples ...

  10. Qt中csv文件的导入与导出

    转自:http://blog.csdn.net/mingxia_sui/article/details/7683030 CSV 1.简介: 全称:Comma Separated Values. 是“逗 ...