koala 1.2.0beta2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ module KoalaTest
3
3
 
4
4
  class << self
5
5
  attr_accessor :oauth_token, :app_id, :secret, :app_access_token, :code, :session_key
6
- attr_accessor :oauth_test_data, :subscription_test_data
6
+ attr_accessor :oauth_test_data, :subscription_test_data, :search_time
7
7
  end
8
8
 
9
9
  # Test setup
@@ -36,7 +36,7 @@ module KoalaTest
36
36
  puts "Unable to load adapter #{adapter}, using Net::HTTP."
37
37
  end
38
38
 
39
- Koala.http_service.http_options[:beta] = true if ENV["beta"]
39
+ Koala.http_service.http_options[:beta] = true if ENV["beta"] || ENV["BETA"]
40
40
 
41
41
  # use a test user unless the developer wants to test against a real profile
42
42
  unless token = KoalaTest.oauth_token
@@ -84,6 +84,9 @@ module KoalaTest
84
84
  self.secret = data["oauth_test_data"]["secret"]
85
85
  self.code = data["oauth_test_data"]["code"]
86
86
  self.session_key = data["oauth_test_data"]["session_key"]
87
+
88
+ # fix the search time so it can be used in the mock responses
89
+ self.search_time = data["search_time"] || (Time.now - 3600).to_s
87
90
  end
88
91
 
89
92
  def self.testing_permissions
@@ -97,15 +100,34 @@ module KoalaTest
97
100
  print "Setting up test users..."
98
101
  @test_user_api = Koala::Facebook::TestUsers.new(:app_id => self.app_id, :secret => self.secret)
99
102
 
100
- # create two test users with specific names and befriend them
101
- @live_testing_user = @test_user_api.create(true, testing_permissions, :name => user1_name)
102
- @live_testing_friend = @test_user_api.create(true, testing_permissions, :name => user2_name)
103
- @test_user_api.befriend(@live_testing_user, @live_testing_friend)
104
- self.oauth_token = @live_testing_user["access_token"]
103
+ RSpec.configure do |config|
104
+ config.before :all do
105
+ # before each test module, create two test users with specific names and befriend them
106
+ KoalaTest.create_test_users
107
+ end
108
+
109
+ config.after :all do
110
+ # after each test module, delete the test users to avoid cluttering up the application
111
+ KoalaTest.destroy_test_users
112
+ end
113
+ end
105
114
 
106
115
  puts "done."
107
116
  end
108
117
 
118
+ def self.create_test_users
119
+ @live_testing_user = @test_user_api.create(true, KoalaTest.testing_permissions, :name => KoalaTest.user1_name)
120
+ @live_testing_friend = @test_user_api.create(true, KoalaTest.testing_permissions, :name => KoalaTest.user2_name)
121
+ @test_user_api.befriend(@live_testing_user, @live_testing_friend)
122
+ self.oauth_token = @live_testing_user["access_token"]
123
+ end
124
+
125
+ def self.destroy_test_users
126
+ [@live_testing_user, @live_testing_friend].each do |u|
127
+ puts "Unable to delete test user #{u.inspect}" if u && !(@test_user_api.delete(u) rescue false)
128
+ end
129
+ end
130
+
109
131
  def self.validate_user_info(token)
110
132
  print "Validating permissions for live testing..."
111
133
  # make sure we have the necessary permissions
@@ -18,7 +18,8 @@ module Koala
18
18
  TEST_DATA = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'fixtures', 'facebook_data.yml'))
19
19
  TEST_DATA.merge!('oauth_token' => Koala::MockHTTPService::ACCESS_TOKEN)
20
20
  TEST_DATA['oauth_test_data'].merge!('code' => Koala::MockHTTPService::OAUTH_CODE)
21
-
21
+ TEST_DATA['search_time'] = (Time.now - 3600).to_s
22
+
22
23
  # Useful in mock_facebook_responses.yml
23
24
  OAUTH_DATA = TEST_DATA['oauth_test_data']
24
25
  OAUTH_DATA.merge!({
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koala
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0beta2
5
- prerelease: 5
4
+ version: 1.2.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alex Koppel, Chris Baclig, Rafi Jacoby, Context Optional
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-23 00:00:00.000000000Z
12
+ date: 2011-09-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &70292131094320 !ruby/object:Gem::Requirement
16
+ requirement: &70248641333480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70292131094320
24
+ version_requirements: *70248641333480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &70292131091060 !ruby/object:Gem::Requirement
27
+ requirement: &70248641333000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.7.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70292131091060
35
+ version_requirements: *70248641333000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70292131088100 !ruby/object:Gem::Requirement
38
+ requirement: &70248641332520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.5'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70292131088100
46
+ version_requirements: *70248641332520
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70292131086000 !ruby/object:Gem::Requirement
49
+ requirement: &70248641332040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.8.7
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70292131086000
57
+ version_requirements: *70248641332040
58
58
  description: Koala is a lightweight, flexible Ruby SDK for Facebook. It allows read/write
59
59
  access to the social graph via the Graph and REST APIs, as well as support for realtime
60
60
  updates and OAuth and Facebook Connect authentication. Koala is fully tested and
@@ -89,12 +89,14 @@ files:
89
89
  - lib/koala/test_users.rb
90
90
  - lib/koala/uploadable_io.rb
91
91
  - lib/koala/utils.rb
92
+ - lib/koala/version.rb
92
93
  - readme.md
93
- - spec/cases/api_base_spec.rb
94
+ - spec/cases/api_spec.rb
94
95
  - spec/cases/error_spec.rb
95
96
  - spec/cases/graph_and_rest_api_spec.rb
96
97
  - spec/cases/graph_api_batch_spec.rb
97
98
  - spec/cases/graph_api_spec.rb
99
+ - spec/cases/graph_collection_spec.rb
98
100
  - spec/cases/http_service_spec.rb
99
101
  - spec/cases/koala_spec.rb
100
102
  - spec/cases/oauth_spec.rb
@@ -133,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
135
  version: '0'
134
136
  segments:
135
137
  - 0
136
- hash: 2806885523067158352
138
+ hash: 2837078681376474267
137
139
  required_rubygems_version: !ruby/object:Gem::Requirement
138
140
  none: false
139
141
  requirements:
@@ -148,11 +150,12 @@ specification_version: 3
148
150
  summary: A lightweight, flexible library for Facebook with support for the Graph API,
149
151
  the REST API, realtime updates, and OAuth authentication.
150
152
  test_files:
151
- - spec/cases/api_base_spec.rb
153
+ - spec/cases/api_spec.rb
152
154
  - spec/cases/error_spec.rb
153
155
  - spec/cases/graph_and_rest_api_spec.rb
154
156
  - spec/cases/graph_api_batch_spec.rb
155
157
  - spec/cases/graph_api_spec.rb
158
+ - spec/cases/graph_collection_spec.rb
156
159
  - spec/cases/http_service_spec.rb
157
160
  - spec/cases/koala_spec.rb
158
161
  - spec/cases/oauth_spec.rb