English 中文(简体)
1. 利用现有控制器、铁路信号模型和看法生成所有RSpec文档
原标题:Generate all RSpec spec files from existing controllers, models & views in a Rails app

是否有任何人知道一项 r忙的任务或RSpec呼吁,这将产生与现有控制人员、模型、助手档案和在你的申请中已经存在的观点有关的一nch空档案?

最佳回答

The best solution for this is to add hooks in place within environment.rb to create the spec.rb files within the rails application each time a model or controller is created.

这里是这方面的法典(使用RSpec和PricGirl):

module RailsApp

  class Application < Rails::Application
    config.generators do |g|
      g.test_framework  :rspec, :fixture_replacement => :factory_girl, :views => true, :helper => false
      g.fixture_replacement :factory_girl, :dir =>  spec/factories 
      g.stylesheets     false
      g.javascripts     false
      g.helper          false
    end

  end
end
问题回答

你们能够利用诸如这样的东西,对现有的控制者进行一套空洞的手脚检验:

rails generate rspec:scaffold recipe

你可以通过采纳你希望产生的模式的属性来改进这一点:

rails generate rspec:scaffold recipe title: string slug: string description: text

你们仍然需要做一些手工编辑,但这应当带给你们大多数的路子。





相关问题
Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Best browser for testing under Safari Mobile on Linux?

I have an iPhone web app I m producing on a Linux machine. What s the best browser I can use to most closely mimic the feature-limited version of Safari present on the iPhone? (It s a "slimmed down" ...

Code Coverage Tools & Visual Studio 2008 Pro

Just wondering what people are using for code coverage tools when using MS Visual Studio 2008 Pro. We are using the built-in MS test project and unit testing tool (the one that come pre-installed ...

Is there any error checking web app cralwers out there?

Wondering if there was some sort of crawler we could use to test and re-test everything when changes are made to the web app so we know some new change didn t error out any existing pages. Or maybe a ...

热门标签