spec/lib/application_spec.rb in picky-1.2.4 vs spec/lib/application_spec.rb in picky-1.3.0
- old
+ new
@@ -8,15 +8,16 @@
it "should run ok" do
lambda {
class MinimalTestApplication < Application
books = index :books, Sources::DB.new('SELECT id, title FROM books', :file => 'app/db.yml')
books.define_category :title
-
full = Query::Full.new books
live = Query::Live.new books
+ rack_adapter.stub! :exclaim # Stopping it from exclaiming.
+
route %r{^/books/full} => full
route %r{^/books/live} => live
end
Tokenizers::Index.default.tokenize 'some text'
Tokenizers::Query.default.tokenize 'some text'
@@ -56,40 +57,58 @@
.define_ranged_category(:east1, 1, precision: 3, from: :east)
full = Query::Full.new books_index
live = Query::Live.new books_index
+ rack_adapter.stub! :exclaim # Stopping it from exclaiming.
+
route %r{^/books/full} => full
route %r{^/books/live} => live
end
}.should_not raise_error
end
end
+ describe 'finalize' do
+ before(:each) do
+ Application.stub! :check
+ end
+ it 'checks if all is ok' do
+ Application.should_receive(:check).once.with
+
+ Application.finalize
+ end
+ it 'tells the rack adapter to finalize' do
+ Application.rack_adapter.should_receive(:finalize).once.with
+
+ Application.finalize
+ end
+ end
+
describe 'delegation' do
it "should delegate route" do
- Application.routing.should_receive(:route).once.with :path => :query
+ Application.rack_adapter.should_receive(:route).once.with :path => :query
Application.route :path => :query
end
end
- describe 'routing' do
+ describe 'rack_adapter' do
it 'should be there' do
- lambda { Application.routing }.should_not raise_error
+ lambda { Application.rack_adapter }.should_not raise_error
end
- it "should return a new Routing instance" do
- Application.routing.should be_kind_of(Routing)
+ it "should return a new FrontendAdapters::Rack instance" do
+ Application.rack_adapter.should be_kind_of(FrontendAdapters::Rack)
end
it "should cache the instance" do
- Application.routing.should == Application.routing
+ Application.rack_adapter.should == Application.rack_adapter
end
end
describe 'call' do
before(:each) do
@routes = stub :routes
- Application.stub! :routing => @routes
+ Application.stub! :rack_adapter => @routes
end
it 'should delegate' do
@routes.should_receive(:call).once.with :env
Application.call :env
\ No newline at end of file