omniauth-createsend 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  .DS_Store
2
+ coverage
2
3
  rdoc
3
4
  pkg
4
5
  *.gem
5
- /.buildpath
6
- /.project
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format=progress
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.0.0
3
4
  - 1.9.3
4
5
  - 1.9.2
5
6
  - 1.8.7
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
data/Gemfile.lock CHANGED
@@ -5,8 +5,17 @@ PATH
5
5
  omniauth-oauth2 (~> 1.1)
6
6
 
7
7
  GEM
8
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
9
9
  specs:
10
+ addressable (2.3.3)
11
+ colorize (0.5.8)
12
+ coveralls (0.6.3)
13
+ colorize
14
+ multi_json (~> 1.3)
15
+ rest-client
16
+ simplecov (>= 0.7)
17
+ thor
18
+ crack (0.3.2)
10
19
  diff-lcs (1.1.3)
11
20
  faraday (0.8.5)
12
21
  multipart-post (~> 1.1)
@@ -14,6 +23,7 @@ GEM
14
23
  httpauth (0.2.0)
15
24
  jwt (0.1.5)
16
25
  multi_json (>= 1.0)
26
+ mime-types (1.21)
17
27
  multi_json (1.6.0)
18
28
  multipart-post (1.1.5)
19
29
  oauth2 (0.8.0)
@@ -29,7 +39,11 @@ GEM
29
39
  oauth2 (~> 0.8.0)
30
40
  omniauth (~> 1.0)
31
41
  rack (1.5.2)
42
+ rack-test (0.6.2)
43
+ rack (>= 1.0)
32
44
  rake (10.0.3)
45
+ rest-client (1.6.7)
46
+ mime-types (>= 1.16)
33
47
  rspec (2.12.0)
34
48
  rspec-core (~> 2.12.0)
35
49
  rspec-expectations (~> 2.12.0)
@@ -38,11 +52,23 @@ GEM
38
52
  rspec-expectations (2.12.1)
39
53
  diff-lcs (~> 1.1.3)
40
54
  rspec-mocks (2.12.2)
55
+ simplecov (0.7.1)
56
+ multi_json (~> 1.0)
57
+ simplecov-html (~> 0.7.1)
58
+ simplecov-html (0.7.1)
59
+ thor (0.18.0)
60
+ webmock (1.11.0)
61
+ addressable (>= 2.2.7)
62
+ crack (>= 0.3.2)
41
63
 
42
64
  PLATFORMS
43
65
  ruby
44
66
 
45
67
  DEPENDENCIES
68
+ coveralls
46
69
  omniauth-createsend!
70
+ rack-test
47
71
  rake
48
72
  rspec (~> 2.12)
73
+ simplecov
74
+ webmock
data/HISTORY.md ADDED
@@ -0,0 +1,9 @@
1
+ # omniauth-createsend history
2
+
3
+ ## v1.0.2 - 1 Apr, 2013 (1495a20)
4
+
5
+ * Refactored out unnecessary code and brought test coverage to 100%.
6
+
7
+ ## v1.0.1 - 24 Feb, 2013 (40ffa0a)
8
+
9
+ * Initial release ready for use in production.
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # OmniAuth CreateSend
2
- [![Build Status](https://secure.travis-ci.org/jdennes/omniauth-createsend.png)][travis] [![Dependency Status](https://gemnasium.com/jdennes/omniauth-createsend.png)][gemnasium] [![Gem Version](https://badge.fury.io/rb/omniauth-createsend.png)][gembadge]
2
+ [![Build Status](https://secure.travis-ci.org/jdennes/omniauth-createsend.png)][travis] [![Coverage Status](https://coveralls.io/repos/jdennes/omniauth-createsend/badge.png?branch=master)][coveralls] [![Dependency Status](https://gemnasium.com/jdennes/omniauth-createsend.png)][gemnasium] [![Gem Version](https://badge.fury.io/rb/omniauth-createsend.png)][gembadge]
3
3
 
4
4
  This is the official [OmniAuth](http://www.omniauth.org/) strategy for authenticating with the [Campaign Monitor API](http://www.campaignmonitor.com/api/). You'll need to register an OAuth Application in your Campaign Monitor account to get a Client ID and Client Secret to use with this OmniAuth strategy.
5
5
 
6
6
  [travis]: http://travis-ci.org/jdennes/omniauth-createsend
7
+ [coveralls]: https://coveralls.io/r/jdennes/omniauth-createsend
7
8
  [gemnasium]: https://gemnasium.com/jdennes/omniauth-createsend
8
9
  [gembadge]: http://badge.fury.io/rb/omniauth-createsend
9
10
 
@@ -39,7 +40,7 @@ Once you've authenticated, you should use the [createsend](http://campaignmonito
39
40
 
40
41
  ## Contributing
41
42
  1. Fork the repository
42
- 2. Make your changes, including tests for your changes.
43
- 3. Ensure that the build passes, by running `bundle exec rake` (CI runs on: `1.9.3`, `1.9.2`, `1.8.7` and `ree`)
43
+ 2. Make your changes, including tests for your changes which maintain [coverage][coveralls].
44
+ 3. Ensure that the build passes, by running `bundle exec rake` (CI runs on: `2.0.0`, `1.9.3`, `1.9.2`, `1.8.7`, and `ree`)
44
45
  4. It should go without saying, but do not increment the version number in your commits.
45
46
  5. Submit a pull request.
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module CreateSend
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -9,21 +9,6 @@ module OmniAuth
9
9
  :authorize_url => '/oauth',
10
10
  :token_url => '/oauth/token'
11
11
  }
12
-
13
- def request_phase
14
- super
15
- end
16
-
17
- def authorize_params
18
- super.tap do |params|
19
- %w[scope client_options].each do |v|
20
- if request.params[v]
21
- params[v.to_sym] = request.params[v]
22
- end
23
- end
24
- end
25
- end
26
-
27
12
  end
28
13
  end
29
14
  end
@@ -19,5 +19,9 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
21
21
  s.add_development_dependency 'rspec', '~> 2.12'
22
+ s.add_development_dependency 'rack-test'
23
+ s.add_development_dependency 'webmock'
22
24
  s.add_development_dependency 'rake'
25
+ s.add_development_dependency 'simplecov'
26
+ s.add_development_dependency 'coveralls'
23
27
  end
@@ -1,28 +1,56 @@
1
1
  require 'spec_helper'
2
- require 'omniauth-createsend'
3
2
 
4
3
  describe OmniAuth::Strategies::CreateSend do
5
- subject do
6
- OmniAuth::Strategies::CreateSend.new({})
4
+ def app; lambda{|env| [200, {}, ["Hello."]]} end
5
+ let(:fresh_strategy){ Class.new(OmniAuth::Strategies::CreateSend) }
6
+
7
+ before do
8
+ OmniAuth.config.test_mode = true
9
+ end
10
+
11
+ after do
12
+ OmniAuth.config.test_mode = false
7
13
  end
8
14
 
9
15
  describe '#client' do
16
+ subject{ fresh_strategy }
17
+
10
18
  it 'should have the correct createsend site' do
11
- subject.client.site.should eq("https://api.createsend.com")
19
+ instance = subject.new(app, {})
20
+ instance.client.site.should eq("https://api.createsend.com")
12
21
  end
13
22
 
14
23
  it 'should have the correct authorization url' do
15
- subject.client.options[:authorize_url].should eq("/oauth")
24
+ instance = subject.new(app, {})
25
+ instance.client.options[:authorize_url].should eq("/oauth")
16
26
  end
17
27
 
18
28
  it 'should have the correct token url' do
19
- subject.client.options[:token_url].should eq('/oauth/token')
29
+ instance = subject.new(app, {})
30
+ instance.client.options[:token_url].should eq('/oauth/token')
31
+ end
32
+ end
33
+
34
+ describe '#authorize_params' do
35
+ subject { fresh_strategy }
36
+
37
+ it 'should include the appropriate authorize params passed in the :authorize_params option' do
38
+ instance = subject.new('abc', 'def', :authorize_params => {:scope => 'ViewReports,ImportSubscribers', :something => 'else', :state => '4321'})
39
+ instance.authorize_params[:scope].should eq('ViewReports,ImportSubscribers')
40
+ end
41
+
42
+ it 'should include appropriate top-level options that are marked as :authorize_options' do
43
+ instance = subject.new('abc', 'def', :authorize_options => [:scope], :scope => 'ViewReports,ImportSubscribers', :something => 'else', :authorize_params => {:state => '4321'})
44
+ instance.authorize_params[:scope].should eq('ViewReports,ImportSubscribers')
20
45
  end
21
46
  end
22
47
 
23
48
  describe '#callback_path' do
49
+ subject{ fresh_strategy }
50
+
24
51
  it 'should have the correct callback path' do
25
- subject.callback_path.should eq('/auth/createsend/callback')
52
+ instance = subject.new(app, {})
53
+ instance.callback_path.should eq('/auth/createsend/callback')
26
54
  end
27
55
  end
28
56
  end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,23 @@
1
1
  $:.unshift File.expand_path('..', __FILE__)
2
2
  $:.unshift File.expand_path('../../lib', __FILE__)
3
+
4
+ require 'simplecov'
5
+ require 'coveralls'
6
+
7
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
8
+ SimpleCov::Formatter::HTMLFormatter,
9
+ Coveralls::SimpleCov::Formatter
10
+ ]
11
+ SimpleCov.start
12
+
3
13
  require 'rspec'
14
+ require 'rack/test'
15
+ require 'webmock/rspec'
16
+ require 'omniauth'
4
17
  require 'omniauth-createsend'
5
18
 
6
19
  RSpec.configure do |config|
20
+ config.include WebMock::API
21
+ config.include Rack::Test::Methods
22
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
7
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-createsend
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-24 00:00:00.000000000 Z
12
+ date: 2013-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth2
@@ -43,6 +43,38 @@ dependencies:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: '2.12'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rack-test
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: webmock
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
46
78
  - !ruby/object:Gem::Dependency
47
79
  name: rake
48
80
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +91,38 @@ dependencies:
59
91
  - - ! '>='
60
92
  - !ruby/object:Gem::Version
61
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: simplecov
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: coveralls
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
62
126
  description: The official OmniAuth strategy for authenticating with the Campaign Monitor
63
127
  API.
64
128
  email:
@@ -68,9 +132,11 @@ extensions: []
68
132
  extra_rdoc_files: []
69
133
  files:
70
134
  - .gitignore
135
+ - .rspec
71
136
  - .travis.yml
72
137
  - Gemfile
73
138
  - Gemfile.lock
139
+ - HISTORY.md
74
140
  - LICENSE
75
141
  - README.md
76
142
  - Rakefile
@@ -95,21 +161,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
161
  - - ! '>='
96
162
  - !ruby/object:Gem::Version
97
163
  version: '0'
98
- segments:
99
- - 0
100
- hash: 1289819948662204167
101
164
  required_rubygems_version: !ruby/object:Gem::Requirement
102
165
  none: false
103
166
  requirements:
104
167
  - - ! '>='
105
168
  - !ruby/object:Gem::Version
106
169
  version: '0'
107
- segments:
108
- - 0
109
- hash: 1289819948662204167
110
170
  requirements: []
111
171
  rubyforge_project:
112
- rubygems_version: 1.8.24
172
+ rubygems_version: 1.8.23
113
173
  signing_key:
114
174
  specification_version: 3
115
175
  summary: Official OmniAuth strategy for the Campaign Monitor API.