rspec

    0热度

    1回答

    it "calls #create if #find_or_create is called and no matching record exists" do snack = class_spy(Snack, find_by_name: nil) attrs = {name: 'test', location: 'test'} snack.find_or_creat

    0热度

    2回答

    我在控制器中有一个flash消息,我想用rspec来测试它。 在我的控制器中,如果数据库为空,则设置flash[:notice],否则为零。 def show if(User.first.nil?) flash[:notice] = "database is empty!" end end 然后在RSpec的文件我想测试两种情况: 我:当flash[:notic

    0热度

    5回答

    我正在尝试编写一个测试,检查是否选中了复选框,如果未选中,将使用哪种方法进行检查。 我已经写了检查一个复选框代码, driver.find_element(:id, 'id_of_the_element').click(); ,但我还是想检查是否有人检查或还没有为其他测试情况 TYIA!

    0热度

    1回答

    RSpec文档显然是opposed to expect_any_instance_of,称它只应用于遗留代码,所以我正在寻找最佳实践替代方案。 我在使用expect_any_instance_of很多的情况下,我想测试一个方法将在满足某些条件时被调用,但是对象将被加载到不同的作用域中。 例如,写一个控制器规范的时候,我只是想测试正确的方法被调用正确的参数X上的一个实例

    0热度

    1回答

    我有一个轨道应用程序,有一些引擎在相同的回购。这些旨在通过管理员为“管理员”保留用于“支付”的付款和逻辑的逻辑。 效果几乎完美。所有的TTD工作都在引擎文件夹中完成..他们每个人都有一个规格文件夹 我今天挣扎的是CircleCI不知道测试引擎。它似乎没有在引擎中找到spec文件。 问:有谁知道如何将其他目录添加到他们的圈rspec运行?

    0热度

    1回答

    我有以下: let(:update_request) { put "/api/v3/account/profile.json", attributes, credentials } describe "PUT 'update'" do before { update_request } context "updating normal attributes (no pas

    1热度

    1回答

    我想使用RSpec测试控制器接收这种请求:具有 curl -X POST \ --data "{\"same_key\": \"value_in_body\"}" \ --header "same_key: value_in_header" \ "http://localhost:5000/articles/?same_key=value_in_q

    0热度

    1回答

    嗨,我的生活我无法找到我的rspec文件中的语法错误。我经历了几十次,却找不到它。我可以用一组额外的眼睛来帮助我。继承人我的规格文件: require 'rails_helper' RSpec.describe User, type: :model do let(:user) { User.create!(name: "Bloccit User", email: "[email pr

    0热度

    1回答

    我有以下问题 失败: 1)QuestionsController POST#创建与有效的属性在数据库中保存 问题 Failure/Error: post :create, question: attributes_for(:question) ArgumentError: unknown keyword: question # ./spec/controllers/question

    0热度

    1回答

    我正在学习测试自动化。我在Ruby语言中使用'cucumber','rspec','selenium-web driver'框架。在测试中,我几乎可以执行每一步。自动点击按钮时发生错误。 Step definitions: Quando(/^clicar o botão "([^"]*)"$/) do |botaoSave| # @navegador.find_elements(:xp