Module: AMQP::Spec
- Defined in:
- lib/amqp-spec/rspec.rb,
lib/version.rb,
lib/amqp-spec.rb
Overview
If you include AMQP::Spec module into your example group, each example of this group will run inside AMQP.start loop without the need to explicitly call ‘amqp’. In order to provide options to AMQP loop, default_options class method is defined. Remember, when using AMQP::Specs, you’ll have a single set of AMQP.start options for all your examples.
Constant Summary collapse
- VERSION_FILE =
:nodoc:
Pathname.new(__FILE__).dirname + '../VERSION'
- VERSION =
VERSION_FILE.exist? ? VERSION_FILE.read.strip : nil
Class Method Summary collapse
- .included(example_group) ⇒ Object
-
.require_libs(libs, opts = {}) ⇒ Object
Requires ruby source file(s).
Instance Method Summary collapse
Class Method Details
.included(example_group) ⇒ Object
181 182 183 |
# File 'lib/amqp-spec/rspec.rb', line 181 def self.included(example_group) example_group.send(:include, SpecHelper) end |
.require_libs(libs, opts = {}) ⇒ Object
Requires ruby source file(s). Accepts either single filename/glob or Array of filenames/globs. Accepts following options:
- :file
-
Lib(s) required relative to this file - defaults to __FILE__
- :dir
-
Required lib(s) located under this dir name - defaults to gem name
11 12 13 14 15 16 17 |
# File 'lib/amqp-spec.rb', line 11 def self.require_libs(libs, opts={}) file = Pathname.new(opts[:file] || __FILE__) [libs].flatten.each do |lib| name = file.dirname + (opts[:dir] || file.basename('.*')) + lib.gsub(/(?<!.rb)$/, '.rb') Pathname.glob(name.to_s).sort.each { |rb| require rb } end end |
Instance Method Details
#instance_eval(&block) ⇒ Object
187 188 189 190 191 |
# File 'lib/amqp-spec/rspec.rb', line 187 def instance_eval(&block) amqp do super(&block) end end |
#instance_eval_without_event_loop ⇒ Object
185 |
# File 'lib/amqp-spec/rspec.rb', line 185 alias instance_eval_without_event_loop instance_eval |