我正在使用Cucumber Factory并且使用Cucumber轻松使用Machinist并且我遇到了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的想法!