Sha256: e1fd641b5acbb4565e65779e33950b996ef8d81d55ccbc9102957070b57fabec

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 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)
        end
        
        expect(VkontakteApi.send(name)).to eq(name)
      end
    end
    
    after(:each) do
      VkontakteApi.reset
    end
  end
  
  describe ".register_alias" do
    before(:each) do
      VkontakteApi.register_alias
    end
    
    it "creates a VK alias" do
      expect(VK).to eq(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
        expect(Object).not_to receive(:remove_const)
        VkontakteApi.unregister_alias
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vkontakte_api-1.4.4 spec/vkontakte_api_spec.rb
vkontakte_api-1.4.3 spec/vkontakte_api_spec.rb
vkontakte_api-1.4.2 spec/vkontakte_api_spec.rb
vkontakte_api-1.4 spec/vkontakte_api_spec.rb
vkontakte_api-1.3.1 spec/vkontakte_api_spec.rb
vkontakte_api-1.3 spec/vkontakte_api_spec.rb