rack-oauth 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,9 +1,3 @@
1
- == OUT-OF-DATE
2
-
3
- I'll be releasing new documentation shortly ... everything should be *nearly* entirely backwards compatible ...
4
- if it's not, I'll document changes you need to make to use 0.2.0
5
-
6
-
7
1
  = Rack::OAuth
8
2
 
9
3
  Rack::OAuth is a Rack middleware for easily integrating OAuth into your Ruby web applications.
@@ -39,11 +33,20 @@ There are a number of defaults that can be overridden. Defaults can be viewed a
39
33
  :login => '/path_that_will_goto_oauth_providers_login',
40
34
  :redirect => '/path_to_redirect_to_after_oauth_authorization',
41
35
  :session_key => 'name_of_session_variable_to_store_oauth_user_info_in',
42
- :rack_session => 'name_of_rack_session_variable',
43
- :json_parser => lambda {|json_string| return SomeParser.parse(json_string) }
36
+ :rack_session => 'name_of_rack_session_variable'
37
+
38
+ The important thing to note is that, after you redirect to /oauth_login and the OAuth provider
39
+ redirects back to your web application at /oauth_complete, you can gain access to the user's
40
+ access token. This is what lets you make requests to Twitter and whatnot to post tweets or
41
+ merely get the user's information.
42
+
43
+ The easiest way to do this is to include the Rack::OAuth::Methods module in your ApplicationController,
44
+ if you're using Rails, or your helpers block, if you're using Sinatra or ... wherever. Once you've done
45
+ that, you can just call #get_access_token to get the access token. For example, if you want to get the
46
+ user's twitter profile information you can:
47
+
48
+ json = get_access_token.get('/account/verify_credentials.json').body
44
49
 
45
50
  === Notes
46
51
 
47
52
  Rack::OAuth was created to work with Twitter OAuth and has, thus far, only been tested using Twitter's OAuth. If this doesn't work for you for a different OAuth provider, please let me know! Or, if you patch Rack::OAuth to support another provider, please send me a pull request with the patch.
48
-
49
- Also, I haven't added any specs yet. My bad.
data/Rakefile CHANGED
@@ -15,7 +15,8 @@ begin
15
15
  s.description = 'Rack Middleware for OAuth Authorization'
16
16
  s.authors = %w( remi )
17
17
  s.files = FileList['[A-Z]*', '{lib,spec,bin,examples}/**/*']
18
- # s.add_dependency 'person-gemname'
18
+ s.add_dependency 'oauth'
19
+ s.add_dependency 'rack'
19
20
  # s.executables << 'script'
20
21
  # s.rubyforge_project = 'gemname'
21
22
  s.extra_rdoc_files = %w( README.rdoc )
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -9,4 +9,10 @@ class ApplicationController < ActionController::Base
9
9
 
10
10
  # Scrub sensitive parameters from your log
11
11
  # filter_parameter_logging :password
12
+
13
+ private
14
+
15
+ def logged_in?
16
+ get_access_token.present?
17
+ end
12
18
  end
@@ -16,10 +16,7 @@ class WelcomeController < ApplicationController
16
16
 
17
17
  # GET /oauth_complete
18
18
  def after_login
19
- if oauth_access_token
20
- session[:info] = oauth_request_with_access_token oauth_access_token, '/account/verify_credentials.json'
21
- end
22
-
19
+ session[:info] = get_access_token.get('/account/verify_credentials.json').body
23
20
  redirect_to root_path
24
21
  end
25
22
 
@@ -9,6 +9,8 @@ require File.join(File.dirname(__FILE__), 'boot')
9
9
  require File.dirname(__FILE__) + '/../../../lib/rack-oauth'
10
10
 
11
11
  Rails::Initializer.run do |config|
12
- config.middleware.use Rack::OAuth, :key => '123', :secret => '123', :site => 'http://twitter.com'
12
+ config.middleware.use Rack::OAuth, :site => 'http://twitter.com',
13
+ :key => '4JjFmhjfZyQ6rdbiql5A',
14
+ :secret => 'rv4ZaCgvxVPVjxHIDbMxTGFbIMxUa4KkIdPqL7HmaQo'
13
15
  config.time_zone = 'UTC'
14
16
  end
@@ -30,3 +30,4 @@ config.action_mailer.delivery_method = :test
30
30
  config.gem 'rspec', :lib => false
31
31
  config.gem 'rspec-rails', :lib => false
32
32
  config.gem 'webrat'
33
+ config.gem 'fakeweb'
@@ -163,3 +163,79 @@ Completed in 2ms (DB: 0) | 302 Found [http://localhost/oauth_complete]
163
163
 
164
164
  Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 16:51:07) [GET]
165
165
  Completed in 2ms (View: 0, DB: 0) | 200 OK [http://localhost/]
166
+
167
+
168
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 18:13:52) [GET]
169
+ Completed in 5ms (View: 3, DB: 0) | 200 OK [http://localhost/]
170
+
171
+
172
+ Processing WelcomeController#login (for 127.0.0.1 at 2009-11-02 18:13:55) [GET]
173
+ Redirected to http://localhost:3000/oauth_login
174
+ Completed in 2ms (DB: 0) | 302 Found [http://localhost/login]
175
+ /!\ FAILSAFE /!\ Mon Nov 02 18:13:55 -0700 2009
176
+ Status: 500 Internal Server Error
177
+ 401 Unauthorized
178
+ /usr/lib/ruby/gems/1.8/gems/oauth-0.3.5/lib/oauth/consumer.rb:199:in `token_request'
179
+ /usr/lib/ruby/gems/1.8/gems/oauth-0.3.5/lib/oauth/consumer.rb:125:in `get_request_token'
180
+ /home/remi/projects/remi/rack-oauth/examples/rails-example/config/../../../lib/rack-oauth.rb:226:in `do_login'
181
+ /home/remi/projects/remi/rack-oauth/examples/rails-example/config/../../../lib/rack-oauth.rb:211:in `call'
182
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in `call'
183
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:24:in `call'
184
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/params_parser.rb:15:in `call'
185
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/session/cookie_store.rb:93:in `call'
186
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/failsafe.rb:26:in `call'
187
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
188
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `synchronize'
189
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
190
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:114:in `call'
191
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/reloader.rb:34:in `run'
192
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:108:in `call'
193
+ /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/rack/static.rb:31:in `call'
194
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:46:in `call'
195
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in `each'
196
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in `call'
197
+ /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/rack/log_tailer.rb:17:in `call'
198
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/content_length.rb:13:in `call'
199
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/chunked.rb:15:in `call'
200
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:61:in `process'
201
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
202
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
203
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
204
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
205
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
206
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
207
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
208
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
209
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
210
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
211
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:34:in `run'
212
+ /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/server.rb:111
213
+ /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
214
+ /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
215
+ ./script/server:3
216
+
217
+
218
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 18:14:47) [GET]
219
+ Completed in 5ms (View: 2, DB: 0) | 200 OK [http://localhost/]
220
+
221
+
222
+ Processing WelcomeController#login (for 127.0.0.1 at 2009-11-02 18:14:50) [GET]
223
+ Redirected to http://localhost:3000/oauth_login
224
+ Completed in 2ms (DB: 0) | 302 Found [http://localhost/login]
225
+
226
+
227
+ Processing WelcomeController#after_login (for 127.0.0.1 at 2009-11-02 18:14:53) [GET]
228
+ Redirected to http://localhost:3000/
229
+ Completed in 7ms (DB: 0) | 302 Found [http://localhost/oauth_complete]
230
+
231
+
232
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 18:14:54) [GET]
233
+ Completed in 8ms (View: 1, DB: 0) | 200 OK [http://localhost/]
234
+
235
+
236
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 18:15:40) [GET]
237
+ Completed in 4ms (View: 1, DB: 0) | 200 OK [http://localhost/]
238
+
239
+
240
+ Processing WelcomeController#after_login (for 127.0.0.1 at 2009-11-02 18:16:25) [GET]
241
+ Completed in 3ms (View: 1, DB: 0) | 200 OK [http://localhost/oauth_complete]
@@ -1589,3 +1589,162 @@ REQUESTING PAGE: GET / with {} and HTTP headers {"HTTP_REFERER"=>"http://www.exa
1589
1589
 
1590
1590
  Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 18:10:33) [GET]
1591
1591
  Completed in 1ms (View: 0, DB: 0) | 200 OK [http://www.example.com/]
1592
+ REQUESTING PAGE: GET / with {} and HTTP headers {}
1593
+
1594
+
1595
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 20:44:50) [GET]
1596
+
1597
+ NoMethodError (undefined method `logged_in?' for #<WelcomeController:0x7f0aa3be34f8>):
1598
+ app/controllers/welcome_controller.rb:5:in `index'
1599
+ webrat (0.4.4) lib/webrat/rails.rb:70:in `send'
1600
+ webrat (0.4.4) lib/webrat/rails.rb:70:in `do_request'
1601
+ webrat (0.4.4) lib/webrat/rails.rb:35:in `get'
1602
+ webrat (0.4.4) lib/webrat/core/session.rb:104:in `send'
1603
+ webrat (0.4.4) lib/webrat/core/session.rb:104:in `request_page'
1604
+ webrat (0.4.4) lib/webrat/core/session.rb:205:in `visit'
1605
+ (eval):2:in `visit'
1606
+ /spec/integration/login_spec.rb:8
1607
+ rspec (1.2.8) lib/spec/example/example_methods.rb:40:in `instance_eval'
1608
+ rspec (1.2.8) lib/spec/example/example_methods.rb:40:in `execute'
1609
+ /usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
1610
+ rspec (1.2.8) lib/spec/example/example_methods.rb:37:in `execute'
1611
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:207:in `run_examples'
1612
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:205:in `each'
1613
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:205:in `run_examples'
1614
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:103:in `run'
1615
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:23:in `run'
1616
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:22:in `each'
1617
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:22:in `run'
1618
+ rspec (1.2.8) lib/spec/runner/options.rb:127:in `run_examples'
1619
+ rspec (1.2.8) lib/spec/runner/command_line.rb:9:in `run'
1620
+ rspec (1.2.8) bin/spec:4
1621
+ /usr/bin/spec:19:in `load'
1622
+ /usr/bin/spec:19
1623
+
1624
+ Rendered rescues/_trace (193.6ms)
1625
+ Rendered rescues/_request_and_response (1.6ms)
1626
+ Rendering rescues/layout (internal_server_error)
1627
+ REQUESTING PAGE: GET / with {} and HTTP headers {}
1628
+
1629
+
1630
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 20:45:47) [GET]
1631
+ Completed in 6ms (View: 0, DB: 0) | 200 OK [http://www.example.com/]
1632
+ REQUESTING PAGE: GET /login with {} and HTTP headers {"HTTP_REFERER"=>"/"}
1633
+
1634
+
1635
+ Processing WelcomeController#login (for 127.0.0.1 at 2009-11-02 20:45:47) [GET]
1636
+ Redirected to http://www.example.com/oauth_login
1637
+ Completed in 0ms (DB: 0) | 302 Found [http://www.example.com/login]
1638
+ REQUESTING PAGE: GET http://www.example.com/oauth_login with {} and HTTP headers {"HTTP_REFERER"=>"/login"}
1639
+ REQUESTING PAGE: GET /oauth_complete with {} and HTTP headers {"HTTP_REFERER"=>"http://www.example.com/oauth_login"}
1640
+
1641
+
1642
+ Processing WelcomeController#after_login (for 127.0.0.1 at 2009-11-02 20:45:47) [GET]
1643
+
1644
+ NameError (undefined local variable or method `oauth_access_token' for #<WelcomeController:0x7f45a7a74858>):
1645
+ app/controllers/welcome_controller.rb:19:in `after_login'
1646
+ webrat (0.4.4) lib/webrat/rails.rb:70:in `send'
1647
+ webrat (0.4.4) lib/webrat/rails.rb:70:in `do_request'
1648
+ webrat (0.4.4) lib/webrat/rails.rb:35:in `get'
1649
+ webrat (0.4.4) lib/webrat/core/session.rb:106:in `send'
1650
+ webrat (0.4.4) lib/webrat/core/session.rb:106:in `request_page'
1651
+ webrat (0.4.4) lib/webrat/core/session.rb:120:in `request_page'
1652
+ webrat (0.4.4) lib/webrat/core/session.rb:205:in `visit'
1653
+ (eval):2:in `visit'
1654
+ /spec/integration/login_spec.rb:11
1655
+ rspec (1.2.8) lib/spec/example/example_methods.rb:40:in `instance_eval'
1656
+ rspec (1.2.8) lib/spec/example/example_methods.rb:40:in `execute'
1657
+ /usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
1658
+ rspec (1.2.8) lib/spec/example/example_methods.rb:37:in `execute'
1659
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:207:in `run_examples'
1660
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:205:in `each'
1661
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:205:in `run_examples'
1662
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:103:in `run'
1663
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:23:in `run'
1664
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:22:in `each'
1665
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:22:in `run'
1666
+ rspec (1.2.8) lib/spec/runner/options.rb:127:in `run_examples'
1667
+ rspec (1.2.8) lib/spec/runner/command_line.rb:9:in `run'
1668
+ rspec (1.2.8) bin/spec:4
1669
+ /usr/bin/spec:19:in `load'
1670
+ /usr/bin/spec:19
1671
+
1672
+ Rendered rescues/_trace (118.3ms)
1673
+ Rendered rescues/_request_and_response (1.5ms)
1674
+ Rendering rescues/layout (internal_server_error)
1675
+ REQUESTING PAGE: GET / with {} and HTTP headers {}
1676
+
1677
+
1678
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 20:45:57) [GET]
1679
+ Completed in 6ms (View: 0, DB: 0) | 200 OK [http://www.example.com/]
1680
+ REQUESTING PAGE: GET /login with {} and HTTP headers {"HTTP_REFERER"=>"/"}
1681
+
1682
+
1683
+ Processing WelcomeController#login (for 127.0.0.1 at 2009-11-02 20:45:57) [GET]
1684
+ Redirected to http://www.example.com/oauth_login
1685
+ Completed in 0ms (DB: 0) | 302 Found [http://www.example.com/login]
1686
+ REQUESTING PAGE: GET http://www.example.com/oauth_login with {} and HTTP headers {"HTTP_REFERER"=>"/login"}
1687
+ REQUESTING PAGE: GET /oauth_complete with {} and HTTP headers {"HTTP_REFERER"=>"http://www.example.com/oauth_login"}
1688
+
1689
+
1690
+ Processing WelcomeController#after_login (for 127.0.0.1 at 2009-11-02 20:45:57) [GET]
1691
+
1692
+ NameError (undefined local variable or method `oauth_access_token' for #<WelcomeController:0x7f6b2af39ca0>):
1693
+ app/controllers/welcome_controller.rb:19:in `after_login'
1694
+ webrat (0.4.4) lib/webrat/rails.rb:70:in `send'
1695
+ webrat (0.4.4) lib/webrat/rails.rb:70:in `do_request'
1696
+ webrat (0.4.4) lib/webrat/rails.rb:35:in `get'
1697
+ webrat (0.4.4) lib/webrat/core/session.rb:106:in `send'
1698
+ webrat (0.4.4) lib/webrat/core/session.rb:106:in `request_page'
1699
+ webrat (0.4.4) lib/webrat/core/session.rb:120:in `request_page'
1700
+ webrat (0.4.4) lib/webrat/core/session.rb:205:in `visit'
1701
+ (eval):2:in `visit'
1702
+ /spec/integration/login_spec.rb:11
1703
+ rspec (1.2.8) lib/spec/example/example_methods.rb:40:in `instance_eval'
1704
+ rspec (1.2.8) lib/spec/example/example_methods.rb:40:in `execute'
1705
+ /usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
1706
+ rspec (1.2.8) lib/spec/example/example_methods.rb:37:in `execute'
1707
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:207:in `run_examples'
1708
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:205:in `each'
1709
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:205:in `run_examples'
1710
+ rspec (1.2.8) lib/spec/example/example_group_methods.rb:103:in `run'
1711
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:23:in `run'
1712
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:22:in `each'
1713
+ rspec (1.2.8) lib/spec/runner/example_group_runner.rb:22:in `run'
1714
+ rspec (1.2.8) lib/spec/runner/options.rb:127:in `run_examples'
1715
+ rspec (1.2.8) lib/spec/runner/command_line.rb:9:in `run'
1716
+ rspec (1.2.8) bin/spec:4
1717
+ /usr/bin/spec:19:in `load'
1718
+ /usr/bin/spec:19
1719
+
1720
+ Rendered rescues/_trace (118.2ms)
1721
+ Rendered rescues/_request_and_response (1.5ms)
1722
+ Rendering rescues/layout (internal_server_error)
1723
+ REQUESTING PAGE: GET / with {} and HTTP headers {}
1724
+
1725
+
1726
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 20:46:24) [GET]
1727
+ Completed in 5ms (View: 0, DB: 0) | 200 OK [http://www.example.com/]
1728
+ REQUESTING PAGE: GET /login with {} and HTTP headers {"HTTP_REFERER"=>"/"}
1729
+
1730
+
1731
+ Processing WelcomeController#login (for 127.0.0.1 at 2009-11-02 20:46:24) [GET]
1732
+ Redirected to http://www.example.com/oauth_login
1733
+ Completed in 0ms (DB: 0) | 302 Found [http://www.example.com/login]
1734
+ REQUESTING PAGE: GET http://www.example.com/oauth_login with {} and HTTP headers {"HTTP_REFERER"=>"/login"}
1735
+ REQUESTING PAGE: GET /oauth_complete with {} and HTTP headers {"HTTP_REFERER"=>"http://www.example.com/oauth_login"}
1736
+
1737
+
1738
+ Processing WelcomeController#after_login (for 127.0.0.1 at 2009-11-02 20:46:24) [GET]
1739
+ Redirected to http://www.example.com/
1740
+ Completed in 3ms (DB: 0) | 302 Found [http://www.example.com/oauth_complete]
1741
+ REQUESTING PAGE: GET http://www.example.com/ with {} and HTTP headers {"HTTP_REFERER"=>"/oauth_complete"}
1742
+
1743
+
1744
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 20:46:24) [GET]
1745
+ Completed in 1ms (View: 0, DB: 0) | 200 OK [http://www.example.com/]
1746
+ REQUESTING PAGE: GET / with {} and HTTP headers {"HTTP_REFERER"=>"http://www.example.com/"}
1747
+
1748
+
1749
+ Processing WelcomeController#index (for 127.0.0.1 at 2009-11-02 20:46:24) [GET]
1750
+ Completed in 1ms (View: 0, DB: 0) | 200 OK [http://www.example.com/]
@@ -4,24 +4,14 @@ Rack::OAuth.enable_test_mode
4
4
 
5
5
  describe 'Login' do
6
6
 
7
- def example_json
8
- %[{"time_zone":"Pacific Time (US & Canada)","profile_image_url":"http://a3.twimg.com/profile_images/54765389/remi-rock-on_bak_normal.png","description":"Beer goes in, Code comes out","following":false,"profile_text_color":"3E4415","status":{"source":"web","in_reply_to_user_id":64218381,"in_reply_to_status_id":5352275994,"truncated":false,"created_at":"Mon Nov 02 02:00:26 +0000 2009","favorited":false,"in_reply_to_screen_name":"benatkin","id":5352407184,"text":"@benatkin For GoldBar, they would want to tell you when you buy something because lots of people are coming in and not buying anything :/"},"profile_background_image_url":"http://s.twimg.com/a/1256928834/images/themes/theme5/bg.gif","followers_count":257,"screen_name":"remitaylor","profile_link_color":"D02B55","profile_background_tile":false,"friends_count":190,"url":"http://remi.org","created_at":"Tue Dec 11 09:13:43 +0000 2007","profile_background_color":"352726","notifications":false,"favourites_count":0,"statuses_count":1700,"profile_sidebar_fill_color":"99CC33","protected":false,"geo_enabled":false,"location":"Phoenix, AZ","name":"remitaylor","profile_sidebar_border_color":"829D5E","id":11043342,"verified":false,"utc_offset":-28800}]
9
- end
10
-
11
7
  it 'should be able to mock a twitter login and web API call' do
12
- Rack::OAuth.mock_request '/account/verify_credentials.json', example_json
13
-
14
8
  visit root_path
15
- response.should_not contain('remitaylor')
9
+ response.should_not contain('THE_REAL_SHAQ')
16
10
 
17
11
  visit login_path # should auto login
18
12
 
19
13
  visit root_path
20
- response.should contain('remitaylor')
14
+ response.should contain('THE_REAL_SHAQ')
21
15
  end
22
16
 
23
- it 'should be able to mock logging in as a different user'
24
-
25
- it "should be able to get the accesstoken for a user after they've logged in once"
26
-
27
17
  end
@@ -10,3 +10,7 @@ end
10
10
  Spec::Runner.configure do |config|
11
11
  config.include(Webrat::Matchers, :type => [:integration])
12
12
  end
13
+
14
+ FakeWeb.allow_net_connect = false
15
+
16
+ FakeWeb.register_uri :get, 'http://twitter.com/account/verify_credentials.json', :body => %{{"friends_count":190,"utc_offset":-28800,"profile_sidebar_border_color":"829D5E","status":{"in_reply_to_screen_name":null,"text":"Come on people, don't you realize that smoking isn't cool anymore? Try a healthier stimulant. Maybe one that doesn't irritate my sinuses?","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"web","truncated":false,"favorited":false,"id":5177704516,"created_at":"Mon Oct 26 17:15:10 +0000 2009"},"notifications":false,"statuses_count":1689,"time_zone":"Pacific Time (US & Canada)","verified":false,"profile_text_color":"3E4415","profile_image_url":"http://a3.twimg.com/profile_images/54765389/remi-rock-on_bak_normal.png","profile_background_image_url":"http://s.twimg.com/a/1256577591/images/themes/theme5/bg.gif","location":"Phoenix, AZ","following":false,"favourites_count":0,"profile_link_color":"D02B55","screen_name":"THE_REAL_SHAQ","geo_enabled":false,"profile_background_tile":false,"protected":false,"profile_background_color":"352726","name":"THE_REAL_SHAQ","followers_count":255,"url":"http://remi.org","id":11043342,"created_at":"Tue Dec 11 09:13:43 +0000 2007","profile_sidebar_fill_color":"99CC33","description":"Beer goes in, Code comes out"}}
@@ -0,0 +1,211 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml">
2
+ <head>
3
+ <title>Action Controller: Exception caught</title>
4
+ <style>
5
+ body { background-color: #fff; color: #333; }
6
+
7
+ body, p, ol, ul, td {
8
+ font-family: verdana, arial, helvetica, sans-serif;
9
+ font-size: 13px;
10
+ line-height: 18px;
11
+ }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px;
17
+ }
18
+
19
+ a { color: #000; }
20
+ a:visited { color: #666; }
21
+ a:hover { color: #fff; background-color:#000; }
22
+ </style>
23
+ </head>
24
+ <body>
25
+
26
+ <h1>
27
+ NoMethodError
28
+
29
+ in WelcomeController#index
30
+
31
+ </h1>
32
+ <pre>undefined method `logged_in?' for #&lt;WelcomeController:0x7f0aa3be34f8&gt;</pre>
33
+
34
+
35
+
36
+ <p><code>RAILS_ROOT: /home/remi/projects/remi/rack-oauth/examples/rails-example</code></p>
37
+
38
+ <div id="traces">
39
+
40
+
41
+ <a href="#" onclick="document.getElementById('Framework-Trace').style.display='none';document.getElementById('Full-Trace').style.display='none';document.getElementById('Application-Trace').style.display='block';; return false;">Application Trace</a> |
42
+
43
+
44
+ <a href="#" onclick="document.getElementById('Application-Trace').style.display='none';document.getElementById('Full-Trace').style.display='none';document.getElementById('Framework-Trace').style.display='block';; return false;">Framework Trace</a> |
45
+
46
+
47
+ <a href="#" onclick="document.getElementById('Application-Trace').style.display='none';document.getElementById('Framework-Trace').style.display='none';document.getElementById('Full-Trace').style.display='block';; return false;">Full Trace</a>
48
+
49
+
50
+
51
+ <div id="Application-Trace" style="display: block;">
52
+ <pre><code>/home/remi/projects/remi/rack-oauth/examples/rails-example/app/controllers/welcome_controller.rb:5:in `index'</code></pre>
53
+ </div>
54
+
55
+ <div id="Framework-Trace" style="display: none;">
56
+ <pre><code>/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in `send'
57
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in `perform_action_without_filters'
58
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:617:in `call_filters'
59
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
60
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
61
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in `ms'
62
+ /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
63
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in `ms'
64
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
65
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
66
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/flash.rb:146:in `perform_action'
67
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in `send'
68
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in `process_without_filters'
69
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:606:in `process'
70
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:391:in `process'
71
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:386:in `call'
72
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:437:in `call'
73
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:87:in `dispatch'
74
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:121:in `_call'
75
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
76
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in `call'
77
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in `call'
78
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
79
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:9:in `cache'
80
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:28:in `call'
81
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
82
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in `call'
83
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:24:in `call'
84
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/params_parser.rb:15:in `call'
85
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/session/cookie_store.rb:93:in `call'
86
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/failsafe.rb:26:in `call'
87
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
88
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `synchronize'
89
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
90
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:106:in `call'
91
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lint.rb:47:in `_call'
92
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lint.rb:35:in `call'
93
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/integration.rb:313:in `process'
94
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/integration.rb:196:in `get'
95
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/integration.rb:491:in `__send__'
96
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/integration.rb:491:in `get'
97
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/rails.rb:70:in `send'
98
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/rails.rb:70:in `do_request'
99
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/rails.rb:35:in `get'
100
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/core/session.rb:104:in `send'
101
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/core/session.rb:104:in `request_page'
102
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/core/session.rb:205:in `visit'
103
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:40:in `instance_eval'
104
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:40:in `execute'
105
+ /usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
106
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:37:in `execute'
107
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:207:in `run_examples'
108
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:205:in `each'
109
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:205:in `run_examples'
110
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:103:in `run'
111
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:23:in `run'
112
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:22:in `each'
113
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:22:in `run'
114
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/options.rb:127:in `run_examples'
115
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/command_line.rb:9:in `run'
116
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/bin/spec:4</code></pre>
117
+ </div>
118
+
119
+ <div id="Full-Trace" style="display: none;">
120
+ <pre><code>/home/remi/projects/remi/rack-oauth/examples/rails-example/app/controllers/welcome_controller.rb:5:in `index'
121
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in `send'
122
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in `perform_action_without_filters'
123
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:617:in `call_filters'
124
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
125
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
126
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in `ms'
127
+ /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
128
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in `ms'
129
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
130
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
131
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/flash.rb:146:in `perform_action'
132
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in `send'
133
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in `process_without_filters'
134
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:606:in `process'
135
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:391:in `process'
136
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:386:in `call'
137
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:437:in `call'
138
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:87:in `dispatch'
139
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:121:in `_call'
140
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
141
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in `call'
142
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in `call'
143
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
144
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:9:in `cache'
145
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:28:in `call'
146
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
147
+ ../../lib/rack-oauth.rb:186:in `call'
148
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in `call'
149
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:24:in `call'
150
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/params_parser.rb:15:in `call'
151
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/session/cookie_store.rb:93:in `call'
152
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/failsafe.rb:26:in `call'
153
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
154
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `synchronize'
155
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
156
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:106:in `call'
157
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lint.rb:47:in `_call'
158
+ /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lint.rb:35:in `call'
159
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/integration.rb:313:in `process'
160
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/integration.rb:196:in `get'
161
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/integration.rb:491:in `__send__'
162
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/integration.rb:491:in `get'
163
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/rails.rb:70:in `send'
164
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/rails.rb:70:in `do_request'
165
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/rails.rb:35:in `get'
166
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/core/session.rb:104:in `send'
167
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/core/session.rb:104:in `request_page'
168
+ /usr/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/core/session.rb:205:in `visit'
169
+ (eval):2:in `visit'
170
+ spec/integration/login_spec.rb:8
171
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:40:in `instance_eval'
172
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:40:in `execute'
173
+ /usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
174
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:37:in `execute'
175
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:207:in `run_examples'
176
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:205:in `each'
177
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:205:in `run_examples'
178
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:103:in `run'
179
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:23:in `run'
180
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:22:in `each'
181
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:22:in `run'
182
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/options.rb:127:in `run_examples'
183
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/command_line.rb:9:in `run'
184
+ /usr/lib/ruby/gems/1.8/gems/rspec-1.2.8/bin/spec:4
185
+ /usr/bin/spec:19:in `load'
186
+ /usr/bin/spec:19</code></pre>
187
+ </div>
188
+
189
+ </div>
190
+
191
+
192
+
193
+
194
+
195
+
196
+ <h2 style="margin-top: 30px">Request</h2>
197
+ <p><b>Parameters</b>: <pre>None</pre></p>
198
+
199
+ <p><a href="#" onclick="document.getElementById('session_dump').style.display='block'; return false;">Show session dump</a></p>
200
+ <div id="session_dump" style="display:none"><pre class='debug_dump'>---
201
+ </pre></div>
202
+
203
+
204
+ <h2 style="margin-top: 30px">Response</h2>
205
+ <p><b>Headers</b>: <pre>{&quot;Content-Type&quot;=&gt;&quot;&quot;,
206
+ &quot;Cache-Control&quot;=&gt;&quot;no-cache&quot;}</pre></p>
207
+
208
+
209
+
210
+ </body>
211
+ </html>