stubbing

    1熱度

    1回答

    有兩個類。父項:B.子項:A. A.method1()覆蓋B的項目。 public class B { protected boolean method1(){...}; } public class A extends B { protected boolean method1(){ boolean val = super.method1();

    0熱度

    1回答

    我想要那些已經測試的方法,但是我嘗試的所有方法似乎都不符合最佳實踐,也不能工作。 可能有人能用這個支持我嗎? 代碼進行測試 def any_subset_greater? divisors_sums.any?{|sum| sum > @value} end def no_subset_equal? !divisors_sums.any?{|sum| sum == @val

    0熱度

    2回答

    下面是我想測試的一個類(Class1),但我對我的單元測試並不完全滿意。請參閱下面的代碼示例。 被測系統 public interface IRepository { string GetParameter(int id); } public class Repository { public string GetParameter(int id) { ret

    1熱度

    1回答

    這是prior question的繼續,其中的答案我看到我有一個關於在FakeApplication中使用插件的誤解。 首先我創建了一個模型作爲一個特質和一個暗示它的對象。 trait UserModel extends ModelCompanion[User, ObjectId] { // ... } object User extends UserModel 接着,我有一個控制器,

    4熱度

    2回答

    打樁我有一個模型,看起來像這樣: class Gist def self.create(options) post_response = Faraday.post do |request| request.url 'https://api.github.com/gists' request.headers['Authorization'] = "Basi

    14熱度

    2回答

    rhino-mocks存根和期望在這裏有什麼區別:在我看來他們的表現完全一樣嗎? mockContext.Stub(x => x.Find<Blog>()) .Return(new List<Blog>() { new Blog() { Id = 1, Title = "Test" } }.AsQueryable()); mockContext.Exp

    1熱度

    1回答

    我想創造一些特殊的存根方法stub_check和stub_chain_check,以確保該方法存在新的存根方法。 例如: #spec/controllers/payments_controller_spec.rb` describe PaymentsController do it "makes a payment" do # Ensure method exists, P

    1熱度

    3回答

    我正在寫一個視圖規範,它使得包含行(HAML)一個觀點: =link_to new_post_path 但與規範失敗: ActionController::RoutingError: No route matches {:action=>"new", :controller=>"post"} 我試圖存根new_post_path方法,因爲它對於視圖規範並不重要,但沒有任何運氣。 我試過,我

    0熱度

    1回答

    我在Rails 3.0.9應用程序中使用bartt-ssl_requirement。 我的控制器頂部的ssl_required和ssl_allowed語句正在破壞我的rspec及其重定向。我如何解決這個問題? 從四處漫遊,我可以在我的spec_helper.rb(一個新概念,我不完全理解)中「存根」ssl_required方法返回true而不是重定向。 的Gemfile(相關): gem 'rai

    4熱度

    1回答

    我想存根具有以下簽名的方法: Product[] GetAllActive(Expression<Func<Product, bool>> predicate, bool asNoTracking = true, params Expression<Func<Product, object>>[] navigationProperties); 我用犀牛嘲笑,任何想法 感謝