gravaty 10.0.0 → 11.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/Gemfile +5 -1
- data/README.md +219 -212
- data/Rakefile +9 -3
- data/copyright.md +33 -136
- data/examples/avatar.rb +70 -43
- data/examples/basics.rb +30 -20
- data/examples/profile.rb +77 -50
- data/examples/xmlrpc.rb +24 -10
- data/gravaty.gemspec +46 -25
- data/html/CHANGELOG.html +13 -20
- data/html/COPYING_md.html +8 -24
- data/html/Gemfile.html +7 -21
- data/html/Gravaty.html +49 -113
- data/html/Gravaty/Gravaty.html +138 -343
- data/html/Gravaty/ParsableDuckType.html +14 -33
- data/html/Gravaty/Parser.html +27 -66
- data/html/Gravaty/Parsers.html +3 -11
- data/html/Gravaty/Parsers/Avatar.html +19 -36
- data/html/Gravaty/Parsers/Callback.html +21 -37
- data/html/Gravaty/Parsers/Default.html +28 -45
- data/html/Gravaty/Parsers/Force.html +21 -37
- data/html/Gravaty/Parsers/Format.html +22 -42
- data/html/Gravaty/Parsers/Pixelsize.html +22 -42
- data/html/Gravaty/Parsers/Rating.html +22 -42
- data/html/Gravaty/Parsers/Secure.html +19 -36
- data/html/Gravaty/Parsers/Type.html +22 -42
- data/html/Gravaty/Utils.html +11 -13
- data/html/Gravaty/Utils/Downloader.html +3 -11
- data/html/Gravaty/Utils/Downloader/Downloader.html +25 -59
- data/html/Gravaty/Utils/Raisers.html +24 -55
- data/html/Gravaty/Utils/Rfc5322.html +12 -19
- data/html/Gravaty/Utils/RpcConnector.html +11 -13
- data/html/Gravaty/Utils/RpcConnector/RpcConnector.html +33 -73
- data/html/Object.html +728 -57
- data/html/README_md.html +105 -100
- data/html/Rakefile.html +9 -23
- data/html/copyright_md.html +17 -119
- data/html/created.rid +48 -55
- data/html/css/rdoc.css +1 -1
- data/html/index.html +97 -114
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +219 -651
- data/lib/gravaty.rb +22 -15
- data/lib/gravaty/application.rb +40 -25
- data/lib/gravaty/constants.rb +20 -11
- data/lib/gravaty/locales/en.yml +9 -3
- data/lib/gravaty/locales/it.yml +9 -3
- data/lib/gravaty/locales/ja.yml +7 -4
- data/lib/gravaty/parser.rb +16 -10
- data/lib/gravaty/parsers/avatar.rb +11 -3
- data/lib/gravaty/parsers/callback.rb +13 -4
- data/lib/gravaty/parsers/default.rb +24 -16
- data/lib/gravaty/parsers/force.rb +12 -2
- data/lib/gravaty/parsers/format.rb +11 -2
- data/lib/gravaty/parsers/pixelsize.rb +12 -3
- data/lib/gravaty/parsers/rating.rb +12 -3
- data/lib/gravaty/parsers/secure.rb +11 -2
- data/lib/gravaty/parsers/type.rb +11 -2
- data/lib/gravaty/utils/downloader.rb +98 -96
- data/lib/gravaty/utils/raisers.rb +19 -12
- data/lib/gravaty/utils/rfc5322.rb +54 -41
- data/lib/gravaty/utils/rpc_connector.rb +19 -11
- data/lib/gravaty/version.rb +10 -2
- data/test/gravaty/locales/en.yml +29 -0
- data/test/gravaty/locales/it.yml +29 -0
- data/test/gravaty/locales/ja.yml +27 -0
- data/test/gravaty/locales/test_locales.rb +17 -13
- data/test/gravaty/parsers/test_avatar.rb +9 -1
- data/test/gravaty/parsers/test_callback.rb +12 -4
- data/test/gravaty/parsers/test_default.rb +25 -21
- data/test/gravaty/parsers/test_force.rb +9 -1
- data/test/gravaty/parsers/test_format.rb +18 -11
- data/test/gravaty/parsers/test_pixelsize.rb +19 -12
- data/test/gravaty/parsers/test_rating.rb +18 -11
- data/test/gravaty/parsers/test_secure.rb +9 -1
- data/test/gravaty/parsers/test_type.rb +14 -5
- data/test/gravaty/test_application.rb +14 -6
- data/test/gravaty/test_avatar.rb +94 -59
- data/test/gravaty/test_parser.rb +11 -5
- data/test/gravaty/test_profile.rb +47 -25
- data/test/gravaty/utils/test_downloader.rb +43 -28
- data/test/gravaty/utils/test_raisers.rb +42 -26
- data/test/gravaty/utils/test_rfc5322.rb +35 -13
- data/test/gravaty/utils/test_rpc_connector.rb +83 -39
- data/test/test_gravaty.rb +12 -4
- data/test/test_helper.rb +15 -9
- metadata +54 -40
- data/ISSUES.md +0 -62
- data/acknowledgements.md +0 -66
- data/authors.md +0 -63
- data/examples/cacert.pem +0 -3466
- data/html/ISSUES_md.html +0 -166
- data/html/acknowledgements_md.html +0 -161
- data/html/authors_md.html +0 -174
- data/html/examples/cacert_pem.html +0 -1078
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../../test_helper'
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../../test_helper'
|
@@ -30,9 +38,9 @@ describe Gravaty::Gravaty do
|
|
30
38
|
|
31
39
|
subject { Gravaty::Parsers::Callback.new }
|
32
40
|
|
33
|
-
%w
|
34
|
-
[[nil, ''], ['', ''], %W
|
35
|
-
|
41
|
+
%w[test sample_callback].each do |value|
|
42
|
+
[[nil, ''], ['', ''], %W[#{value} callback=#{value}]]
|
43
|
+
.each do |pair|
|
36
44
|
it "shall return '#{pair[1]}' when parameter is '#{pair[0]}'" do
|
37
45
|
_(subject.parse(pair[0])).must_equal pair[1]
|
38
46
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require 'cgi'
|
@@ -28,15 +36,16 @@ describe Gravaty::Gravaty do
|
|
28
36
|
|
29
37
|
before do
|
30
38
|
I18n.load_path = Dir[File.join(
|
31
|
-
|
32
|
-
|
39
|
+
File.dirname(__FILE__),
|
40
|
+
'/../../../lib/gravaty/locales/', '*.yml'
|
41
|
+
)]
|
33
42
|
@parser = subject
|
34
43
|
end
|
35
44
|
|
36
45
|
subject { Gravaty::Parsers::Default.new }
|
37
46
|
|
38
47
|
Gravaty::DEFAULT_OPTIONS.each do |value|
|
39
|
-
[[nil, ''], ['', ''], %W
|
48
|
+
[[nil, ''], ['', ''], %W[#{value} d=#{value}]].each do |pair|
|
40
49
|
it "shall return '#{pair[1]}' when parameter is '#{pair[0]}'" do
|
41
50
|
_(subject.parse(pair[0])).must_equal pair[1]
|
42
51
|
end
|
@@ -45,7 +54,7 @@ describe Gravaty::Gravaty do
|
|
45
54
|
|
46
55
|
Gravaty::IMAGES_FORMATS.each do |extension|
|
47
56
|
value = "http://www.example.com/images/example.#{extension}"
|
48
|
-
escaped = "d=#{CGI
|
57
|
+
escaped = "d=#{CGI.escape(value)}"
|
49
58
|
|
50
59
|
it "shall return '#{escaped}' when parameter is '#{value}'" do
|
51
60
|
_(subject.parse(value)).must_equal escaped
|
@@ -54,26 +63,21 @@ describe Gravaty::Gravaty do
|
|
54
63
|
|
55
64
|
describe 'with invalid default URI image URI' do
|
56
65
|
it 'shall raise exception' do
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
_(aErr.message).wont_be_empty
|
64
|
-
end
|
66
|
+
subject.parse('http://www.example.com/images/example.svg')
|
67
|
+
.must_raise ArgumentError
|
68
|
+
rescue ArgumentError => e
|
69
|
+
_(e).wont_be_nil
|
70
|
+
_(e.message).wont_be_nil
|
71
|
+
_(e.message).wont_be_empty
|
65
72
|
end
|
66
73
|
|
67
74
|
it 'shall raise exception' do
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
_(aErr.message).wont_be_empty
|
74
|
-
end
|
75
|
+
subject.parse('svg').must_raise ArgumentError
|
76
|
+
rescue ArgumentError => e
|
77
|
+
_(e).wont_be_nil
|
78
|
+
_(e.message).wont_be_nil
|
79
|
+
_(e.message).wont_be_empty
|
75
80
|
end
|
76
81
|
end
|
77
|
-
|
78
82
|
end
|
79
83
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../../test_helper'
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../../test_helper'
|
@@ -26,15 +34,16 @@ describe Gravaty::Gravaty do
|
|
26
34
|
|
27
35
|
before do
|
28
36
|
I18n.load_path = Dir[File.join(
|
29
|
-
|
30
|
-
|
37
|
+
File.dirname(__FILE__),
|
38
|
+
'/../../../lib/gravaty/locales/', '*.yml'
|
39
|
+
)]
|
31
40
|
@parser = subject
|
32
41
|
end
|
33
42
|
|
34
43
|
subject { Gravaty::Parsers::Format.new }
|
35
44
|
|
36
45
|
Gravaty::PROFILE_FORMATS.each do |value|
|
37
|
-
[[nil, ''], %W
|
46
|
+
[[nil, ''], %W[#{value} .#{value.downcase}]].each do |pair|
|
38
47
|
it "shall return '#{pair[1]}' when parameter is '#{pair[0]}'" do
|
39
48
|
_(subject.parse(pair[0])).must_equal pair[1]
|
40
49
|
end
|
@@ -42,13 +51,11 @@ describe Gravaty::Gravaty do
|
|
42
51
|
end
|
43
52
|
|
44
53
|
it 'shall raise exception with invalid default image extension' do
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
_(aErr.message).wont_be_empty
|
51
|
-
end
|
54
|
+
subject.parse('svg').must_raise ArgumentError
|
55
|
+
rescue ArgumentError => e
|
56
|
+
_(e).wont_be_nil
|
57
|
+
_(e.message).wont_be_nil
|
58
|
+
_(e.message).wont_be_empty
|
52
59
|
end
|
53
60
|
end
|
54
61
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../../test_helper'
|
@@ -26,8 +34,9 @@ describe Gravaty::Gravaty do
|
|
26
34
|
|
27
35
|
before do
|
28
36
|
I18n.load_path = Dir[File.join(
|
29
|
-
|
30
|
-
|
37
|
+
File.dirname(__FILE__),
|
38
|
+
'/../../../lib/gravaty/locales/', '*.yml'
|
39
|
+
)]
|
31
40
|
@parser = subject
|
32
41
|
end
|
33
42
|
|
@@ -38,19 +47,17 @@ describe Gravaty::Gravaty do
|
|
38
47
|
end
|
39
48
|
|
40
49
|
Gravaty::ALLOWED_SIZES.each do |value|
|
41
|
-
it "shall return s='#{value
|
42
|
-
_(subject.parse(value)).must_equal "s=#{value
|
50
|
+
it "shall return s='#{value}' when parameter is '#{value}'" do
|
51
|
+
_(subject.parse(value)).must_equal "s=#{value}"
|
43
52
|
end
|
44
53
|
end
|
45
54
|
|
46
55
|
it 'shall raise an exception when provided with invalid rating' do
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
_(aErr.message).wont_be_empty
|
53
|
-
end
|
56
|
+
subject.parse(0).must_raise ArgumentError
|
57
|
+
rescue ArgumentError => e
|
58
|
+
_(e).wont_be_nil
|
59
|
+
_(e.message).wont_be_nil
|
60
|
+
_(e.message).wont_be_empty
|
54
61
|
end
|
55
62
|
end
|
56
63
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../../test_helper'
|
@@ -26,15 +34,16 @@ describe Gravaty::Gravaty do
|
|
26
34
|
|
27
35
|
before do
|
28
36
|
I18n.load_path = Dir[File.join(
|
29
|
-
|
30
|
-
|
37
|
+
File.dirname(__FILE__),
|
38
|
+
'/../../../lib/gravaty/locales/', '*.yml'
|
39
|
+
)]
|
31
40
|
@parser = subject
|
32
41
|
end
|
33
42
|
|
34
43
|
subject { Gravaty::Parsers::Rating.new }
|
35
44
|
|
36
45
|
Gravaty::RATING_OPTIONS.each do |value|
|
37
|
-
[[nil, ''], %W
|
46
|
+
[[nil, ''], %W[#{value} rating=#{value.downcase}]].each do |pair|
|
38
47
|
it "shall return '#{pair[1]}' when parameter is '#{pair[0]}'" do
|
39
48
|
_(subject.parse(pair[0])).must_equal pair[1]
|
40
49
|
end
|
@@ -42,13 +51,11 @@ describe Gravaty::Gravaty do
|
|
42
51
|
end
|
43
52
|
|
44
53
|
it 'shall raise an exception when provided with invalid rating' do
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
_(aErr.message).wont_be_empty
|
51
|
-
end
|
54
|
+
subject.parse('xxx').must_raise ArgumentError
|
55
|
+
rescue ArgumentError => e
|
56
|
+
_(e).wont_be_nil
|
57
|
+
_(e.message).wont_be_nil
|
58
|
+
_(e.message).wont_be_empty
|
52
59
|
end
|
53
60
|
end
|
54
61
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../../test_helper'
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,6 +20,10 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../../test_helper'
|
@@ -26,15 +34,16 @@ describe Gravaty::Gravaty do
|
|
26
34
|
|
27
35
|
before do
|
28
36
|
I18n.load_path = Dir[File.join(
|
29
|
-
|
30
|
-
|
31
|
-
|
37
|
+
File.dirname(__FILE__),
|
38
|
+
'/../../../lib/gravaty/locales/',
|
39
|
+
'*.yml'
|
40
|
+
)]
|
32
41
|
end
|
33
42
|
|
34
43
|
subject { Gravaty::Parsers::Type.new }
|
35
44
|
|
36
45
|
Gravaty::AVATAR_FORMATS.each do |value|
|
37
|
-
[[nil, ''], %W
|
46
|
+
[[nil, ''], %W[#{value} .#{value.downcase}]].each do |pair|
|
38
47
|
it "shall return '#{pair[1]}' when parameter is '#{pair[0]}'" do
|
39
48
|
_(subject.parse(pair[0])).must_equal pair[1]
|
40
49
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
4
|
# gravaty
|
3
|
-
#
|
5
|
+
# rubocop:disable Style/AsciiComments
|
6
|
+
# © 2013 Marco Bresciani
|
7
|
+
# rubocop:enable Style/AsciiComments
|
4
8
|
#
|
5
9
|
# This file is part of gravaty.
|
6
10
|
#
|
@@ -16,15 +20,20 @@
|
|
16
20
|
#
|
17
21
|
# You should have received a copy of the GNU General Public License
|
18
22
|
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
#
|
24
|
+
# SPDX-FileCopyrightText: 2013 Marco Bresciani
|
25
|
+
#
|
26
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
19
27
|
#++
|
20
28
|
|
21
29
|
require_relative '../test_helper'
|
22
30
|
|
23
31
|
describe Gravaty::Gravaty do
|
24
32
|
describe 'when created with a valid email address' do
|
25
|
-
|
26
|
-
|
27
|
-
|
33
|
+
subject do
|
34
|
+
Gravaty::Gravaty.new(Gravaty::TEST_MY_ADDRESS,
|
35
|
+
Gravaty.parser)
|
36
|
+
end
|
28
37
|
|
29
38
|
it 'shall return the email content on demand' do
|
30
39
|
_(subject.email).must_equal Gravaty::TEST_MY_ADDRESS.downcase
|
@@ -43,7 +52,7 @@ describe Gravaty::Gravaty do
|
|
43
52
|
_(JSON.parse(subject.to_json)).wont_be_nil
|
44
53
|
end
|
45
54
|
|
46
|
-
[
|
55
|
+
%i[avatar profile].each do |method|
|
47
56
|
describe "when asked for '#{method}'" do
|
48
57
|
describe 'when no parameters are provided' do
|
49
58
|
it 'shall provide an URI' do
|
@@ -73,7 +82,6 @@ describe Gravaty::Gravaty do
|
|
73
82
|
_(subject.send(method, nil)).must_match Gravaty::TEST_SECURE_URI_REGEXP
|
74
83
|
_(subject.send(method, nil)).wont_match Gravaty::TEST_UNSECURE_URI_REGEXP
|
75
84
|
end
|
76
|
-
|
77
85
|
end
|
78
86
|
|
79
87
|
describe 'when secure:false is provided' do
|