rspec

    0热度

    1回答

    我正在尝试使用rspec向我的控制器写入测试。现在我有这样的代码: class Restream::CustomsController < Restream::BaseController def create @custom = Restream::Custom.new(custom_params) @custom.user_id = current_user.id

    -2热度

    2回答

    我正在开发一个使用rails的应用程序。自从我们开始使用rspec来测试我们的应用程序。我们使用simplecov作为工具来展示我们的测试覆盖率。 但simplecov只显示文件内的覆盖率的百分比,我的问题是,如果有一个工具,显示哪一行代码没有被覆盖?

    1热度

    2回答

    使用RSpec的RSpec的存根同样的方法,我想: expect(Thing).to receive(:status) .with(for: 'something') .and_return('down') 在第一次循环,和相同的存根应返回2号迭代不同的回报: expect(Thing).to receive(:status) .with(for

    0热度

    1回答

    我正在测试一个资源,我想检查它是否有正确的参数数量,但其中一个参数是require,我没有我想不出如何在with中匹配。我使用that_requires测试了这种关系是正确的。我目前的测试看起来像 context 'xldeploy_environment_member' do env = "Environments/#{company_short}/#{environment_shor

    0热度

    2回答

    我有一个方法是这样的: def self.method #API CALL end 而我写调用此静态方法控制方法的测试。它是这样的: it 'update order to confirmed' do Order.should_receive(:process_payment).and_return({}) sign_in user attribute

    0热度

    1回答

    我试图总结Timecop围绕shared_example规范我写 describe "timecop wrapping shared example" do Timecop.freeze(1.day.ago) do it_behaves_like "a shared example i would like to test using timecop" end e

    1热度

    1回答

    我使用Ruby 2.3.4和rspec 3.6.0。 我正在为使用rand(10000..99999)的对象编写测试。我找不到rand上的任何文档来查看它是哪个对象的一部分。我试图剔除Kernel,Object和Random(见下文),但我的任何尝试都没有导致rand被剔除。 allow(Kernel).to receive(rand).and_return(12345) allow(Objec

    2热度

    1回答

    我创建了一个简单的木偶4类和单元测试与它一起去如下(执行后touch metadata.json; rspec-puppet-init而在modules/test/): # modules/test/manifests/hello_world1.pp class test::hello_world1 { file { "/tmp/hello_world1": content

    5热度

    1回答

    我正在研究一个小插件,并包含simplecov。 在我的宝石文件中我有一行: gem 'simplecov', :require => false, :group => :test 在我的测试文件,我把线require "projectname/devuntil/rspec/spec_helper" 在文件的最顶端。 在我spec_helper.rb文件我在文件 if ENV['COVERAG

    7热度

    1回答

    我正在用ruby,rspec,水豚和硒测试一个web应用程序,我遇到了一个uninitialized constant ActiveAdminLoginPage异常,我不知道该如何解决。 在spec_helper.rb我正在要求如下: Dir[File.join(Dir.pwd, 'spec/page_objects/**/*.rb')].each { |f| require f } 我有2个