Sha256: 3e15ef726a0e0b73059c967105e0f84cbe4ee1487dbb95c3139e89abc975d792

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe VkontakteApi do
  describe ".configure" do
    VkontakteApi::Configuration::OPTION_NAMES.each do |name|
      it "sets 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

1 entries across 1 versions & 1 rubygems

Version Path
vkontakte_api-1.2 spec/vkontakte_api_spec.rb