我正在尝试将黄瓜测试输出为pdf格式。我已经做了一段时间了,而且效果很好。在升级了一些gems之后,我的pdf输出已经停止工作,并出现错误:
% rake cucumber:new_report_pdf
(in /home/map7/pais)
NOTICE: CREATE TABLE will create implicit sequence "employees_id_seq" for serial column "employees.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "employees_pkey" for table "employees"
NOTICE: CREATE TABLE will create implicit sequence "entities_id_seq" for serial column "entities.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "entities_pkey" for table "entities"
NOTICE: CREATE TABLE will create implicit sequence "ledgers_id_seq" for serial column "ledgers.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "ledgers_pkey" for table "ledgers"
NOTICE: CREATE TABLE will create implicit sequence "staff_id_seq" for serial column "staff.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "staff_pkey" for table "staff"
bundle exec /home/map7/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -I "/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib:lib" "/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/bin/cucumber" --profile new_report_pdf
Using the new_report_pdf profile...
..........undefined method `headers=' for #<Prawn::Table:0x0000000697d4d8> (NoMethodError)
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:124:in `block in initialize'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:124:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:124:in `initialize'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:25:in `new'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:25:in `table'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:240:in `print_table'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:161:in `block in before_multiline_arg'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:219:in `call'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:219:in `block in render'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:218:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:218:in `render'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:229:in `flush'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:105:in `after_feature_element'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:174:in `block in send_to_all'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:172:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:172:in `send_to_all'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:165:in `broadcast'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:40:in `block in accept'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:39:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:39:in `accept'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:20:in `block in visit_feature'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:29:in `block in accept'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:17:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:17:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:28:in `accept'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:14:in `block in visit_features'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:13:in `visit_features'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:45:in `run!'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/cli/main.rb:43:in `execute!'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/cli/main.rb:20:in `execute'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/bin/cucumber:14:in `<main>'
rake aborted!
Command failed with status (1): [bundle exec /home/map7/.rvm/rubies/ruby-1....]
(See full trace by running task with --trace)
这是我的cucumber.yml文件
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
report: --format html --out=features.html
report_pdf: --format pdf --out=features.pdf
new: --tags @new
new_report: --format html --out=features_new.html --tags @new
new_report_pdf: --format pdf --out=features_new.pdf --tags @new
我必须升级黄瓜吗?或者降级对虾什么的?
更新:我已经尝试使用最新的黄瓜&对虾git回购(24/05/2011)在我的Gemfile和运行捆绑包。我仍然有同样的问题。
更新:(2011年7月18日)遵循take_tk的建议并使用$gem卸载对虾--版本=0.11.1
我走得更远了一点,但仍然有一个问题:
..rake aborted!
Command failed with status (1): [/home/map7/.rvm/rubies/ruby-1.9.2-p180/bin...]
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `call'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `sh'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `sh'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-1.0.0/lib/cucumber/rake/task.rb:104:in `run'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-1.0.0/lib/cucumber/rake/task.rb:193:in `block in define_task'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/map7/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/home/map7/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
Tasks: TOP => cucumber:new_report_pdf
我也遇到了同样的麻烦。所以,卸载了"对虾——版本=0.11.1"。然后我就可以了。
[tk@EeePC-31kyuuyo]$sudo宝石列表对虾*
*本地宝石*
对虾(0.11.1、0.8.4)<lt<--版本混乱!
虾芯(0.8.4)
对虾布局(0.8.4)
对虾安全(0.8.4)
[tk@EeePC-31kyuuyo]$sudo-gem卸载对虾-版本=0.11.1
成功卸载婴儿-0.11.1
[tk@EeePC-31kyuuyo]$sudo宝石列表对虾*
*本地宝石*
对虾(0.8.4)
虾芯(0.8.4)
对虾布局(0.8.4)
对虾安全性(0.8.4)