simple_gravatar 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cca89c2f2ec22dac400765a53ff9f6d3ec540c4
4
- data.tar.gz: 0dd79461fa7651a1753948cd282931a645007400
3
+ metadata.gz: 4585ba18e3afd3a5813e4a9a42337154c74d1b65
4
+ data.tar.gz: beac721bbc13c0608ee927cc891f225a1a804836
5
5
  SHA512:
6
- metadata.gz: 2d2eb610618a1b8b9748419ca8cbb7daa0ea12103a6e3109af214884cb0127c643b3c0dd2e1863705dbbe28f91cb4b86bb842e2a471caf21ec93a64b1bf13d1c
7
- data.tar.gz: 7cc0b00ea8eb1ce399b442b1f5d9f2b74d6f7c44f21b364e5d001cac0ba1b618a40e416e75f4f623d52059b2f8cc3300a306c1e3b5e33ef36d22389d410a2d1e
6
+ metadata.gz: 816d9c32c82b2c9b744a5569cfb056ae23a584b131553b248f7d10710510866404b8f299b140e64d35ebe770270409c2e1708f16df1a31a41f93e4f258d960e8
7
+ data.tar.gz: 0b054a8c4b91bb2763e19bb72583dc4b58e9b1d8f61f4567f00f227ef6cc64c9bffa3f290aa9d1896150d832858b30b0dae3190606732187ece0815d3e483073
data/.travis.yml CHANGED
@@ -2,5 +2,9 @@
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.0
5
+ - 2.1.2
6
6
  - ruby-head
7
+ addons:
8
+ code_climate:
9
+ repo_token:
10
+ secure: "LjgyX7GKjP9KQsj0EM7CcBBmDwNm9oNcFlu9iED0fL2fRD6h38NmlRWhzT7J/23S9cTovYGbkoKDQat3FBZZ9eiKjVYrn7myO4AZRYU3dfJc3gvtbxBTVtw2MoCP+KAdArYqtqWGZp3GbKVec5/L+Tslf8oDnBeAoOpY0ZzbGCc="
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SimpleGravatar [![Build Status](http://img.shields.io/travis/patriciomacadden/simple_gravatar.svg)](https://travis-ci.org/patriciomacadden/simple_gravatar) [![Code Climate](http://img.shields.io/codeclimate/github/patriciomacadden/simple_gravatar.svg)](https://codeclimate.com/github/patriciomacadden/simple_gravatar) [![Coverage Status](http://img.shields.io/coveralls/patriciomacadden/simple_gravatar.svg)](https://coveralls.io/r/patriciomacadden/simple_gravatar) [![Dependency Status](http://img.shields.io/gemnasium/patriciomacadden/simple_gravatar.svg)](https://gemnasium.com/patriciomacadden/simple_gravatar) [![Gem Version](http://img.shields.io/gem/v/simple_gravatar.svg)](http://badge.fury.io/rb/simple_gravatar)
1
+ # SimpleGravatar [![Build Status](http://img.shields.io/travis/patriciomacadden/simple_gravatar.svg)](https://travis-ci.org/patriciomacadden/simple_gravatar) [![Code Climate](http://img.shields.io/codeclimate/github/patriciomacadden/simple_gravatar.svg)](https://codeclimate.com/github/patriciomacadden/simple_gravatar) [![Code Climate Coverage](http://img.shields.io/codeclimate/coverage/github/patriciomacadden/simple_gravatar.svg)](https://codeclimate.com/github/patriciomacadden/simple_gravatar) [![Dependency Status](http://img.shields.io/gemnasium/patriciomacadden/simple_gravatar.svg)](https://gemnasium.com/patriciomacadden/simple_gravatar) [![Gem Version](http://img.shields.io/gem/v/simple_gravatar.svg)](http://badge.fury.io/rb/simple_gravatar)
2
2
 
3
3
  Add gravatars to your ruby project as simple as possible.
4
4
 
data/Rakefile CHANGED
@@ -1,10 +1,9 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
 
4
- Rake::TestTask.new(:spec) do |t|
5
- t.libs << 'spec'
6
- t.pattern = 'spec/**/*_spec.rb'
4
+ Rake::TestTask.new :test do |t|
5
+ t.libs << 'test'
6
+ t.pattern = 'test/**/*_test.rb'
7
7
  end
8
8
 
9
- desc 'Run specs'
10
- task :default => :spec
9
+ task :default => :test
@@ -1,3 +1,5 @@
1
+ require 'digest'
2
+
1
3
  module SimpleGravatar
2
4
  DEFAULT_OPTIONS = {
3
5
  default: nil,
@@ -9,21 +11,20 @@ module SimpleGravatar
9
11
 
10
12
  def gravatar_url(email, options = {})
11
13
  options = DEFAULT_OPTIONS.merge options
12
- secure = options[:secure]
13
- options.delete(:secure)
14
+ secure = options.delete :secure
14
15
 
15
16
  unless options[:forcedefault]
16
- options.delete(:forcedefault)
17
+ options.delete :forcedefault
17
18
  end
18
19
 
19
20
  gravatar_id = Digest::MD5.hexdigest email.downcase
20
21
 
21
- params = options.collect { |k, v| "#{k}=#{v}" }.join('&')
22
+ params = options.collect { |k, v| "#{k}=#{v}" }.join '&'
22
23
 
23
24
  url = if secure
24
- "https://secure.gravatar.com/avatar"
25
+ 'https://secure.gravatar.com/avatar'
25
26
  else
26
- "http://gravatar.com/avatar"
27
+ 'http://gravatar.com/avatar'
27
28
  end
28
29
 
29
30
  "#{url}/#{gravatar_id}.png?#{params}"
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'simple_gravatar'
6
- s.version = '0.1.0'
6
+ s.version = '0.2.0'
7
7
  s.authors = ['Patricio Mac Adden']
8
8
  s.email = ['patriciomacadden@gmail.com']
9
9
  s.homepage = 'https://github.com/patriciomacadden/simple_gravatar'
@@ -17,8 +17,8 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ['lib']
19
19
 
20
- s.add_development_dependency 'bundler', '~> 1.5.0'
21
- s.add_development_dependency 'coveralls'
20
+ s.add_development_dependency 'bundler', '~> 1.6.0'
21
+ s.add_development_dependency 'codeclimate-test-reporter'
22
22
  s.add_development_dependency 'rake'
23
- s.add_development_dependency 'minitest'
23
+ s.add_development_dependency 'oktobertest'
24
24
  end
@@ -0,0 +1,44 @@
1
+ require 'bundler/setup'
2
+ require 'codeclimate-test-reporter'
3
+ CodeClimate::TestReporter.start
4
+ require 'oktobertest'
5
+ require 'simple_gravatar'
6
+
7
+ scope 'SimpleGravatar#gravatar_url' do
8
+ setup do
9
+ @subject = Class.new do
10
+ include SimpleGravatar
11
+ end.new
12
+ @email = 'some_email@gmail.com'
13
+ end
14
+
15
+ test 'digests the email' do
16
+ url = @subject.gravatar_url @email
17
+ assert url =~ /#{Digest::MD5.hexdigest(@email)}/
18
+ end
19
+
20
+ test 'replaces the default parameter' do
21
+ url = @subject.gravatar_url @email, default: :mm
22
+ assert url =~ /default=mm/
23
+ end
24
+
25
+ test 'replaces the forcedefault parameter' do
26
+ url = @subject.gravatar_url @email, forcedefault: true
27
+ assert url =~ /forcedefault=true/
28
+ end
29
+
30
+ test 'replaces the rating parameter' do
31
+ url = @subject.gravatar_url @email, rating: :pg
32
+ assert url =~ /rating=pg/
33
+ end
34
+
35
+ test 'replaces the secure parameter' do
36
+ url = @subject.gravatar_url @email, secure: true
37
+ assert url =~ /https:\/\/secure.gravatar.com\/avatar\//
38
+ end
39
+
40
+ test 'replaces the size parameter' do
41
+ url = @subject.gravatar_url @email, size: 64
42
+ assert url =~ /size=64/
43
+ end
44
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_gravatar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patricio Mac Adden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-13 00:00:00.000000000 Z
11
+ date: 2014-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,16 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.5.0
19
+ version: 1.6.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.5.0
26
+ version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: coveralls
28
+ name: codeclimate-test-reporter
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: minitest
56
+ name: oktobertest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -81,8 +81,7 @@ files:
81
81
  - Rakefile
82
82
  - lib/simple_gravatar.rb
83
83
  - simple_gravatar.gemspec
84
- - spec/minitest_helper.rb
85
- - spec/simple_gravatar_spec.rb
84
+ - test/simple_gravatar_test.rb
86
85
  homepage: https://github.com/patriciomacadden/simple_gravatar
87
86
  licenses: []
88
87
  metadata: {}
@@ -107,5 +106,4 @@ signing_key:
107
106
  specification_version: 4
108
107
  summary: Add gravatars to your ruby project as simple as possible.
109
108
  test_files:
110
- - spec/minitest_helper.rb
111
- - spec/simple_gravatar_spec.rb
109
+ - test/simple_gravatar_test.rb
@@ -1,8 +0,0 @@
1
- require 'bundler/setup'
2
-
3
- require 'coveralls'
4
- Coveralls.wear!
5
-
6
- require 'minitest/autorun'
7
-
8
- require 'simple_gravatar'
@@ -1,49 +0,0 @@
1
- require 'minitest_helper'
2
-
3
- include SimpleGravatar
4
-
5
- describe SimpleGravatar do
6
- describe :gravatar_url do
7
- let(:email) { 'some_email@gmail.com' }
8
-
9
- it 'should digest the email' do
10
- url = gravatar_url email
11
- url.must_match Digest::MD5.hexdigest(email)
12
- end
13
-
14
- describe 'when overriding the default parameter' do
15
- it 'should be replaced' do
16
- url = gravatar_url email, default: :mm
17
- url.must_match 'default=mm'
18
- end
19
- end
20
-
21
- describe 'when overriding the forcedefault parameter' do
22
- it 'should be replaced' do
23
- url = gravatar_url email, forcedefault: true
24
- url.must_match 'forcedefault=true'
25
- end
26
- end
27
-
28
- describe 'when overriding the rating parameter' do
29
- it 'should be replaced' do
30
- url = gravatar_url email, rating: :pg
31
- url.must_match 'rating=pg'
32
- end
33
- end
34
-
35
- describe 'when overriding the secure parameter' do
36
- it 'should be replaced' do
37
- url = gravatar_url email, secure: true
38
- url.must_match 'https://secure.gravatar.com/avatar/'
39
- end
40
- end
41
-
42
- describe 'when overriding the size parameter' do
43
- it 'should be replaced' do
44
- url = gravatar_url email, size: 64
45
- url.must_match 'size=64'
46
- end
47
- end
48
- end
49
- end