Permalink
Browse files

move specs from Base to Connection

  • Loading branch information...
1 parent 66bbfab commit 4750ff10eedaabec5396f9ceed724620fad9a980 @neerfri committed Dec 8, 2010
Showing with 36 additions and 17 deletions.
  1. +2 −16 spec/lib/rzabbix/base_spec.rb
  2. +21 −0 spec/lib/rzabbix/connection_spec.rb
  3. +13 −1 spec/spec_helper.rb
@@ -4,23 +4,9 @@
describe Base do
- describe "use_ssl accessor" do
- it "should have use_ssl set to false by default" do
- RZabbix::Base.use_ssl.should == false
- end
- end
-
- describe "set_credentials method" do
- it "should set the value in the class accessor" do
- RZabbix::Base.set_credentials("host", "user", "pass")
- RZabbix::Base.credentials.should == {:api_url=>"host", :api_user=>"user", :api_password=>"pass"}
- end
-
- it "will not fail when I finish it"
- end
-
describe "perform_request method" do
- #RZabbix::Base.perform_request(:get, {})
+ RZabbix::Connection.should_receive(:perform_request).with(:get, {})
+ RZabbix::Base.perform_request(:controller, :action, {})
end
end
@@ -0,0 +1,21 @@
+require File.expand_path(File.join(File.dirname(__FILE__), './../../spec_helper.rb'))
+
+include RZabbix
+
+describe Connection do
+
+ describe "use_ssl accessor" do
+ it "should have use_ssl set to false by default" do
+ RZabbix::Connection.use_ssl.should == false
+ end
+ end
+
+ describe "set_credentials method" do
+ it "should set the value in the class accessor" do
+ RZabbix::Connection.set_credentials("host", "user", "pass")
+ RZabbix::Connection.credentials.should == {:api_url=>"host", :api_user=>"user", :api_password=>"pass"}
+ end
+
+ end
+
+end
View
@@ -1,3 +1,15 @@
require 'rzabbix'
-RZabbix::Base.set_credentials("host", "user", "pass")
+RZabbix::Connection.set_credentials("host", "user", "pass")
+
+RSpec.configure do |config|
+ # == Mock Framework
+ #
+ # RSpec uses its own mocking framework by default. If you prefer to
+ # use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :rspec
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+end

0 comments on commit 4750ff1

Please sign in to comment.