spec/api/stats_spec.rb in rhosync-2.1.11 vs spec/api/stats_spec.rb in rhosync-2.1.12
- old
+ new
@@ -1,16 +1,20 @@
require File.join(File.dirname(__FILE__),'api_helper')
describe "RhosyncApiStats" do
it_should_behave_like "ApiHelper"
+ def app
+ @app = Rhosync::Server.new
+ end
+
before(:each) do
- Rhosync.stats = true
+ Rhosync::Server.set :stats, true
end
after(:each) do
- Rhosync.stats = false
+ Rhosync::Server.set :stats, false
end
it "should retrieve metric names" do
Store.set_value('stat:foo', '1')
Store.set_value('stat:bar', '2')
@@ -53,9 +57,10 @@
last_response.status.should == 404
last_response.body.should == 'Unknown metric'
end
it "should raise error if stats not enabled" do
+ Rhosync::Server.set :stats, false
Rhosync.stats = false
post "/api/stats", {
:api_token => @api_token,
:metric => 'foo'
}
\ No newline at end of file