我为一个REST api开发了一个Ruby接口.我使用rspec和vcr进行测试.
所有测试都使用专门为其创建的帐户凭据.
我无法决定:将我的测试(vcr磁带)的缓存响应存储在存储库中,或允许用户和订阅者编写自己的磁带是否正确?
以皇帝的名义!让圣战开始吧!
我提出错误使用 raise(ConfigurationError.new(msg))
我尝试用rspec测试这个:
expect {
Base.configuration.username
}.to raise_error(ConfigurationError, message)
Run Code Online (Sandbox Code Playgroud)
但这不起作用.我该怎么测试呢?目标是匹配message.
gem"formtastic","〜> 2.1.1"gem"activeadmin","〜> 0.4.2"gem"paperclip"
照片的字段不会显示在活动管理员表单app/views/admin/products/_form.html.erb中,但app/views/products/_form.html.erb中的相同表单在产品的视图中正常工作
ActiveAdmin.register Product do
form :partial => "form"
end
<%= semantic_form_for [:admin , @product ], :html => { :multipart => true } do |f| %>
<%= f.semantic_errors :name , :price , :description, :category_id %>
<%= f.inputs :new_product do%>
<%= f.input :name %>
<%= f.input :price %>
<%= f.input :description %>
<%= f.input :category_id , :as => :select , :collection => Hash[Category.all.map{|c| [c.name, c.id]}] %>
<% end %>
<%= f.inputs "Product images" do %> …Run Code Online (Sandbox Code Playgroud)