Browse files

Fix specs after timezone update.

  • Loading branch information...
1 parent 6783aaf commit 1467a240366d456671c243ca1ce1d7788dbc24f8 @precipice committed Aug 9, 2011
Showing with 21 additions and 11 deletions.
  1. +21 −11 spec/campfire_export/account_spec.rb
View
32 spec/campfire_export/account_spec.rb
@@ -8,13 +8,23 @@ module CampfireExport
@api_token = "test-apikey"
@account = Account.new(@subdomain, @api_token)
- @good_timezone = '<select id="account_time_zone_id">' +
- '<option selected="selected" value="America/Los_Angeles">' +
- '</option></select>'
+ @good_timezone = '<?xml version="1.0" encoding="UTF-8"?>' +
+ '<account>' +
+ ' <time-zone>America/Los_Angeles</time-zone>' +
+ ' <owner-id type="integer">99999</owner-id>' +
+ ' <created-at type="datetime">2010-01-31T18:30:18Z</created-at>' +
+ ' <storage type="integer">9999999</storage>' +
+ ' <plan>basic</plan>' +
+ ' <updated-at type="datetime">2010-01-31T18:31:55Z</updated-at>' +
+ ' <subdomain>example</subdomain>' +
+ ' <name>Example</name>' +
+ ' <id type="integer">999999</id>' +
+ '</account>'
+
@bad_timezone = @good_timezone.gsub('America/Los_Angeles',
'No Such Timezone')
- @timezone_html = stub("timezone HTML block")
- @timezone_html.stub(:body).and_return(@good_timezone)
+ @account_xml = stub("Account XML")
+ @account_xml.stub(:body).and_return(@good_timezone)
end
context "when it is created" do
@@ -27,23 +37,23 @@ module CampfireExport
context "when timezone is loaded" do
it "determines the user's timezone" do
- @account.should_receive(:get).with("/account/settings"
- ).and_return(@timezone_html)
+ @account.should_receive(:get).with("/account.xml"
+ ).and_return(@account_xml)
@account.find_timezone
Account.timezone.to_s.should == "America - Los Angeles"
end
it "raises an error if it gets a bad time zone identifier" do
- @timezone_html.stub(:body).and_return(@bad_timezone)
- @account.stub(:get).with("/account/settings"
- ).and_return(@timezone_html)
+ @account_xml.stub(:body).and_return(@bad_timezone)
+ @account.stub(:get).with("/account.xml"
+ ).and_return(@account_xml)
expect {
@account.find_timezone
}.to raise_error(TZInfo::InvalidTimezoneIdentifier)
end
it "raises an error if it can't get the account settings at all" do
- @account.stub(:get).with("/account/settings"
+ @account.stub(:get).with("/account.xml"
).and_raise(CampfireExport::Exception.new("/account/settings",
"Not Found", 404))
expect {

0 comments on commit 1467a24

Please sign in to comment.