On 9/27/10 8:23 AM, GregD wrote:
On Sep 27, 9:14 am, David Chelimsky<dchelim...@gmail.com> wrote:
On Sep 27, 2010, at 8:12 AM, David Chelimsky wrote:
re: how to include them: yes, in a module:
# in spec/support/custom_matchers.rb
module CustomMatchers
...
end
# in spec/spec_helper.rb
RSpec.configure do |c|
c.include CustomMatchers
end
Okay, 1 more question and maybe this is more of a convention request.
I know in my rails apps that my environment is loaded when running my
specs from a rake task or from the spec command. But for a non-rails
app, it would be nice to default spec program to load spec_helper if
it exists in the spec dir. Like:
jruby -S spec spec
instead of having to do this to include the spec_helper every time:
jruby -S spec -r spec/spec_helper.rb spec
Or am I missing something? Or is that just not desirable? I know I
can use rake and create a rake task(s), but from the perspective of
the command line, it would be nice to not to have to supply the -r
option unless you want to include something "outside" of this
convention.
For rails and non-rails apps/libs the convention is to have each
*_spec.rb file require the 'spec_helper' at the top of the spec like so:
http://github.com/rspec/rspec-core/blob/master/spec/rspec/core_spec.rb#L1
By following this convention you will only have to specify the spec on
the command line.
HTH,
Ben
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users