1

我正在使用以下验证

“validates_presense_of :column, :on => :update”

rspec 是否提供了帮助程序来测试上述内容?

4

2 回答 2

0

也许:

describe ThingsController, "#update" do
  context "for a thing" do
    before do
      get :update, :id => 1
    end
    it { should validate_presence_of :your_column_name }
  end
end
于 2013-04-04T15:24:05.837 回答
0

找到了这个,这正是我想要的

http://remarkable.rubyforge.org/activerecord/classes/Remarkable/ActiveRecord/Matchers.html

于 2013-04-04T17:40:10.820 回答