rspec-rails

    0熱度

    1回答

    我無法通過rspec將我的參數傳遞到嵌套路由。我使用的Rails 5和RSpec 3.5 我的規格如下所示: require 'rails_helper' describe "POST /api/v1/companies/:company_id/products.json", type: :controller do let!(:user) { create(:company_use

    0熱度

    2回答

    我已經在許多Rails項目中將RSpec與Capybara和Capybara-webkit結合使用,並且它通常可以順利運行。出於某種原因,我在配置js: true功能規格時可能會遇到問題。他們沒有正確地與數據庫交互。我使用factory_girl和database_cleaner來管理測試數據庫內容。我有DatabaseCleaner.strategy = :truncationdatabase_

    1熱度

    1回答

    我創建了一個以下rspec mock,它運行良好,但我執行它時得到了警告。 Using `stub` from rspec-mocks' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:shou

    0熱度

    1回答

    我在RSpec中創建了這個對象。我得到錯誤unexpected token tCOMMA在第二},任何想法,爲什麼我得到這個錯誤? let(:test) { { abc: [{ bde: { attribute1: 170.0, attribute2: '2016-12-14', attribute3: 'self entered',

    20熱度

    1回答

    我有簡單的動作表演 def show @field = Field.find_by(params[:id]) end ,我希望寫規範它 require 'spec_helper' RSpec.describe FieldsController, type: :controller do let(:field) { create(:field) } it

    -1熱度

    1回答

    我有一個頁面我想要顯示的不是索引,顯示,編輯等。我想要的頁面是adoption.html.erb,但由於某種原因它抓取了顯示頁面ID。在我的views/shared/_header.html.erb文件中,我有<li><%= link_to "More About Dog Adoption", adoption_info_path, class: "dog-adopt-info" %></li>。

    0熱度

    1回答

    時掛起以下方案產生預期的結果: 從zsh的 ,執行: /usr/local/bin/pg_dump mydatabase #=> a bunch of sql output 從IRB或軌道控制檯,執行: `/usr/local/bin/pg_dump my_database` #=> a bunch of sql output 從方法內調用相同的shell命令: class AppDb

    0熱度

    1回答

    爲了測試從棋盤的第一行(x_position = 0)垂直移動的車的有效移動,我期待幹起我的代碼。 這是我目前面臨的一個挑戰。以下代碼塊循環遍歷棋盤上所有棋盤上的方塊,從x_position(0)開始迭代y_position(0..7),最後迭代每個x_poisition達到7. 我目前的規範測試代碼: require 'rails_helper' RSpec.describe Rook, t

    2熱度

    1回答

    我最近將一個項目升級到了Rails 5.1。 修正所有棄用警告。 通過了所有測試(我用rspec-rails) 控制器測試,使用ActiveJob呼叫郵包現在呈現漫長的警告消息。 [ActiveJob] [ActionMailer::DeliveryJob] [6d2ec032-eff2-40d3-bad4-3b23de65d9bd] Could not log "render_template.

    -3熱度

    2回答

    我是相當新的軌道,我目前正在創建我的第一個API唯一的軌道應用程序。 什麼我努力讓我的頭周圍就是究竟是被存儲在測試環境中的條目?在完整的Rails應用程序中,FactoryGirl會將條目存儲在_test數據庫中並傳遞給控制器​​ - 通過類似RSpec的測試。 據我所知,在Rails API的應用程序你放棄使用的數據庫,而是旨在以JSON格式的數據存儲在服務器上 - 但在情況下我寫的要求規範,哪