AbstractController :: ActionNotFound而method_defined? =真

时间:2015-02-26 18:36:43

标签: ruby-on-rails-4 ruby-on-rails-3.2 capybara rspec-rails rails-engines

在Rails 3.2.12中将引擎in_quotex升级到Rails 4.2.0后,集成测试中的click_button 'Save'会抛出错误:

Failure/Error: click_button 'Save'
     AbstractController::ActionNotFound:
       The action 'submit' could not be found for InQuotex::QuotesController

以下是规范案例:

 it "should work for workflow" do
      visit in_quotex.quotes_path
      click_link 'Submit'
      fill_in 'quote_wf_comment', :with => 'this line tests workflow'
      fill_in 'quote_tax', :with => '10.00'
      click_button 'Save'
 ...
  end

让我们感到困惑的是,在调试中,InQuotex::QuotesController.method_defined?(:submit)会返回true,这意味着在submit中定义了一个方法quotes controller(方法提交为{{1}在include)。 Rails 3.2.12可以使用相同的规范代码。我想知道什么可能导致这种类型的奇怪错误以及如何解决它。感谢。

in_quotex.gemspec:

application controller

以下是 s.add_dependency "rails", "~>4.2.0" s.add_dependency "jquery-rails" s.add_dependency "simple_form" s.add_dependency "will_paginate" s.add_dependency "database_cleaner" s.add_dependency "execjs" s.add_dependency 'protected_attributes' s.add_dependency "sass-rails", '~>5.0.1' s.add_dependency "coffee-rails", '~>4.1.0' s.add_dependency "uglifier" s.add_development_dependency "sqlite3" s.add_development_dependency "rspec-rails", "~> 3.2.0" s.add_development_dependency "factory_girl_rails", '~>4.5' s.add_development_dependency 'capybara' s.add_development_dependency 'launchy' #with capybara 表单标题:

submit

调试值:

<%= simple_form_for @workflow_model_object,  :method => :patch, :url =>  eval(@workflow_result_url)  do |f| %>

Backtrace输出(v.very long!):

@workflow_result_url="submit_quote_path"
@workflow_model_object = {InQuotex::Quote}#<InQuotex::Quote:0x632ac48>

0 个答案:

没有答案