zoukankan      html  css  js  c++  java
  • [异常]undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1:0x16529f8 @example=nil>

    在进行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

    以上,解决~

                                                                                                                  

  • 相关阅读:
    bootstrap轮播图--兼容IE7
    css清除默认样式和设置公共样式
    jq三级全选全不选
    妙味课堂--导航手风琴效果(转)
    妙味课堂首页--鼠标经过文字实现类似琴效果(转)
    eclipse导入git项目(转)
    根据屏幕分辨率设置样式
    css选择器
    h5新增标签兼容性
    4.Reverse Words in a String-Leetcode
  • 原文地址:https://www.cnblogs.com/lidonghao/p/3498030.html
Copyright © 2011-2022 走看看