Sha256: 0060f0ad2c218ed6251aa234f4a04ad82227c36ee44bb1682a08f35370949672

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe ShareChecker do
  it "should be valid" do
    ShareChecker.should be_a(Module)
  end
  
  context "providers" do
    it "should return provider class" do
      ShareChecker::Providers.get("facebook").should == ShareChecker::Providers::Facebook
      ShareChecker::Providers.get("twitter").should == ShareChecker::Providers::Twitter
    end
    
    it "should return full list of avariable providers" do
      ShareChecker::Providers.avariable.should == [:facebook, :odnoklassniki, :tweetracker, :twitter, :vkontakte]
    end
  end
  
  context "setup" do
    before(:each) do
      ShareChecker.setup do |config|
        config.vkontakte = { :app_id => 123456 } 
        config.facebook = { :some_param => 'test' }
      end
    end
    
    it "should set provider options" do
      ShareChecker.provider("vkontakte", "test").app_id.should == 123456
      ShareChecker.provider("facebook", "test").some_param.should == 'test'
    end
    
    it "should overwritte default options" do
      ShareChecker.provider("vkontakte", "test", :app_id => 'new_app').app_id.should == 'new_app'
    end
    
    it "should raise error on not exists option" do
      lambda {
        ShareChecker.provider("vkontakte", "test").some_param
      }.should raise_error(StandardError)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
share_checker-0.1.5 spec/share_checker_spec.rb
share_checker-0.1.4 spec/share_checker_spec.rb
share_checker-0.1.3 spec/share_checker_spec.rb
share_checker-0.1.2 spec/share_checker_spec.rb
share_checker-0.1.1 spec/share_checker_spec.rb
share_checker-0.1.0 spec/share_checker_spec.rb