【问题标题】:Is there a rspec helper to test a validate on update?是否有 rspec 助手来测试更新验证?
【发布时间】:2013-04-04 14:19:59
【问题描述】:

我正在使用以下验证

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

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

【问题讨论】:

    标签: ruby-on-rails activerecord rspec rspec2


    【解决方案1】:

    也许:

    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
    

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多