我有一个方法,它有一个sorbet类型的签名定义。当尝试在使用RSpec的测试中模拟此方法时,我得到了一个类型不匹配错误。我正在尝试理解如何解决这个问题,并且可以在不影响冰沙类型检查的情况下添加基于RSpec的测试。
sig {params(login_context: LoginContext, company_id: String).returns(T::Boolean)}
def populate_dummy_data(login_context, company_id)
测试代码:
@login_context = double(LoginContext, :requester => @requester) # Creates an instance of type Rspec::Mocks::double
错误:
expected no Exception, got #<TypeError: Parameter ‘login_context’: Expected type LoginContext, got type RSpec::Mocks::Double wit...a_populator_spec.rb:42
https://stackoverflow.com/questions/56742572
复制相似问题