Sha256: 9460de3dbad8612b45835bf6249fa49ab21967983b6bbf11b00d505b027782b7
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
require File.join(File.dirname(__FILE__), '..', '..', '/test_helper') module Garb class AccountTest < MiniTest::Unit::TestCase context "The Account class" do should "have an array of accounts with all profiles" do p1 = stub(:account_id => '1111', :account_name => 'Blog 1') p2 = stub(:account_id => '1112', :account_name => 'Blog 2') Profile.stubs(:all).returns(ProfileArray.new([p1,p2,p1,p2])) Account.expects(:new).with([p1,p1]).returns('account1') Account.expects(:new).with([p2,p2]).returns('account2') assert_equal ['account1','account2'], Account.all end end context "An instance of the Account class" do context "when creating a new account from an array of profiles" do setup do profile = stub(:account_id => '1111', :account_name => 'Blog 1') @profiles = [profile,profile] @account = Account.new(@profiles) end should "take the account id from the first profile" do assert_equal @profiles.first.account_id, @account.id end should "take the account name from the first profile" do assert_equal @profiles.first.account_name, @account.name end should "store the array of profiles" do assert_equal @profiles, @account.profiles end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
garb-0.5.1 | test/unit/garb/account_test.rb |
garb-0.5.0 | test/unit/garb/account_test.rb |