Sha256: cca6174a6e2b8cc0c2b88fb219eae771f4a938e7d60a484e12227e01ddb15f60
Contents?: true
Size: 1.59 KB
Versions: 6
Compression:
Stored size: 1.59 KB
Contents
require 'test_helper' module Garb module Management class AccountTest < MiniTest::Unit::TestCase context "The Account class" do should "turn entries for path into array of accounts" do feed = stub(:entries => ["entry1"]) Feed.stubs(:new).returns(feed) Account.stubs(:new) Account.all assert_received(Feed, :new) {|e| e.with(Session, '/accounts')} assert_received(feed, :entries) assert_received(Account, :new) {|e| e.with("entry1", Session)} end end context "an Account" do setup do entry = { "title" => "Google Analytics Account Garb", "link" => [{"rel" => "self", "href" => Feed::BASE_URL+"/accounts/123456"}], "dxp:property" => [ {"name" => "ga:accountId", "value" => "123456"}, {"name" => "ga:accountName", "value" => "Garb"} ] } @account = Account.new(entry, Session) end should "extract id and title from GA entry" do assert_equal "Garb", @account.title assert_equal "123456", @account.id end should "extract a name from GA entry properties" do assert_equal "Garb", @account.name end should "combine the Account.path and the id into an new path" do assert_equal "/accounts/123456", @account.path end should "have a reference to the session it was created with" do assert_equal Session, @account.session end should "have web properties" end end end end
Version data entries
6 entries across 6 versions & 2 rubygems