我有一个功能(.feature文件)在黄瓜工作正常.
功能中所有场景的背景仅设置用户,然后以管理员身份登录,例如
Background:
Given I am logged in as a supervisor with an existing supervisee
...loads of scenarios
Run Code Online (Sandbox Code Playgroud)
但是,无论您是以管理员还是以用户身份登录,应用程序的设计/目标都已更改,并且相同的方案应该都可以正常工作.对于大多数应用程序的其余部分而言,情况并非如此,其中设计对于主管/用户来说是不对称的.
是否有任何理智的方法来避免复制和粘贴具有不同背景的整个功能文件?似乎没有一种方法可以参数化背景(例如,使用Either:Or:节),或者另外一种方法来引入具有大量场景的外部文件.想法?
Background:
Given I am logged in as an existing supervisee
...same loads of scenarios
Run Code Online (Sandbox Code Playgroud)
这是一些幻想小黄瓜语法(不存在)
Background Outline:
Given I am logged in as a <user>
Backgrounds:
| user |
| supervisor with an existing supervisee |
| an existing supervisee |
...loads of scenarios
Run Code Online (Sandbox Code Playgroud)
另外,不同的幻想Gherkin语法:
Background:
Given I am logged in as an existing supervisee
Include Scenarios:
supervisor.features
Run Code Online (Sandbox Code Playgroud) RAILS-3有一个好的,权威的保留字列表吗?
候选人:
背景:我保持一个长期服务的Rails应用程序,它有足够的保留字用法(判断http://oldwiki.rubyonrails.org/rails/pages/ReservedWords似乎适用于rails2).然而,这些都没有实际干扰当前的活动(应用程序工作...以及我正在慢慢添加到所有通道的规格和功能).但随着时间的推移,我想删除那些保留字的用法,但如果不再保留一些保留字,就不要打扰.因此,虽然较长的列表可能对新的rails应用程序有利,但我需要更强有力的预算支出理由,而不是"它已经在某个网站的某个网页上列出了......")
也许rails的本质是你无法找到权威的列表,但你可以找到"在某些时候对我不起作用的东西"....
我newrelic_rpm
在rails 3.2应用程序中本地使用开发人员模式.这工作正常.
当我ruby-prof
在newrelic本地仪表板中安装并单击"开始分析"并返回到我的应用程序时,我的应用程序中的每个页面都为#提供了"未定义的方法`pop".
追溯的前几行:
newrelic_rpm (3.6.4.122) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:421:in `ensure in perform_action_with_newrelic_profile'
newrelic_rpm (3.6.4.122) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:421:in `perform_action_with_newrelic_profile'
newrelic_rpm (3.6.4.122) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:305:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.6.4.122) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:121:in `process'
Run Code Online (Sandbox Code Playgroud)
任何想法如何解决出了什么问题?
我现有的rspecs和黄瓜功能都运行良好.
我正在安装spork(事实上是spork-rails)给我一些重新加速的速度.
我的sppec运行得很好.
我刚刚按照说明修改了env.rb(非常类似于spec_helper.rb的mod),但是uninitialized constant Cucumber::Rails
当我尝试运行时,我得到了bundle exec cucubmer --drb
.
顺便说一下Rails 3.2
有任何想法吗?
这是我的env.rb:
require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
require 'spork/ext/ruby-debug'
if Spork.using_spork?
Spork.prefork do
require 'rails'
require 'cucumber/rails'
Capybara.default_selector = :css
begin
DatabaseCleaner.strategy = :transaction
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
end
Spork.each_run do
# This code will be run each …
Run Code Online (Sandbox Code Playgroud) 我正在使用thor编写命令行任务(在rails 3应用程序中)并尝试通过heroku管道输入,例如 cat somefile.csv | heroku run thor sometask
在我的本地机器上运行良好,cat somefile.csv | thor sometask
但在heroku上可能会失败.某些版本的sometasks偶尔会工作,其他版本总是会在特定点失败 - 1个问题是cat somefile.csv
当它被正在使用时回调到控制台thor sometask
(这只发生在heroku上,所以我认为这是heroku的内部CLI).
我找到了一个解决方法,这是为了确保我在Thor任务及其调用的函数中没有向控制台(stdout)写任何内容,但是必须这样做(没有进度指示等)是令人沮丧的.
另一个"解决方法"是确保发送的文件低于4k(4095bytes) - 我无法使其失败
任何想法为什么会发生这种情况(为什么猫会被回应到stdout)?是否存在4k stdout缓冲区限制,例如在通信过程中的某个地方?有什么办法让heroku CLI更简洁?