Permalink
Browse files

Extract more methods out

  • Loading branch information...
1 parent c9aab53 commit bc1c720b8658617fbfefabac583a3830c0ded115 @holman holman committed Nov 2, 2011
Showing with 9 additions and 2 deletions.
  1. +8 −1 lib/play/office.rb
  2. +1 −1 test/test_office.rb
View
@@ -15,11 +15,18 @@ def self.users
users.compact
end
+ # Opens up the office URL.
+ #
+ # Returns a String.
+ def connection
+ open(url)
+ end
+
# Hits the URL that we'll use to identify users.
#
# Returns a String of users (hopefully in comma-separated format).
def self.user_string
- open(url).read
+ connection.read
rescue Exception
nil
end
View
@@ -12,7 +12,7 @@
test "user string returns a string o' user data" do
object = "lol"
object.stubs(:read).returns("holman,kneath")
- Play::Office.stubs(:open).returns(object)
+ Play::Office.stubs(:connection).returns(object)
assert_equal "holman,kneath", Play::Office.user_string
end

0 comments on commit bc1c720

Please sign in to comment.