spec/namecheap_spec.rb in namecheap-0.0.2 vs spec/namecheap_spec.rb in namecheap-0.1.0
- old
+ new
@@ -1,36 +1,48 @@
require File.dirname(__FILE__) + '/spec_helper'
describe "NamecheapAPI Wrapper" do
describe "initializating settings" do
+
+ before :each do
+ Namecheap.reset
+ end
+
describe "with defaults" do
it "should contain a username" do
- namecheap = Namecheap::Api.new(:environment => 'test')
- namecheap.send(:username).should == 'apiuser'
+ Namecheap.username.should == 'apiuser'
end
it "should contain a key" do
- namecheap = Namecheap::Api.new(:environment => 'test')
- namecheap.send(:key).should == 'apikey'
+ Namecheap.key.should == 'apikey'
end
it "should contain a client_ip" do
- namecheap = Namecheap::Api.new(:environment => 'test')
- namecheap.send(:client_ip).should == '127.0.0.1'
+ Namecheap.client_ip.should == '127.0.0.1'
end
end
describe "with defaults overidden" do
- it "shoud contain a overidden username" do
- namecheap = Namecheap::Api.new(:environment => 'test', :username => 'testuser')
- namecheap.send(:username).should == 'testuser'
+ it "should contain an overidden key" do
+ Namecheap.configure do |config|
+ config.key = 'newkey'
+ end
+
+ Namecheap.key.should == 'newkey'
end
- it "shoud contain a key" do
- namecheap = Namecheap::Api.new(:environment => 'test', :key => 'testkey')
- namecheap.send(:key).should == 'testkey'
+ it "should contain an overridden username" do
+ Namecheap.configure do |config|
+ config.username = 'newuser'
+ end
+
+ Namecheap.username.should == 'newuser'
end
- it "shoud contain a client_ip" do
- namecheap = Namecheap::Api.new(:environmeny => 'test', :client_ip => '66.11.22.44')
- namecheap.send(:client_ip).should == '66.11.22.44'
+
+ it "should contain an overridden client_ip" do
+ Namecheap.configure do |config|
+ config.client_ip = '192.168.0.1'
+ end
+
+ Namecheap.client_ip.should == '192.168.0.1'
end
end
end
end
\ No newline at end of file