spec/namecheap_spec.rb in namecheap-0.2.0 vs spec/namecheap_spec.rb in namecheap-0.3.0

- old
+ new

@@ -1,48 +1,39 @@ -require File.dirname(__FILE__) + '/spec_helper' +require File.dirname(__FILE__) + '/helper' -describe "NamecheapAPI Wrapper" do - describe "initializating settings" do +describe Namecheap do + before { reset_config } - before :each do - Namecheap.reset - end + context "with default config" do + subject { Namecheap.config } - describe "with defaults" do - it "should contain a username" do - Namecheap.username.should == 'apiuser' - end - it "should contain a key" do - Namecheap.key.should == 'apikey' - end - it "should contain a client_ip" do - Namecheap.client_ip.should == '127.0.0.1' - end - end + its(:username) { should be_nil } + its(:key) { should be_nil } + its(:client_ip) { should be_nil } + end - describe "with defaults overidden" do - it "should contain an overidden key" do + describe '.configure' do + it 'should set the api key' do + expect { Namecheap.configure do |config| - config.key = 'newkey' + config.key = 'the_apikey' end + }.to change { Namecheap::Config.key }.to('the_apikey') + end - Namecheap.key.should == 'newkey' - end - - it "should contain an overridden username" do + it 'should set the username' do + expect { Namecheap.configure do |config| - config.username = 'newuser' + config.username = 'the_username' end + }.to change { Namecheap::Config.username }.to('the_username') + end - Namecheap.username.should == 'newuser' - end - - it "should contain an overridden client_ip" do + it 'should set the client_ip' do + expect { Namecheap.configure do |config| - config.client_ip = '192.168.0.1' + config.client_ip = 'the_client_ip' end - - Namecheap.client_ip.should == '192.168.0.1' - end + }.to change { Namecheap::Config.client_ip }.to('the_client_ip') end end -end \ No newline at end of file +end