This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| 23919fa1 » | jnunemaker | 2008-03-08 | 1 | require File.dirname(__FILE__) + '/spec_helper.rb' | |
| 2 | |||||
| 3 | describe "Statwhore::Google::Analytics::Account" do | ||||
| 4 | |||||
| 5 | describe "being initialized" do | ||||
| 6 | |||||
| 7 | it "should accept :name as key" do | ||||
| 8 | a = Statwhore::Google::Analytics::Account.new(:name => 'test') | ||||
| 9 | a.name.should == 'test' | ||||
| 10 | end | ||||
| 11 | |||||
| 12 | it "should accept :account_id as key" do | ||||
| 13 | a = Statwhore::Google::Analytics::Account.new(:account_id => '12341234') | ||||
| 14 | a.account_id.should == '12341234' | ||||
| 15 | end | ||||
| 16 | |||||
| 17 | end | ||||
| 18 | |||||
| 19 | it "should be able to find all accounts for user" do | ||||
| 20 | html = open(File.dirname(__FILE__) + '/fixtures/analytics_account_find_all.html').read | ||||
| 21 | Statwhore::Google::Analytics::Account.should_receive(:get).and_return(html) | ||||
| 22 | accounts = Statwhore::Google::Analytics::Account.find_all | ||||
| 23 | accounts.collect(&:name).should == %w[alumni.nd.edu webgroup.nd.edu] | ||||
| 24 | accounts.collect(&:account_id).should == %w[1254221 344381].map(&:to_i) | ||||
| 25 | end | ||||
| 26 | |||||
| 27 | it "should be able to find profiles for an account" do | ||||
| 28 | html = open(File.dirname(__FILE__) + '/fixtures/analytics_profile_find_all.html').read | ||||
| 29 | Statwhore::Google::Analytics::Profile.should_receive(:get).and_return(html) | ||||
| 30 | accounts = Statwhore::Google::Analytics::Account.new(:name => 'alumni.nd.edu', :account_id => '1254221').profiles | ||||
| 31 | accounts.collect(&:name).should == ["pray.nd.edu"] | ||||
| 32 | end | ||||
| 33 | |||||
| 34 | it "should print kind of pretty" do | ||||
| 35 | account = Statwhore::Google::Analytics::Account.new(:name => 'alumni.nd.edu', :account_id => '1254221') | ||||
| 36 | account.to_s.should == "alumni.nd.edu (1254221)" | ||||
| 37 | end | ||||
| 38 | |||||
| 39 | end | ||||








