Sha256: c316bad9f6a6e42d10785765354840cf2ec4564e72bbdae7d1a93c816bd55c5d

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe VkontakteApi do
  describe ".configure" do
    VkontakteApi::Configuration::OPTION_NAMES.each do |name|
      it "should set the #{name}" do
        VkontakteApi.configure do |config|
          config.send("#{name}=", name)
          VkontakteApi.send(name).should == name
        end
      end
    end
    
    after(:each) do
      VkontakteApi.reset
    end
  end
  
  describe ".register_alias" do
    it "creates a VK alias" do
      VkontakteApi.register_alias
      VK.should == VkontakteApi
    end
    
    after(:each) do
      VkontakteApi.unregister_alias
    end
  end
  
  describe ".unregister_alias" do
    context "after calling .register_alias" do
      before(:each) do
        VkontakteApi.register_alias
      end
      
      it "removes the alias" do
        VkontakteApi.unregister_alias
        expect {
          VK
        }.to raise_error(NameError)
      end
    end
    
    context "without creating an alias" do
      it "does nothing" do
        Object.should_not_receive(:remove_const)
        VkontakteApi.unregister_alias
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vkontakte_api-1.1 spec/vkontakte_api_spec.rb
vkontakte_api-1.0.4 spec/vkontakte_api_spec.rb
vkontakte_api-1.0.3 spec/vkontakte_api_spec.rb
vkontakte_api-1.0.2 spec/vkontakte_api_spec.rb
vkontakte_api-1.0.1 spec/vkontakte_api_spec.rb
vkontakte_api-1.0 spec/vkontakte_api_spec.rb
vkontakte_api-1.0.rc3 spec/vkontakte_api_spec.rb