2

我正在使用 Cucumber Factory 并使其易于使用带有 Cucumber 的机械师,但我遇到了 ArgumentError。我的功能文件中导致问题的行是:

Given there is a tag

在蓝图文件中,我将 Tag 定义为这个(不是最好的,一旦我通过 ArgumentError 就会得到改进):

Tag.blueprint do
    name                { "tag" }   
    slug                { "slug" }
    uuid                { "uuid" }
end

这是回溯:

cucumber_factory-1.8.4/lib/cucumber/factory.rb:24
  wrong number of arguments (2 for 1) (ArgumentError)
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/attribute_assignment.rb:33:in `attributes='
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber_factory-1.8.4/lib/cucumber/factory.rb:124:in `create_record'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber_factory-1.8.4/lib/cucumber/factory.rb:79:in `parse_creation'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber_factory-1.8.4/lib/cucumber/factory.rb:24:in `block in <class:Factory>'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/core_ext/instance_exec.rb:48:in `block in cucumber_instance_exec'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/rb_support/rb_step_definition.rb:97:in `invoke'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/step_match.rb:25:in `invoke'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/step_invocation.rb:60:in `invoke'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/step_invocation.rb:38:in `accept'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:99:in `block in visit_step'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:98:in `visit_step'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/step_collection.rb:15:in `block in accept'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/step_collection.rb:14:in `each'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/step_collection.rb:14:in `accept'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:93:in `block in visit_steps'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:92:in `visit_steps'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/background.rb:41:in `block in accept'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/background.rb:52:in `block in with_visitor'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/scenario.rb:105:in `with_visitor'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/background.rb:51:in `with_visitor'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/background.rb:38:in `accept'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:57:in `block in visit_background'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:56:in `visit_background'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/feature.rb:41:in `accept'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:20:in `block in visit_feature'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/features.rb:29:in `block in accept'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/features.rb:17:in `each'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/features.rb:17:in `each'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/features.rb:28:in `accept'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:14:in `block in visit_features'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/ast/tree_walker.rb:13:in `visit_features'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/runtime.rb:47:in `run!'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/cli/main.rb:43:in `execute!'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/lib/cucumber/cli/main.rb:20:in `execute'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/gems/cucumber-1.2.5/bin/cucumber:14:in `<top (required)>'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/bin/cucumber:23:in `load'
  /Users/andreas/.rvm/gems/ruby-1.9.3-p194/bin/cucumber:23:in `<main>'
  features/api/v1/source/get_source.feature:7:in `And there is a tag'

我正在使用 Ruby 1.9.3、Rails 3.2.6、Cucumber 1.2.5、Cucumber Rails 1.3.1、Cucumber Factory 1.8.4 和 Machinist 2.0。蓝图看起来不错,因为 Tag.make 在 rails 控制台中工作。

对于如何克服 ArgumentErrors 的任何想法,我将不胜感激!

4

0 回答 0