Sha256: 9dc37d446b0212c36c3b2a9a5d47cfd85db906f861a4d9d19cbebe6112579f08

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

require 'test_helper'

class Giggly::Javascript::SocializeTest < Test::Unit::TestCase
  
  context "A Giggly::Javascript::Socialize instance" do
    
    setup do
      @giggly = Giggly::Javascript::Socialize.new(:api_key => 'API_KEY', :enabled_providers => %w[facebook yahoo twitter])
    end
    
    should "should have a config hash with no nil values" do
      @giggly.to_config.should == {'APIKey' => 'API_KEY', 'enabledProviders'  => 'facebook,yahoo,twitter'}
    end
    
    should "return the config as a string for javascript" do
      @giggly.config_to_js.class.should == String
      @giggly.config_to_js.should =~ /APIKey/
      @giggly.config_to_js.should =~ /enabledProviders/
    end
    
    should "return a script tag with the path to the giggly socialize js api file" do
      @giggly.include_gigya_socialize =~ /giggly-socialize-min/
    end
    
    should "allow a custom path to the giggly socialize api file" do
      @giggly.include_gigya_socialize('/somewhere') =~ /somewhere/
    end
    
    should "require the non minified giggly socialize api file if min is false" do
      @giggly.include_gigya_socialize('/javascripts', false).should_not =~ /min\.js/
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
giggly-0.1.2 test/giggly/javascript/socialize_test.rb
giggly-0.1.1 test/giggly/javascript/socialize_test.rb
giggly-0.1.0 test/giggly/javascript/socialize_test.rb