README.rdoc in amqp-spec-0.2.3 vs README.rdoc in amqp-spec-0.2.4
- old
+ new
@@ -38,18 +38,19 @@
Default options and default timeout are local for each example group and inherited by its nested groups,
different example groups can have separate defaults. Please note that this is different from em-spec where
default_timeout is effectively a global setting.
require "amqp-spec/rspec"
+
describe AMQP do
include AMQP::SpecHelper
default_options :host => 'my.amqp.broker.org', :port => '21118'
- # Can be used to set default options for all your amqp{} event loops
+ # Can be used to set default options for your amqp{} event loops
default_timeout 1
- # Can be used to set default :spec_timeout for all your amqp-based specs
+ # Can be used to set default :spec_timeout for your evented specs
before(:each) do
puts EM.reactor_running?
end
@@ -89,14 +90,16 @@
either manually (done) or via default_timeout. Essentially, this means that any EM-related state that you'd like
to setup/teardown using these hooks will be lost as each example will run in a separate EM loop. In order to
run setup/teardown hooks inside the EM loop, you'll need to use before_amqp{} and after_amqp{} hooks that run
inside the EM loop but before/after AMQP loop (these hooks are currently not implemented)
- require "amqp-spec/rspec"
describe AMQP do
include AMQP::Spec
+ default_options :host => 'my.amqp.broker.org', :port => '21118'
+ default_timeout 1
+
it "requires a call to #done in every example" do
1.should == 1
done
end
@@ -121,20 +124,21 @@
Finally, you can include AMQP::EMSpec in your describe block. This will run all the group examples
inside em block instead of amqp. before{} and after{} hooks should be finished with 'done', same as
when including AMQP::Spec, and same caution about using them applies.
- require "amqp-spec/rspec"
describe AMQP do
include AMQP::EMSpec
it "requires a call to #done in every example" do
1.should == 1
done
end
- it "runs test code in an amqp block automatically" do
+ it "runs test code in an em block, instead of amqp block" do
start = Time.now
+
+ AMQP.conn.should be_nil
EM.add_timer(0.5){
(Time.now-start).should be_close( 0.5, 0.1 )
done
}
\ No newline at end of file