Ruby on rails cucumber和rspec可以使用相同的blueprints.rb文件吗

Ruby on rails cucumber和rspec可以使用相同的blueprints.rb文件吗,ruby-on-rails,rspec,cucumber,machinist,Ruby On Rails,Rspec,Cucumber,Machinist,我正在使用Rails 3、machinist 2、cucumber和rspec,并且有两个blueprints.rb文件。一个在spec目录中,一个在features/support目录中 有一个blueprints.rb文件是个好主意吗 如果是,首选的设置方式是什么 目前,我只是将我的features/support/blueprints.rb文件符号化到spec/blueprints.rb,这可能不好,但对我来说很有用。这听起来很正常-我们这样做是为了共享设备和助手(但我不使用Machini

我正在使用Rails 3、machinist 2、cucumber和rspec,并且有两个blueprints.rb文件。一个在spec目录中,一个在features/support目录中

有一个blueprints.rb文件是个好主意吗

如果是,首选的设置方式是什么


目前,我只是将我的features/support/blueprints.rb文件符号化到spec/blueprints.rb,这可能不好,但对我来说很有用。

这听起来很正常-我们这样做是为了共享设备和助手(但我不使用Machinist)

您可能需要做的是在cucumber env和rspec helper文件中包含这样一行。这样做的目的是将包含blueprints.rb文件的目录放在Ruby包含文件时要查看的路径列表的顶部

$: << File.expand_path(File.join(File.dirname(__FILE__), "..","..","shared","directory"))
#require 'blueprints' will now look in the above directory first

$:我有这些内部功能/支持

文件名machinist.rb

require 'machinist/active_record' 

Dir[ File.dirname(__FILE__) + "/../../spec/blueprints/*"].each {|file| require file }

Before { Sham.reset } # to reset Sham's seed between scenarios so each run has same random sequences

如果我只需要“require File.join(File.dirname(File)”、“.”、“.”、“.”、“.spec”、“blueprints.rb”)”并删除Sham.reset,它就可以工作了。