spec/waffle_spec.rb in waffle-0.4.0 vs spec/waffle_spec.rb in waffle-0.5.0
- old
+ new
@@ -17,24 +17,26 @@
before do
YAML.stub(:load_file => config_hash)
File.stub(:exists? => true)
Waffle::Config.stub(:environment => 'development')
+ Waffle.configure
end
- specify{Waffle.configure.should == Waffle::Config}
specify{Waffle.config.should == Waffle::Config}
specify{Waffle.config.transport.should == 'redis'}
specify{Waffle.config.encoder.should == 'json'}
specify{Waffle.config.connection_attempt_timeout.should == 30}
specify{Waffle.config.url.should == 'redis://localhost:port/0'}
end
context "when a block is supplied" do
before do
- Waffle.configure do |config|
- config.transport = 'redis'
+ Waffle.configure do
+ default do |config|
+ config.transport = 'redis'
+ end
end
end
after do
Waffle.configure do |config|
@@ -46,11 +48,12 @@
end
end
context do
before do
- Waffle.stub(:transport => transport)
+ Waffle.configure
+ Waffle::Config.stub(:queues => {:default => transport})
end
let(:transport){mock(:transport)}
describe '#publish' do
@@ -63,12 +66,12 @@
specify{Waffle.publish(*args)}
end
describe '#subscribe' do
before do
- transport.should_receive(:subscribe).with('flow').and_yield
+ transport.should_receive(:subscribe).with('flow')
end
- specify{Waffle.subscribe('flow'){}}
+ specify{Waffle.subscribe('flow')}
end
end
end