Skip to content
This repository
Browse code

Added Mechanize/VCR backed integration specs for Twitter.

  • Loading branch information...
commit 371be78f40841dcba655bc2c455aefe82362f502 1 parent d4545b1
Michael Bleigh authored July 21, 2011
1  .gitignore
@@ -54,3 +54,4 @@ test/version_tmp
54 54
 tmp
55 55
 tmtags
56 56
 tramp
  57
+/oa-oauth/spec/credentials.yml
2  oa-oauth/oa-oauth.gemspec
@@ -17,6 +17,8 @@ Gem::Specification.new do |gem|
17 17
   gem.add_development_dependency 'webmock', '~> 1.6'
18 18
   gem.add_development_dependency 'yard', '~> 0.7'
19 19
   gem.add_development_dependency 'ZenTest', '~> 4.5'
  20
+  gem.add_development_dependency 'vcr'  
  21
+  gem.add_development_dependency 'mechanize'
20 22
   gem.name = 'oa-oauth'
21 23
   gem.version = OmniAuth::Version::STRING
22 24
   gem.description = %q{OAuth strategies for OmniAuth.}
6  oa-oauth/spec/credentials_fixtured.yml
... ...
@@ -0,0 +1,6 @@
  1
+twitter:
  2
+  key: yourconsumerkey
  3
+  secret: yourconsumersecret
  4
+  username: user
  5
+  password: pass
  6
+
54  oa-oauth/spec/fixtures/vcr/twitter/invalid_client_credentials.yml
... ...
@@ -0,0 +1,54 @@
  1
+--- 
  2
+- !ruby/struct:VCR::HTTPInteraction 
  3
+  request: !ruby/struct:VCR::Request 
  4
+    method: :post
  5
+    uri: https://api.twitter.com:443/oauth/request_token
  6
+    body: 
  7
+    headers: 
  8
+      user-agent: 
  9
+      - OAuth gem v0.4.5
  10
+      content-length: 
  11
+      - "0"
  12
+      authorization: 
  13
+      - OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_callback="http%3A%2F%2Fexample.org%2Fauth%2Ftwitter%2Fcallback", oauth_consumer_key="abc", oauth_nonce="tBeClgcNnkcrZr1XePM1seukyqaYqNZBfHpw8yJlA8", oauth_signature="A7qF2IyhWdlvbBiQVhIoW3G27rA%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1311293918", oauth_version="1.0"
  14
+  response: !ruby/struct:VCR::Response 
  15
+    status: !ruby/struct:VCR::ResponseStatus 
  16
+      code: 401
  17
+      message: Unauthorized
  18
+    headers: 
  19
+      date: 
  20
+      - Fri, 22 Jul 2011 00:18:40 GMT
  21
+      server: 
  22
+      - hi
  23
+      status: 
  24
+      - 401 Unauthorized
  25
+      x-transaction: 
  26
+      - 1311293920-84191-57877
  27
+      x-frame-options: 
  28
+      - SAMEORIGIN
  29
+      last-modified: 
  30
+      - Fri, 22 Jul 2011 00:18:40 GMT
  31
+      x-runtime: 
  32
+      - "0.01710"
  33
+      content-type: 
  34
+      - text/html; charset=utf-8
  35
+      content-length: 
  36
+      - "44"
  37
+      pragma: 
  38
+      - no-cache
  39
+      x-revision: 
  40
+      - DEV
  41
+      expires: 
  42
+      - Tue, 31 Mar 1981 05:00:00 GMT
  43
+      cache-control: 
  44
+      - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
  45
+      x-mid: 
  46
+      - 70eeb361848217505a18ce2462441d090cb8889c
  47
+      set-cookie: 
  48
+      - _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCEdTNU8xAToHaWQiJTQwZmY3MDA1YWJmZTY5%250AYzk4NDQzMTBiMzgxNjA4MDEyIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy%250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--721e6f8d5c66ba6734a455f8bbdd7f68b103792a; domain=.twitter.com; path=/; HttpOnly
  49
+      - guest_id=v1%3A131129392006929906; domain=.twitter.com; path=/; expires=Sun, 21 Jul 2013 12:18:40 GMT
  50
+      - k=99.92.255.208.1311293920060531; path=/; expires=Fri, 29-Jul-11 00:18:40 GMT; domain=.twitter.com
  51
+      vary: 
  52
+      - Accept-Encoding
  53
+    body: Failed to validate oauth signature and token
  54
+    http_version: "1.1"
441  oa-oauth/spec/fixtures/vcr/twitter/valid_client_credentials.yml
... ...
@@ -0,0 +1,441 @@
  1
+--- 
  2
+- !ruby/struct:VCR::HTTPInteraction 
  3
+  request: !ruby/struct:VCR::Request 
  4
+    method: :post
  5
+    uri: https://api.twitter.com:443/oauth/request_token
  6
+    body: 
  7
+    headers: 
  8
+      user-agent: 
  9
+      - OAuth gem v0.4.5
  10
+      content-length: 
  11
+      - "0"
  12
+      authorization: 
  13
+      - OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_callback="http%3A%2F%2Fexample.org%2Fauth%2Ftwitter%2Fcallback", oauth_consumer_key="hC1wxmMhTiuZNvAOn6jb0w", oauth_nonce="2Q2AvkPoDYZRsr9ZCaAdmAixlbr2YnWLL8dyvvqs8g", oauth_signature="Rv38HdQppJxCghe7vQRLbUFQBiY%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1311293919", oauth_version="1.0"
  14
+  response: !ruby/struct:VCR::Response 
  15
+    status: !ruby/struct:VCR::ResponseStatus 
  16
+      code: 200
  17
+      message: OK
  18
+    headers: 
  19
+      date: 
  20
+      - Fri, 22 Jul 2011 00:18:40 GMT
  21
+      server: 
  22
+      - hi
  23
+      status: 
  24
+      - 200 OK
  25
+      x-transaction: 
  26
+      - 1311293920-30051-50049
  27
+      etag: 
  28
+      - "\"d467736f283b6a42da6601bd4b4f87a3\""
  29
+      x-frame-options: 
  30
+      - SAMEORIGIN
  31
+      last-modified: 
  32
+      - Fri, 22 Jul 2011 00:18:40 GMT
  33
+      x-runtime: 
  34
+      - "0.01342"
  35
+      content-type: 
  36
+      - text/html; charset=utf-8
  37
+      content-length: 
  38
+      - "146"
  39
+      pragma: 
  40
+      - no-cache
  41
+      x-revision: 
  42
+      - DEV
  43
+      expires: 
  44
+      - Tue, 31 Mar 1981 05:00:00 GMT
  45
+      cache-control: 
  46
+      - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
  47
+      x-mid: 
  48
+      - 067d40a0c0366f90a762b218bbc60a682eecb8ad
  49
+      set-cookie: 
  50
+      - _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCAFWNU8xAToHaWQiJTZmYWYwNzhlYTM0Mjhk%250ANzFjODg3MmQ4NGM3YzJmNGUwIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy%250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--53f9307023163342303b5fb89facfc01a4c54b32; domain=.twitter.com; path=/; HttpOnly
  51
+      - guest_id=v1%3A131129392076771748; domain=.twitter.com; path=/; expires=Sun, 21 Jul 2013 12:18:40 GMT
  52
+      - k=99.92.255.208.1311293920757536; path=/; expires=Fri, 29-Jul-11 00:18:40 GMT; domain=.twitter.com
  53
+      vary: 
  54
+      - Accept-Encoding
  55
+    body: oauth_token=ybiVdQsjSu2RJ5Zh0bJNpCZ9DwgwyI63tI8Fa8Nc9LE&oauth_token_secret=jXoqdInC6rIepnEddNwK1qhnTaX72nm4TuLyq4PqQ&oauth_callback_confirmed=true
  56
+    http_version: "1.1"
  57
+- !ruby/struct:VCR::HTTPInteraction 
  58
+  request: !ruby/struct:VCR::Request 
  59
+    method: :get
  60
+    uri: https://api.twitter.com:443/oauth/authorize?oauth_token=ybiVdQsjSu2RJ5Zh0bJNpCZ9DwgwyI63tI8Fa8Nc9LE
  61
+    body: 
  62
+    headers: 
  63
+      user-agent: 
  64
+      - Mechanize/2.0.1 Ruby/1.9.2p180 (http://github.com/tenderlove/mechanize/)
  65
+      accept-encoding: 
  66
+      - gzip,deflate,identity
  67
+      accept-charset: 
  68
+      - ISO-8859-1,utf-8;q=0.7,*;q=0.7
  69
+      accept-language: 
  70
+      - en-us,en;q=0.5
  71
+      host: 
  72
+      - api.twitter.com
  73
+      connection: 
  74
+      - keep-alive
  75
+      keep-alive: 
  76
+      - 300
  77
+  response: !ruby/struct:VCR::Response 
  78
+    status: !ruby/struct:VCR::ResponseStatus 
  79
+      code: 200
  80
+      message: OK
  81
+    headers: 
  82
+      date: 
  83
+      - Fri, 22 Jul 2011 00:18:41 GMT
  84
+      server: 
  85
+      - hi
  86
+      status: 
  87
+      - 200 OK
  88
+      x-transaction: 
  89
+      - 1311293921-62780-53135
  90
+      etag: 
  91
+      - "\"88f958ea33c429217f81cc138a54fe6f\"-gzip"
  92
+      x-frame-options: 
  93
+      - SAMEORIGIN
  94
+      last-modified: 
  95
+      - Fri, 22 Jul 2011 00:18:41 GMT
  96
+      x-runtime: 
  97
+      - "0.01482"
  98
+      content-type: 
  99
+      - text/html; charset=utf-8
  100
+      pragma: 
  101
+      - no-cache
  102
+      x-revision: 
  103
+      - DEV
  104
+      expires: 
  105
+      - Tue, 31 Mar 1981 05:00:00 GMT
  106
+      cache-control: 
  107
+      - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
  108
+      x-mid: 
  109
+      - 3de1ae56a89ec10aecd27211d6ed0a8ab240cebf
  110
+      set-cookie: 
  111
+      - _twitter_sess=BAh7CjoOcmV0dXJuX3RvImRodHRwczovL2FwaS50d2l0dGVyLmNvbS9vYXV0%250AaC9hdXRob3JpemU%252Fb2F1dGhfdG9rZW49eWJpVmRRc2pTdTJSSjVaaDBiSk5w%250AQ1o5RHdnd3lJNjN0SThGYThOYzlMRToPY3JlYXRlZF9hdGwrCKJXNU8xAToM%250AY3NyZl9pZCIlZGMwMjc3ZDZiZWE1YmEwMjIwODA3YTg5NTg4MDY1MTk6B2lk%250AIiU3MmUyNzUzM2NlNGFmZjhjM2JiMTM1NjdkMTUzMTQyNSIKZmxhc2hJQzon%250AQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7%250AAA%253D%253D--a988d7a83f97bc120a74e673a9bec50d1ccfaf82; domain=.twitter.com; path=/; HttpOnly
  112
+      - auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
  113
+      - guest_id=v1%3A131129392118423321; domain=.twitter.com; path=/; expires=Sun, 21 Jul 2013 12:18:41 GMT
  114
+      - k=99.92.255.208.1311293921175843; path=/; expires=Fri, 29-Jul-11 00:18:41 GMT; domain=.twitter.com
  115
+      vary: 
  116
+      - Accept-Encoding
  117
+      content-encoding: 
  118
+      - gzip
  119
+      content-length: 
  120
+      - "2697"
  121
+      keep-alive: 
  122
+      - timeout=15, max=100
  123
+    body: !binary |
  124
+      H4sIAAAAAAAAA7VZbVPcOBL+zq9QfNnMUMnYvGwILzOTIsBuSOVYLsDe7aZS
  125
+      lGzLHgXb8krymLls/vt1y/LbMBCytUcVjEeWWt2t7ufpFuMnx78cXf52fkJm
  126
+      Ok2ma2P8IAnN4onDMme6Rsh4xmiID/CYMk1JMKNSMT1xCh2Ndp3uq5nW+Yj9
  127
+      UfD5xPnP6OpwdCTSnGruJ8whgcg0y2Dd6cmEhTHrrcxoyibOnLMyF1J3Jpc8
  128
+      1LNJyOY8YCPz5YDwjGtOk5EKaMImm+7GAUnpLU+LtDME4iv5muuETS9LrjWT
  129
+      xCOHhZ4Jyf/LCM0IzfOEB6CiyMZeNdMuS3h2Q2aSRRMHzVL7nqf4hqtLnsZu
  130
+      IFKPepvbm/izvfXSy2eCZfzWC5TydFS6fpGFCXPhq0NSFnI6cVQgGfiUSJbA
  131
+      F71ImJoxBrbqRQ62a3arPTPfs455Mhp95BEZnp78U/g8YevkGRkmmpyekL31
  132
+      T9O/Qc1rzlIj+u/R9yPLQh59Go2sD60nzdrlVdUaYuKOfCEhV3lCF/uZyNgB
  133
+      +Vot9MxKKz0ToBDPdb3wYbF3BBM/EcFNLXpZuNeXXru+9jw43vq9dvv32NTf
  134
+      ur/xks/GXp1tY1+ECxIkVKmJIyjELCkl17BnVBKWkUTEMQtHotAkE4m44U28
  135
+      h3xOeAjhAJKYhPMTkBGOT7MMvjXew1lWuk9lx2/j2Wb9AvYQznRMl+JLV6lk
  136
+      omsmUkztaj5NYDijmo1M+t5qp067sUenYNum1dEER7NhrXAm9MiaxS32PLS1
  137
+      4nFW5K/tVhPjo2c0zQ/M07UWNyybLHz+a/gv9fmi2Prw7uXvsw3/3Vl+9Pve
  138
+      cRmXi9OdbX26+xPdPQv23p80ZqDgUZGTFeZcwCtS5JU5oPd02ZzOqH3sH4of
  139
+      1geSUmtklSn40z0UtMHi79a0hazTTEseMkoO81wRLUihGFmIQhIaBKLI9Gtw
  140
+      85bZtS8uz8Gpkah3t/hqxzT1eRay24mzYffctjYAiqAfJo7TkwTLHaJk8CjQ
  141
+      4SmNmfKqY+kArptnMeyNoAuk0DPMXzSWvoCnwG1Qpjevyhij6zhMrMqhrlUF
  142
+      1nCmx2zOEpFjDIZ1eodhb8qb5d1ganhHWiETZ3rYqk+uPrxfKdNMBF8o8DCT
  143
+      yp0xKW4K45eVgiHuGYDHoY/JrGdcISutlGxnjvPpVcbnIJsmBOwDnZWmWcDG
  144
+      Xj6tt4BP4xGY3EsjOCt2C2kCaC9k7OGh1GnlAXkmPg1uXofAEiz8S9kDSxfO
  145
+      9AjVSV4AxYZAILqQGQarsQtTJ4dSw6aHgb1OpMJJpVwpcDD4IUlE6VgrLq1n
  146
+      Gv8DCEuRxdOSJwnxgc59hGSBAGvG980+sLZIGrKcfgBUJJclEJkikRRplTya
  147
+      pwyYlMHJw5y1JqFxxQVjpJwJnEgigRpVZlXPJGMlyZlAf7aLcd1VHgJ2VPJz
  148
+      KSJ+Z8a5ULrRRUicamestSqYo0QLGofBAMxOIePRDW0K0py7XYA0CWcO2GCH
  149
+      YwCoykJcj0QPr2AsBz0gqvAQDDchOMmYZ/sbBzkNQ57F+4ALY57lyDamUkMp
  150
+      gB884HpRQW1dF8x4GOK3OU0KBBp/b+PHaM/3d+Bzc2fT3w53t6LdHzcAr7b3
  151
+      tsNXfrC3RXd2McF7iFnt1qpsN6m27w2t3Pe7QtebNjAOKBxxloRQ4fb4oGak
  152
+      hMXA2BURcBPUDcXZV0vxLCFGAKRrih0n1GcJHjcAhUJ+Sdm1kNcM+ABg48oO
  153
+      EQgHMwRiccG06xQqOR1JrLMlJKmjZQGHCx4RAYSApgkcNrgoiuygkJIFujMS
  154
+      iaCoKKZ6bHLXkJzx+V3VrOcVM7n58c6ET1gp1irVT91i0UJ4w5DLTsrhqRQy
  155
+      tH5u3dS+OLdPj3ZKjSm1BGNb+61vUj3+oCXtYhtod8zK611B+VhoU0DdWyBZ
  156
+      YPYse3uSKYih69bkn4wQiyJ29HUHROtgtUiK2LAUvn6hNYBpW/rZOL2vqABV
  157
+      wCH31BZtjHdcX3lGFX7KdeOXTpuV521tZSaRSieiWAKRyey5tGj/Ldln4gUQ
  158
+      Jc1u1GrB9ckaLjKyK1aydVnrM3gGJJw+QEHNwm8yEJDzN1moB+sVCRxW7jZ+
  159
+      DjlmKuCyUlgyddmoR0dmct3R1lHRzO7TRcuzdYB0ULajUNcBkYBCo2kdMjrn
  160
+      sTHYkgQ6NNJt8dqGvOa5M/0NiDKA3lqyOQB0J55otui5j2ozhORbcTFwyjdq
  161
+      fqY10JHyOmJUrypTWMxifhARVX66sGvAUTEyMKYN1EQqhXjD0q8mSJizdCNg
  162
+      KB8zlWcFninBMhI5HZplcPyDmmqhmu5noMglhJRClS6YxKsM1NCFxAOlJLBo
  163
+      kVD5gihopiDpQE2CdblMKy3q+kbNKAARwQINxqAhtOJdAiBBUiEZiIDoQKMf
  164
+      1C2XfE4DCOvz6oGcCzB5YXSCuDWOMX7qxEunsanbetMwd3vgz3ROq1Fn9S0R
  165
+      gQSGYqvUWpKJ/fzzT/Ll64F9bYZcNP36boUBSwaPLScGtUS8QAGYicgENhT5
  166
+      OvnStGwhcF8KW7j1w0nCzHdTBLm2fcddTQPfiGz6eHtj0HPHY5ui1lfKSwQN
  167
+      ZYH9ufsZEA3KRjrC9hDcGpUeN52a8kzDWL3MqZ599y6pCIsE2od7Tmy6ZFAX
  168
+      Gv7SUa8VClJqOOApXukp7/MfBZOLwQsSFZmpXIdPq9N4Ohy4dX86WHcDiMWb
  169
+      YTOpPrGnQ2yN1l0t4jhhR4g3wwG7zaEUZ+FgHQ/nK/zF3+/Y2JDMPwzz3L91
  170
+      Cc2xKF3Ej0sJ2Qe5/+zZilH3WuPDOYzgTeZwUJfgOdT/cxZ6NdE+R6Jtde6q
  171
+      gnzz/9MkZAG2Ofdq8j3e8zxyGH4uoIWp9icKyF5BqwSZCkCZIZ4ioP+ClQCJ
  172
+      sFeCgpmahslqXEk5e+OS84RRxfLOX0jPbAANQGZIpBWiUEorwyAhNs60EmZA
  173
+      hiu8cibQu0ikHp9K7+LiPYGOmUcN+UALBxEsEFsBlFSRo70ueVvE6gk5GK2v
  174
+      IXgMraZoEJNtLN45GQKlRxQxxLXNVxs1VNhrFhhswCZmNc68WZyGw4Fvg9co
  175
+      ns9gqt2SIyC8ZTyeaQTJe9EKThQ+VkzEG8Te23obH8ptZVStrSt0dytU4znZ
  176
+      aaxotCuXtPs33sc/Qrlq3nOytXefgu2MpU3hCFCdce1KF7oYABur7HPr9S6s
  177
+      WwXh5CEeLwUsh4b9ntXD2hUjNHq9ldfH+q9VgqzZZG2B0eveGrd3m3h/TN6c
  178
+      /Hx6RmIhYgzFjCYLIDNF6pveBzG1EohkGdN36i3eE0zIcGgh30Eya7wI3GSv
  179
+      06TAbi9ZJ69JSw4qcR2yT+q7n7IsXcea14gwN8vDImMKOkg2dH7YPurQ2cAB
  180
+      vzR6PCdOZdOoscnwTkyBvAaVPYMlewY/bJ+ATOst+OKsGxV6lPMtjxiVtVw0
  181
+      R43u6SLhhFxDmepeQ4bZoaFzdTja3nj16uVox2nOtIeTEA3HAqn1DDqGodMp
  182
+      k9oFq5f9SuVwcAZF/3tzZw3F3OAxK/Cfa/uEPTwZ/8N1DEw/XJp09+cB0F+5
  183
+      9iuU5jqYDZnEpIGYvnMMGLsnZ8f3RG41HzMXWwzzX8P/AWkVQatFHAAA
  184
+
  185
+    http_version: "1.1"
  186
+- !ruby/struct:VCR::HTTPInteraction 
  187
+  request: !ruby/struct:VCR::Request 
  188
+    method: :post
  189
+    uri: https://api.twitter.com:443/oauth/authorize
  190
+    body: authenticity_token=cb904f9bb6904161b3d82f840acc393d7bc92a68&oauth_token=ybiVdQsjSu2RJ5Zh0bJNpCZ9DwgwyI63tI8Fa8Nc9LE&session%5Busername_or_email%5D=user&session%5Bpassword%5D=pass
  191
+    headers: 
  192
+      user-agent: 
  193
+      - Mechanize/2.0.1 Ruby/1.9.2p180 (http://github.com/tenderlove/mechanize/)
  194
+      accept-encoding: 
  195
+      - gzip,deflate,identity
  196
+      accept-charset: 
  197
+      - ISO-8859-1,utf-8;q=0.7,*;q=0.7
  198
+      accept-language: 
  199
+      - en-us,en;q=0.5
  200
+      cookie: 
  201
+      - _twitter_sess=BAh7CjoOcmV0dXJuX3RvImRodHRwczovL2FwaS50d2l0dGVyLmNvbS9vYXV0%250AaC9hdXRob3JpemU%252Fb2F1dGhfdG9rZW49eWJpVmRRc2pTdTJSSjVaaDBiSk5w%250AQ1o5RHdnd3lJNjN0SThGYThOYzlMRToPY3JlYXRlZF9hdGwrCKJXNU8xAToM%250AY3NyZl9pZCIlZGMwMjc3ZDZiZWE1YmEwMjIwODA3YTg5NTg4MDY1MTk6B2lk%250AIiU3MmUyNzUzM2NlNGFmZjhjM2JiMTM1NjdkMTUzMTQyNSIKZmxhc2hJQzon%250AQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7%250AAA%253D%253D--a988d7a83f97bc120a74e673a9bec50d1ccfaf82; guest_id=v1%3A131129392118423321; k=99.92.255.208.1311293921175843
  202
+      host: 
  203
+      - api.twitter.com
  204
+      referer: 
  205
+      - !ruby/object:URI::HTTPS 
  206
+        fragment: 
  207
+        host: api.twitter.com
  208
+        opaque: 
  209
+        parser: 
  210
+        password: 
  211
+        path: /oauth/authorize
  212
+        port: 443
  213
+        query: oauth_token=ybiVdQsjSu2RJ5Zh0bJNpCZ9DwgwyI63tI8Fa8Nc9LE
  214
+        registry: 
  215
+        scheme: https
  216
+        user: 
  217
+      content-type: 
  218
+      - application/x-www-form-urlencoded
  219
+      content-length: 
  220
+      - "185"
  221
+      connection: 
  222
+      - keep-alive
  223
+      keep-alive: 
  224
+      - 300
  225
+  response: !ruby/struct:VCR::Response 
  226
+    status: !ruby/struct:VCR::ResponseStatus 
  227
+      code: 200
  228
+      message: OK
  229
+    headers: 
  230
+      date: 
  231
+      - Fri, 22 Jul 2011 00:18:42 GMT
  232
+      server: 
  233
+      - hi
  234
+      status: 
  235
+      - 200 OK
  236
+      x-transaction: 
  237
+      - 1311293922-23258-50879
  238
+      etag: 
  239
+      - "\"b70365fae814efed782fa421ec836d57\"-gzip"
  240
+      x-frame-options: 
  241
+      - SAMEORIGIN
  242
+      last-modified: 
  243
+      - Fri, 22 Jul 2011 00:18:42 GMT
  244
+      x-runtime: 
  245
+      - "0.02889"
  246
+      content-type: 
  247
+      - text/html; charset=utf-8
  248
+      pragma: 
  249
+      - no-cache
  250
+      x-revision: 
  251
+      - DEV
  252
+      expires: 
  253
+      - Tue, 31 Mar 1981 05:00:00 GMT
  254
+      cache-control: 
  255
+      - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
  256
+      x-mid: 
  257
+      - 9ff26a2638207e663e9681a9df5aeade35921e86
  258
+      set-cookie: 
  259
+      - _twitter_sess=BAh7DDoOcmV0dXJuX3RvImRodHRwczovL2FwaS50d2l0dGVyLmNvbS9vYXV0%250AaC9hdXRob3JpemU%252Fb2F1dGhfdG9rZW49eWJpVmRRc2pTdTJSSjVaaDBiSk5w%250AQ1o5RHdnd3lJNjN0SThGYThOYzlMRToJdXNlcmkDwn23Og9jcmVhdGVkX2F0%250AbCsIolc1TzEBOhNwYXNzd29yZF90b2tlbiItOTI3ZmJkNTZmNmY3YTU2N2Jl%250AMWQxMzAwZmVjMjBhMzk3ZGFjODVkMSIKZmxhc2hJQzonQWN0aW9uQ29udHJv%250AbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7ADoHaWQiJTcyZTI3%250ANTMzY2U0YWZmOGMzYmIxMzU2N2QxNTMxNDI1Ogxjc3JmX2lkIiVkYzAyNzdk%250ANmJlYTViYTAyMjA4MDdhODk1ODgwNjUxOQ%253D%253D--89eb139fcbb7350facaaaa1c6bede098eb0bf553; domain=.twitter.com; path=/; HttpOnly
  260
+      - auth_token=927fbd56f6f7a567be1d1300fec20a397dac85d1; domain=.twitter.com; path=/; HttpOnly
  261
+      - auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
  262
+      - original_referer=padhuUp37zigs9eJTisr5PnVtwPa2Ks3c0cI8B5QVqvWm4klT%2FT4%2Bm6Xb%2FinBKaUebM7tESJDaudvNdkRIgrMFUSb1ymQ3w25w6roizd4b35WM%2BMJcXk91iZrVym47k0; path=/
  263
+      - twid=u%3D12025282%7C17itXklqVhQJ42zvqFDr8zxTiMI%3D; domain=.twitter.com; path=/
  264
+      - twid=u%3D12025282%7C17itXklqVhQJ42zvqFDr8zxTiMI%3D; domain=.twitter.com; path=/
  265
+      - twll=l%3D1311293922; domain=.twitter.com; path=/; expires=Wed, 21 Jul 2021 12:18:42 GMT
  266
+      vary: 
  267
+      - Accept-Encoding
  268
+      content-encoding: 
  269
+      - gzip
  270
+      keep-alive: 
  271
+      - timeout=15, max=100
  272
+      transfer-encoding: 
  273
+      - chunked
  274
+    body: !binary |
  275
+      H4sIAAAAAAAAAwIAAAD//81YbXPbNhL+nl+x5UwreXoiZctx/CKpk9hy41zi
  276
+      5BonvaTT0YDkkkQMEiwAStal+e+3AEmZkh1fOtMPpw8UAGIX+/rsguPvzl6f
  277
+      Xn14M4PM5GL6aGz/QLAinXhYeNNHAOMMWWwHNMzRMIgypjSaiVeZZHDodV9l
  278
+      xpQD/KPii4n378G7p4NTmZfM8FCgB5EsDBZEdzGbYJziBmXBcpx4C47LUirT
  279
+      2bzksckmMS54hAM3OQFecMOZGOiICZzs+sMTyNkNz6u8s0Tsa/6GG4HTqyU3
  280
+      BhUE8LQymVT8PwisAFaWgkckoizGQb2zIRO8uIZMYTLxrFr6OAg0H/pmyfPU
  281
+      j2QesGB3tGt/o73HQZlJLPhNEGkdmGTph1URC/Rp6kGOMWcTT0cKyaagUNDE
  282
+      rATqDJF0NauSdDd4YwK3P2gM891g8BtPoH8xeyVDLnAHfoC+MHAxg6Od36d/
  283
+      g5hzjrlj/ffI+xsWMU9+HwxaG94JCpJTEZuOf4cnlRITu4ckxxuWlySGVGnA
  284
+      yE2Bqb0WkFdFyKLrn6Rdnht5jcVkFfL38b/0p7fV3i8vHn/MhuGLy/L049HZ
  285
+      Ml2uLg5G5uLwnB1eRkcvZz/UdAtUPOGoJqe/FufvxevEPM8uj6KPL9l5kmYf
  286
+      btjiXEY///PX5KU6f7d4Jl7v2yiqdXEW2Na91hxc9sBniLkuBVsdF7LAE/hS
  287
+      EwaOsrFRIcmsvDQt4cNs7zCGUMjoumW9zTzY5N4GUBs/FD5N9LTB81d02jx6
  288
+      8+Atz4+DFjPGoYxXEAmmNZ2QLAELEDJNMR7wAgop5DVfJ2rMF8BjimMiRkWB
  289
+      JymVvZAVBc3WBrO7GoYhUx1TjbPd9gUdIb3pmG0lRhNNLi0ymVtMqvczQcsF
  290
+      MzhwcXljvBYvxgGbkjq7jYz2d3tgK7BGrQlAWokLtuCpg5SOdFa+vfa8qFKK
  291
+      on9QaavZg3LmhJ08pYxx4DTxXnHCXxTwrF7uHkBHUNKDVtHXsKBUMqFAmPOc
  292
+      pagDwoT94dH+cETAQKirGDfzApdzhUZWUYbxXP9RMYXznBDX/1SmHpClJp4H
  293
+      NSp7e/seZFYO48ZbwuiSALbR2OK7N22UoeChVxu2qc28t7HW8bQ11CDHoto+
  294
+      Ixu1W1onTN/RXnjFClKRKAyxHW0RVeIO0cYGB6tryXHZcVHAHW6RiywUTi9x
  295
+      CVd2WCsg+AOMqGYaXqS6y+127W0z+gZGGYqyy6SeP6fnt0jB00JWJPo4kSoH
  296
+      Ftk4vdVrHcoE3Zmk2C6ltputL1zGT7ycqZQXx8OTksUxiXw8pPe8KCvTVPF5
  297
+      TdsWiozHsa0jCyYqmsYo0KCtGhtEFp9JAB5xs6rx/Sv0UXg03E+OwvCA/ncP
  298
+      dsNRfLiXHO4PWRSNjkbxkzA62mMHh+6EgOTeNkadKO5om7xkQ1QWbmo51tN7
  299
+      Dw9cHXG1ybUQ6+J3L/uaha7CnJs11lh4qRg1WVS413zfklfAuWXbc4F10z1O
  300
+      HQeV6IDSBjDZtxuKb00f3Vlthps4HMYtouWM3+bIo25iZtRArQjIyXHYtIt7
  301
+      01+ogVAY2XiGlazAVm4wEsjDmw1XnfDjcnqR2I0KQiWXNn1jibroGeo9ak6O
  302
+      DXUGTCNswOX/adMQkY7UllEkWb1tUeFFhXV6ltRmd83dGTfPbfRLpDS3BbFb
  303
+      Xta+SkzHP+U61jgBwwcyXURIrHBBFqCMjyjHrVisWHXdAcy4JcNzhETJ3Pnr
  304
+      weLUwlfQYUNY9rQzA8NCqzfIxsUt0EFJAO3X5iinY52Tt6bPSKImt2zwbDbo
  305
+      LghaW1oFZImKijZQ70ox86CkRup1Te9puEKVayvSW1T2ZmEl9OGiIKEUhXIl
  306
+      mPoHaGoRoNIkJt04bBrWUiy5EBAiaLoHYVwHNzHOoGHvw7lUkEuFxAIRrNIP
  307
+      ylYqvmDRypu+qQfwRpLKKycTlUpnGGenTrx0crftT13n123mPrEFq1e9+y9t
  308
+      QPCjwCyNUTBp/v/8Ez5/OWleuyXfqj6/i89E0vtWMO61HO19RqNIYEIHynIH
  309
+      Pq9RKZZRZQu23w5mwhVw39Udv+lD7amuE12zXDekTeu7YY4HmqGNi9GtrXQg
  310
+      JItVZbtO/xNdb2Jm2MAioOtgm0KpA4eJ9Uu64mZ/+ZRcxhVdqbyveGy6pVD3
  311
+      2Tb38Gz288UlpFKmwt5mmViRgzS0bfiDIVGHgA2AlL3Qz6nMk2n7/UYNzzpo
  312
+      7RGyt4t9nxpIIyMpduAnuFVYC9+DY2gBeblc+t5O7Z41i6XiBvtVgXRDL7Hv
  313
+      fT867bio58GPt3L8CF6t02Ctk7NlysghvVqf3pY+ve9HM+LZGI0m3o4TYcOM
  314
+      /8siTmSjVuuotOaxOHWlKMvRZsmcoNefp2iapb737ulgNHzy5PHgoFUaujT+
  315
+      nPLuTNpwuaQOo+91Uv+W4H6y90z1ey/dfYnAqfctu+23m2O6Zj242X5AOaPI
  316
+      7W9tuvvbIDN28IZW7Hea+2m/UKkxUdZHpSi3KTfvuMDG7ezy7CtRW++3t0Zb
  317
+      Jd1Hqf8CAj19dKQSAAA=
  318
+
  319
+    http_version: "1.1"
  320
+- !ruby/struct:VCR::HTTPInteraction 
  321
+  request: !ruby/struct:VCR::Request 
  322
+    method: :post
  323
+    uri: https://api.twitter.com:443/oauth/access_token
  324
+    body: 
  325
+    headers: 
  326
+      user-agent: 
  327
+      - OAuth gem v0.4.5
  328
+      content-length: 
  329
+      - "0"
  330
+      authorization: 
  331
+      - OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_consumer_key="hC1wxmMhTiuZNvAOn6jb0w", oauth_nonce="WgkLOvHCBn90mCTFoAuPhVzIKwa3JIJOqjVEeeyfgQ", oauth_signature="Kv1qc%2FrUGAaWDZG0BCTa7M2V%2F88%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1311294498", oauth_token="ybiVdQsjSu2RJ5Zh0bJNpCZ9DwgwyI63tI8Fa8Nc9LE", oauth_version="1.0"
  332
+  response: !ruby/struct:VCR::Response 
  333
+    status: !ruby/struct:VCR::ResponseStatus 
  334
+      code: 200
  335
+      message: OK
  336
+    headers: 
  337
+      date: 
  338
+      - Fri, 22 Jul 2011 00:28:19 GMT
  339
+      server: 
  340
+      - hi
  341
+      status: 
  342
+      - 200 OK
  343
+      x-transaction: 
  344
+      - 1311294499-53259-20950
  345
+      etag: 
  346
+      - "\"ebbb3a7fb6ec261a8bcc032c221c7010\""
  347
+      x-frame-options: 
  348
+      - SAMEORIGIN
  349
+      last-modified: 
  350
+      - Fri, 22 Jul 2011 00:28:19 GMT
  351
+      x-runtime: 
  352
+      - "0.03259"
  353
+      content-type: 
  354
+      - text/html; charset=utf-8
  355
+      content-length: 
  356
+      - "160"
  357
+      pragma: 
  358
+      - no-cache
  359
+      x-revision: 
  360
+      - DEV
  361
+      expires: 
  362
+      - Tue, 31 Mar 1981 05:00:00 GMT
  363
+      cache-control: 
  364
+      - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
  365
+      x-mid: 
  366
+      - 9558befb2dc066ced6cd9952ca200db77210f4fa
  367
+      set-cookie: 
  368
+      - _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCF0sPk8xAToHaWQiJWNlMGVjOGNlODNjMDMx%250AMGExNGZiNzJiNTNkY2U2ZjJmIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy%250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--85318a01a814c89c76adc3253a4274e1c69cfa2c; domain=.twitter.com; path=/; HttpOnly
  369
+      - guest_id=v1%3A13112944999319009; domain=.twitter.com; path=/; expires=Sun, 21 Jul 2013 12:28:19 GMT
  370
+      - k=99.92.255.208.1311294499924796; path=/; expires=Fri, 29-Jul-11 00:28:19 GMT; domain=.twitter.com
  371
+      vary: 
  372
+      - Accept-Encoding
  373
+    body: oauth_token=12025282-R3mNVKhhzM9ej7bT1oPmiW2dkgklolHl69c8XuGij&oauth_token_secret=Gj342hvWWxtYvkpW53oqkrt6vaTQe9Soy7TNGKmdY&user_id=12025282&screen_name=mbleigh
  374
+    http_version: "1.1"
  375
+- !ruby/struct:VCR::HTTPInteraction 
  376
+  request: !ruby/struct:VCR::Request 
  377
+    method: :get
  378
+    uri: https://api.twitter.com:443/1/account/verify_credentials.json
  379
+    body: 
  380
+    headers: 
  381
+      user-agent: 
  382
+      - OAuth gem v0.4.5
  383
+      authorization: 
  384
+      - OAuth oauth_consumer_key="hC1wxmMhTiuZNvAOn6jb0w", oauth_nonce="CEEnPFGf3mCEw2vVefYY7zA45NNa4IdStrgYDzvyc", oauth_signature="eXD0YvFRHYbDSMUA1dHIl2kwbZI%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1311294499", oauth_token="12025282-R3mNVKhhzM9ej7bT1oPmiW2dkgklolHl69c8XuGij", oauth_version="1.0"
  385
+  response: !ruby/struct:VCR::Response 
  386
+    status: !ruby/struct:VCR::ResponseStatus 
  387
+      code: 200
  388
+      message: OK
  389
+    headers: 
  390
+      date: 
  391
+      - Fri, 22 Jul 2011 00:28:20 GMT
  392
+      server: 
  393
+      - hi
  394
+      status: 
  395
+      - 200 OK
  396
+      x-transaction: 
  397
+      - 1311294500-51135-63910
  398
+      x-ratelimit-limit: 
  399
+      - "350"
  400
+      etag: 
  401
+      - "\"0c61c0f412c5d77b122bf1d6c4950f37\""
  402
+      x-frame-options: 
  403
+      - SAMEORIGIN
  404
+      last-modified: 
  405
+      - Fri, 22 Jul 2011 00:28:20 GMT
  406
+      x-ratelimit-remaining: 
  407
+      - "337"
  408
+      x-runtime: 
  409
+      - "0.02902"
  410
+      x-transaction-mask: 
  411
+      - a6183ffa5f8ca943ff1b53b5644ef1144d8bbe59
  412
+      content-type: 
  413
+      - application/json; charset=utf-8
  414
+      content-length: 
  415
+      - "2021"
  416
+      pragma: 
  417
+      - no-cache
  418
+      x-access-level: 
  419
+      - read-write
  420
+      x-ratelimit-class: 
  421
+      - api_identified
  422
+      x-revision: 
  423
+      - DEV
  424
+      expires: 
  425
+      - Tue, 31 Mar 1981 05:00:00 GMT
  426
+      cache-control: 
  427
+      - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
  428
+      x-mid: 
  429
+      - b23503fff16c776cb1c82bcfc3566bb953e70c66
  430
+      x-ratelimit-reset: 
  431
+      - "1311294792"
  432
+      set-cookie: 
  433
+      - _twitter_sess=BAh7CToPY3JlYXRlZF9hdGwrCC8vPk8xAToMY3NyZl9pZCIlMjgwNTM5MjVj%250AZWI2NDYxMTc4NTM4YzVkZTRiNWI3NzQ6B2lkIiVmOWE4Y2ZmYTZmOWEzY2Iy%250AYjZiYjEzMzNiNDc3OTU4ZCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6%250ARmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%253D%253D--07ef181de9383aecacd1cbeb46fa84f8860fa62f; domain=.twitter.com; path=/; HttpOnly
  434
+      - guest_id=v1%3A131129450064657828; domain=.twitter.com; path=/; expires=Sun, 21 Jul 2013 12:28:20 GMT
  435
+      - k=99.92.255.208.1311294500635258; path=/; expires=Fri, 29-Jul-11 00:28:20 GMT; domain=.twitter.com
  436
+      - lang=en; path=/
  437
+      - twid=u%3D12025282%7C17itXklqVhQJ42zvqFDr8zxTiMI%3D; domain=.twitter.com; path=/
  438
+      vary: 
  439
+      - Accept-Encoding
  440
+    body: "{\"time_zone\":\"Eastern Time (US & Canada)\",\"friends_count\":178,\"protected\":false,\"location\":\"Kansas City, MO\",\"is_translator\":false,\"following\":false,\"profile_use_background_image\":false,\"name\":\"Michael Bleigh\",\"follow_request_sent\":false,\"statuses_count\":2707,\"profile_background_color\":\"e6e6e6\",\"url\":\"http:\\/\\/www.mbleigh.com\\/\",\"verified\":false,\"profile_background_image_url\":\"http:\\/\\/a3.twimg.com\\/profile_background_images\\/2354439\\/twitter_bg.gif\",\"utc_offset\":-18000,\"default_profile\":false,\"profile_background_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_background_images\\/2354439\\/twitter_bg.gif\",\"favourites_count\":0,\"created_at\":\"Wed Jan 09 13:24:15 +0000 2008\",\"profile_text_color\":\"333333\",\"profile_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_images\\/1134094035\\/portrait_new_retouched_square_normal.jpg\",\"profile_image_url\":\"http:\\/\\/a3.twimg.com\\/profile_images\\/1134094035\\/portrait_new_retouched_square_normal.jpg\",\"status\":{\"in_reply_to_status_id\":null,\"created_at\":\"Thu Jul 21 22:57:37 +0000 2011\",\"geo\":null,\"in_reply_to_user_id\":null,\"favorited\":false,\"text\":\"OAuth2 v0.5.0.rc2 is out. Gettting closer to the full release! http:\\/\\/t.co\\/3mQgJtZ\",\"in_reply_to_status_id_str\":null,\"in_reply_to_screen_name\":null,\"in_reply_to_user_id_str\":null,\"place\":null,\"coordinates\":null,\"truncated\":false,\"source\":\"\\u003Ca href=\\\"http:\\/\\/itunes.apple.com\\/us\\/app\\/twitter\\/id409789998?mt=12\\\" rel=\\\"nofollow\\\"\\u003ETwitter for Mac\\u003C\\/a\\u003E\",\"id_str\":\"94179251540074496\",\"contributors\":null,\"retweeted\":false,\"retweet_count\":0,\"id\":94179251540074496},\"listed_count\":141,\"profile_sidebar_fill_color\":\"f0f0f0\",\"description\":\"Rubyist and Web Aficionado with Intridea.\",\"contributors_enabled\":false,\"lang\":\"en\",\"profile_background_tile\":false,\"followers_count\":1165,\"screen_name\":\"mbleigh\",\"id_str\":\"12025282\",\"profile_link_color\":\"105b7d\",\"id\":12025282,\"default_profile_image\":false,\"show_all_inline_media\":false,\"geo_enabled\":true,\"notifications\":false,\"profile_sidebar_border_color\":\"d9d9d9\"}"
  441
+    http_version: "1.1"
86  oa-oauth/spec/integration/twitter_integration_spec.rb
... ...
@@ -0,0 +1,86 @@
  1
+require 'spec_helper'
  2
+require 'oauth'
  3
+require 'mechanize'
  4
+
  5
+describe 'Twitter strategy integration testing' do 
  6
+  def config
  7
+    @config ||= {}
  8
+  end
  9
+
  10
+  def app
  11
+    b = Rack::Builder.new
  12
+    b.use Rack::Session::Cookie
  13
+    b.use OmniAuth::Strategies::Twitter, config[:consumer_key] || 'abc', config[:consumer_secret] || 'def'
  14
+    b.run lambda{|env| [404, {'Auth' => env['omniauth.auth']}, [(env['omniauth.auth']['user_info']['name'] rescue "Hello.")]]}
  15
+    b.to_app
  16
+  end
  17
+
  18
+  def run_request_phase
  19
+    get '/auth/twitter'
  20
+    last_response
  21
+  end
  22
+
  23
+  context 'with invalid client credentials' do
  24
+    use_vcr_cassette 'twitter/invalid_client_credentials'
  25
+
  26
+    it 'should error out' do
  27
+      lambda{ run_request_phase }.should raise_error(::OAuth::Unauthorized)
  28
+    end
  29
+  end
  30
+
  31
+  context 'with valid client credentials' do
  32
+    use_vcr_cassette 'twitter/valid_client_credentials'
  33
+
  34
+    before do
  35
+      config[:consumer_key] = TEST_CREDENTIALS['twitter']['key']
  36
+      config[:consumer_secret] = TEST_CREDENTIALS['twitter']['secret']
  37
+      @request_response = run_request_phase
  38
+    end
  39
+
  40
+    it 'should redirect to Twitter for auth' do
  41
+      @request_response.headers['Location'].should be_include('api.twitter.com/oauth')
  42
+    end
  43
+
  44
+    context 'on the authorize page' do
  45
+      let(:web){ Mechanize.new }
  46
+      let(:auth_page){ web.get @request_response.headers['Location'] }
  47
+
  48
+      it 'should provide a Twitter username prompt at the designated URL' do
  49
+        auth_page.title.should == 'Twitter / Authorize an application'
  50
+      end
  51
+
  52
+      context 'with user approval' do
  53
+        let(:auth_form){ auth_page.form_with(:id => 'oauth_form') }
  54
+        let(:approve_button){ auth_form.button_with(:id => "allow") }
  55
+        let(:approval_response) do
  56
+          username_field.value = TEST_CREDENTIALS['twitter']['username']
  57
+          password_field.value = TEST_CREDENTIALS['twitter']['password']
  58
+          auth_form.submit(approve_button)
  59
+        end
  60
+        let(:username_field){ auth_form.field_with(:name => 'session[username_or_email]') }
  61
+        let(:password_field){ auth_form.field_with(:name => 'session[password]') }
  62
+        let(:callback_url){ approval_response.meta_refresh.first.href }
  63
+
  64
+        it 'should provide a redirect back to the application' do
  65
+          callback_url.should be_include("example.org/auth/twitter/callback")
  66
+        end
  67
+        
  68
+        context 'callback phase' do
  69
+          it 'should fetch an auth hash successfully' do
  70
+            get URI.parse(callback_url).path
  71
+            last_response.body.should == "Michael Bleigh"
  72
+          end
  73
+        end
  74
+      end
  75
+    end
  76
+  end
  77
+end
  78
+
  79
+# Step 1: Run /auth/twitter and get the redirect URL
  80
+#   - Alternate: Run /auth/twitter with invalid credentials
  81
+# Step 2: Visit the redirect URL and click the "Approve" button
  82
+#   - Alternate: Click the "Deny" button
  83
+#   - Alternate: Make sure it works with /authorize instead of /authenticate
  84
+# Step 3: Grab the URL that Twitter redirects to, parse out the code
  85
+# Step 4: Call /auth/callback with the query params passed via the URL in step 3
  86
+# Step 5: Check that 
2  oa-oauth/spec/omniauth/strategies/oauth/twitter_spec.rb
@@ -5,7 +5,7 @@
5 5
 
6 6
   def app
7 7
     Rack::Builder.new {
8  
-      use OmniAuth::Test::PhonySession
  8
+      use OmniAuth::Test::PhonySession 
9 9
       use OmniAuth::Builder do
10 10
         provider :twitter, 'abc', 'def'
11 11
       end
13  oa-oauth/spec/spec_helper.rb
@@ -11,6 +11,13 @@
11 11
 require 'omniauth/oauth'
12 12
 require File.expand_path('../support/shared_examples', __FILE__)
13 13
 
  14
+VCR.config do |c|
  15
+  c.cassette_library_dir     = 'spec/fixtures/vcr'
  16
+  c.stub_with                :webmock
  17
+  c.ignore_localhost         = true
  18
+  c.default_cassette_options = { :record => :new_episodes }
  19
+end
  20
+
14 21
 RSpec.configure do |config|
15 22
   config.include WebMock::API
16 23
   config.extend VCR::RSpec::Macros
@@ -18,6 +25,12 @@
18 25
   config.extend  OmniAuth::Test::StrategyMacros, :type => :strategy
19 26
 end
20 27
 
  28
+TEST_CREDENTIALS = begin
  29
+  real = YAML.load_file(File.dirname(__FILE__) + '/credentials.yml') rescue {}
  30
+  fixture = YAML.load_file(File.dirname(__FILE__) + '/credentials_fixtured.yml') rescue {}
  31
+  fixture.merge(real)
  32
+end
  33
+
21 34
 def strategy_class
22 35
   meta = self.class.metadata
23 36
   while meta.key?(:example_group)

0 notes on commit 371be78

Please sign in to comment.
Something went wrong with that request. Please try again.