Tag: 黄瓜

Ruby on Rails – 运行黄瓜时出错:您已经激活了activesupport 3.2.1,但您的Gemfile需要activesupport 3.1.0。

我知道这个问题之前已经以一种forms或另一种forms提出过,但我仍然无法为此获得有效的解决方案。 我正在网上提供saas课程,代码直接从https://github.com/saasbook/hw3_rottenpotatoes克隆 当我从命令提示符运行黄瓜时 Using the default profile… You have already activated activesupport 3.2.1, but your Gemfile requires activesupport 3.1.0. Using bundle exec may solve this. (Gem::LoadError) /Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in `block in setup’ /Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:17:in `setup’ /Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup’ /Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/setup.rb:7:in `’ /Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require’ /Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require’ /Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require’ /Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/boot.rb:6:in `’ /Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require’ /Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require’ /Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/application.rb:1:in `’ /Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require’ /Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in […]

如何用capybara和selenium填充tinymce-rails编辑器?

我使用水豚测试tinymceforms有困难。 我正在使用tinymce-rails并且在我的表单中有7个编辑器。 我也使用asciimath插件与tinymce。 一切正常,但我无法编写测试来填写tinymce编辑器。 以下是我的步骤定义代码的外观,与此处描述的内容非常相似: within_frame(“content_ifr”) do editor = page.find_by_id(‘tinymce’) editor.native.send_keys ‘test’ end 问题是当我运行以下内容时: editor.native.clear # works, clear the editor area, I’m testing this with pry editor.native.send_keys :tab # works, moves focus to next input editor.native.send_keys ‘test’ # returns “”, nothing happens, nothing in editor 如此clear , send_keys :tab按预期工作。 但我不能发送任何字符串。 send_keys函数总是返回空字符串,当我使用send_keys进行测试时没有任何反应。 这里出了什么问题? 以及如何调试/调查问题? 谢谢。

ruby-debug和黄瓜

我在黄瓜方面有一个失败的情况,我想使用ruby-debug来调试我的rails控制器。 但是,如果我将“调试器”添加到我想要破解的位置,它就不会停止。 我尝试将features of ruby​​-debug和rubygems添加到features / support / env.rb但是然后它告诉我它无法加载ruby-debug,尽管ruby-debug在gem列表中我可以加载它IRB。 那么……我该怎么办才能让它发挥作用? 谢谢!

使用Cucumber和Capybara进行分类测试

有没有办法用Cucumber和Capybara测试列表的排序。 使用javascript在客户端完成排序。 我在思考以下几点: Then I should see “first element” and then I should see “second element” 不幸的是,我不知道如何构建这些步骤。 谢谢您的帮助!

Cucumber / Capybara测试不再在Rails 3项目中运行

这些gem的最新版本不再相互配合吗? 似乎某些东西可能已经从我的捆绑中解决了。 undefined local variable or method `node’ for # (NameError) ./features/step_definitions/web_steps.rb:35 ./features/step_definitions/web_steps.rb:14:in `with_scope’ ./features/step_definitions/web_steps.rb:34:in `/^(?:|I )follow “([^”]*)”(?: within “([^”]*)”)?$/’ features/signing_in.feature:11:in `And I follow “Login”‘ 我所要做的就是运行一个function: bundle exec cucumber features/signing_in.feature 我无法进行任何测试。 capybara-0.4.0 cucumber-rails-0.3.2 cucumber-0.9.2 我重新运行了黄瓜的安装脚本。 我还要补充一点,我不知道在Capybara :: Drive :: RackTest中试图称之为“Node”的是什么。

非常长的工作流程的黄瓜场景

我们需要为一个function测试一个漫长的步骤。 从登录到许多模式对话框,多步骤表单和不同角色的用户都可以进行交互。 我们如何将这个过程的一部分分解为单独的场景? 这是一个例子: Scenario: New Manuscript Given I am on the manuscripts page When I press “Submit A New Manuscript” Then I should see “Please specify this manuscript’s type” Scenario: Choose Manuscript Type Given I am choosing a manuscript type When I click “Original Paper” Then I should see “Edit Manuscript Details” Scenario: Edit […]

如何让黄瓜和数据库清理器将我的种子数据留在我的rails测试数据库中?

我有几个数据库表,其数据仅用于显示目的,它永远不会更改。 加载所有种子数据需要很长时间。 我正在使用黄瓜,它似乎在每个场景之前使用database_cleaner gem来截断测试数据库中的所有表。 有没有办法告诉database_cleaner或黄瓜单独留下几张桌子,还是我在每个场景之前加载种子数据? 我正在运行rails 2.3.8黄瓜0.10.0 cucumber-rails 0.3.2 database_cleaner 0.50.0任何帮助都非常感谢。 汤姆

DHH对unit testing:RSpec确实是不必要的复杂吗?

我碰巧是Ruby Inside的订阅者,因为我对Rails特别感兴趣。 昨天,Rails的创建者David Heinemeier Hansson几乎说他只是使用测试/单元。 我会理解,因为它是Rails内部,但他似乎给出了强烈的意见。 他认为RSpec和Cucumber是不必要的复杂。 我通常不会太注意,但这取决于谁说了什么。 我很尊重汉森,他的意见让我思考。 当我开始使用Rails时,我从未真正研究过测试/单元。 只是RSpec和黄瓜。 这就是我想要你的洞察力的原因。 您认为RSpec确实很复杂吗? 写测试/单元花费的时间和精力更少吗?

没有黄瓜的Rspec集成测试?

有没有办法在不使用Cucumber的情况下使用Rspec进行集成测试? 我更喜欢使用普通的旧Webrat。 谢谢。

AssociationTypeMismatch和FactoryGirl

这最近引起了一些挫折…… 似乎在我的黄瓜测试中使用工厂,在某些情况下会导致AssociationTypeMismatch错误,例如: MyModel(#65776650)期待,得到MyModel(#28190030)(ActiveRecord :: AssociationTypeMismatch) 这些似乎在存在关联引用时发生 – 就好像Factory创建的对象与真实对象不同。 有关更多详细信息,请参阅此问题: Cucumber重复类问题:AssociationTypeMismatch 我一直在逐渐将Factory调用更改为真正的Model.create或mock_model调用。 继续使用工厂女孩会很好……我想知道是否有什么我可能做错了? 谢谢