spec/unit/application_spec.rb in restfulness-0.3.2 vs spec/unit/application_spec.rb in restfulness-0.3.3
- old
+ new
@@ -12,79 +12,79 @@
end
describe "#router" do
it "should access class's router" do
obj = klass.new
- obj.router.should eql(klass.router)
+ expect(obj.router).to eql(klass.router)
end
end
describe "#call" do
it "should build rack app and call with env" do
env = {}
obj = klass.new
app = double(:app)
- app.should_receive(:call).with(env)
- obj.should_receive(:build_rack_app).and_return(app)
+ expect(app).to receive(:call).with(env)
+ expect(obj).to receive(:build_rack_app).and_return(app)
obj.call(env)
end
end
describe "#build_rack_app (protected)" do
it "should build a new rack app with middlewares" do
obj = klass.new
obj.class.middlewares << Rack::ShowExceptions
app = obj.send(:build_rack_app)
- app.should be_a(Rack::Builder)
+ expect(app).to be_a(Rack::Builder)
# Note, this might brake if Rack changes!
- app.instance_variable_get(:@use).first.call.should be_a(klass.middlewares.first)
- app.instance_variable_get(:@run).should be_a(Restfulness::Dispatchers::Rack)
+ expect(app.instance_variable_get(:@use).first.call).to be_a(klass.middlewares.first)
+ expect(app.instance_variable_get(:@run)).to be_a(Restfulness::Dispatchers::Rack)
end
end
describe ".routes" do
context "basic usage" do
it "should build a new router with block" do
- klass.router.should_not be_nil
- klass.router.should be_a(Restfulness::Router)
+ expect(klass.router).not_to be_nil
+ expect(klass.router).to be_a(Restfulness::Router)
end
it "should be accessable from instance" do
obj = klass.new
- obj.router.should eql(klass.router)
+ expect(obj.router).to eql(klass.router)
end
it "should pass block to Router instance" do
block = lambda { }
- Restfulness::Router.should_receive(:new).with(&block)
+ expect(Restfulness::Router).to receive(:new).with(no_args, &block)
Class.new(Restfulness::Application) do
routes &block
end
end
end
end
describe ".middlewares" do
it "should provide empty array of middlewares" do
- klass.middlewares.should be_a(Array)
- klass.middlewares.should be_empty
+ expect(klass.middlewares).to be_a(Array)
+ expect(klass.middlewares).to be_empty
end
end
describe ".logger" do
it "should return main logger" do
- klass.logger.should eql(Restfulness.logger)
+ expect(klass.logger).to eql(Restfulness.logger)
end
end
describe ".logger=" do
it "should set main logger" do
orig = Restfulness.logger
logger = double(:Logger)
klass.logger = logger
- Restfulness.logger.should eql(logger)
+ expect(Restfulness.logger).to eql(logger)
Restfulness.logger = orig
end
end