utensils 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -19,6 +19,7 @@ require 'utensils/capybara_javascript'
19
19
  require 'utensils/custom_matchers'
20
20
  require 'utensils/database_cleaner'
21
21
  require 'utensils/factory_girl'
22
+ require 'utensils/omniauth'
22
23
  require 'utensils/spring'
23
24
  require 'utensils/timecop'
24
25
  require 'utensils/upload_macros'
@@ -67,6 +68,16 @@ FactoryGirl.create(:post)
67
68
  create(:post)
68
69
  ```
69
70
 
71
+ ### omniauth
72
+
73
+ Puts ominauth in test mode and provides the following macros:
74
+
75
+ ```ruby
76
+ stub_oauth(:facebook, info: { name: 'Bob' })
77
+ stub_oauth_error(:facebook)
78
+ login(user)
79
+ ```
80
+
70
81
  ### spring
71
82
 
72
83
  Reloads factories because spring doesn't
@@ -0,0 +1,25 @@
1
+ RSpec.configure do |config|
2
+ config.before(:each) do
3
+ OmniAuth.config.test_mode = true
4
+ end
5
+ end
6
+
7
+ module OmniAuthMacros
8
+ def login(user)
9
+ auth = user.authentications.first
10
+ stub_oauth(auth.provider, uid: auth.uid)
11
+ visit logout_path
12
+ visit "/auth/#{auth.provider}"
13
+ end
14
+
15
+ def stub_oauth(provider, auth = {})
16
+ auth.reverse_merge!(uid: '123', info: { name: 'Sven', email: 'sven@example.com' })
17
+ OmniAuth.config.add_mock(provider, auth)
18
+ end
19
+
20
+ def stub_oauth_error(provider)
21
+ OmniAuth.config.mock_auth[provider] = :invalid_credentials
22
+ end
23
+ end
24
+
25
+ RSpec.configure { |config| config.include(OmniAuthMacros) }
@@ -1,3 +1,3 @@
1
1
  module Utensils
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utensils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Jens Balvig
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-06-10 00:00:00.000000000 Z
12
+ date: 2013-06-14 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: Rspec stuff we use over and over again
14
15
  email:
@@ -28,6 +29,7 @@ files:
28
29
  - lib/utensils/custom_matchers.rb
29
30
  - lib/utensils/database_cleaner.rb
30
31
  - lib/utensils/factory_girl.rb
32
+ - lib/utensils/omniauth.rb
31
33
  - lib/utensils/spring.rb
32
34
  - lib/utensils/timecop.rb
33
35
  - lib/utensils/upload_macros.rb
@@ -36,25 +38,26 @@ files:
36
38
  - utensils.gemspec
37
39
  homepage: ''
38
40
  licenses: []
39
- metadata: {}
40
41
  post_install_message:
41
42
  rdoc_options: []
42
43
  require_paths:
43
44
  - lib
44
45
  required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
45
47
  requirements:
46
- - - '>='
48
+ - - ! '>='
47
49
  - !ruby/object:Gem::Version
48
50
  version: '0'
49
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
50
53
  requirements:
51
- - - '>='
54
+ - - ! '>='
52
55
  - !ruby/object:Gem::Version
53
56
  version: '0'
54
57
  requirements: []
55
58
  rubyforge_project:
56
- rubygems_version: 2.0.2
59
+ rubygems_version: 1.8.23
57
60
  signing_key:
58
- specification_version: 4
61
+ specification_version: 3
59
62
  summary: Rspec stuff we use over and over again
60
63
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: d992bc570be75d00b266e6626a56949df128d025
4
- data.tar.gz: d7a9e52e2f3d8a9fb6afa83a3b1441fcc90dc8bd
5
- SHA512:
6
- metadata.gz: 97733876221284e9a4b780dbec2e7d6f2642da610ad501932fbf15884205ada901700dcd066f8d42b719539942127ac48675490e0e979bbe535b4b044c213760
7
- data.tar.gz: 43858243a607bfa123368af412b3f487ff3bcd1088928442c02a4fa9bd44bf401eec257e6f1b4ac1e0455ee1cc3dcae386e6e2110a809b93ebaabcdad4d77906