Skip to content

Commit

Permalink
Extract more methods out
Browse files Browse the repository at this point in the history
  • Loading branch information
holman committed Nov 2, 2011
1 parent c9aab53 commit bc1c720
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/play/office.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_office.rb
Expand Up @@ -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

Expand Down

0 comments on commit bc1c720

Please sign in to comment.