dm_ruby_extensions 1.0.9 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'dm_ruby_extensions'
3
5
 
4
6
  describe String do
5
-
6
7
  describe 'to_s_default' do
7
- specify { expect('foobar'.to_s_default).to eq 'foobar'}
8
- specify { expect(''.to_s_default).to eq 'n/a'}
9
- specify { expect(''.to_s_default('--')).to eq '--'}
8
+ specify { expect('foobar'.to_s_default).to eq 'foobar' }
9
+ specify { expect(''.to_s_default).to eq 'n/a' }
10
+ specify { expect(''.to_s_default('--')).to eq '--' }
10
11
  end
11
12
 
12
13
  describe 'as_boolean' do
@@ -18,17 +19,17 @@ describe String do
18
19
  end
19
20
 
20
21
  describe 'as_css_size' do
21
- specify { expect('50'.as_css_size).to eq '50px'}
22
- specify { expect(''.as_css_size).to eq ''}
23
- specify { expect('50px'.as_css_size).to eq '50px'}
24
- specify { expect('50%'.as_css_size).to eq '50%'}
25
- specify { expect('50em'.as_css_size).to eq '50em'}
26
- specify { expect('auto'.as_css_size).to eq 'auto'}
27
- specify { expect('inherit'.as_css_size).to eq 'inherit'}
22
+ specify { expect('50'.as_css_size).to eq '50px' }
23
+ specify { expect(''.as_css_size).to eq '' }
24
+ specify { expect('50px'.as_css_size).to eq '50px' }
25
+ specify { expect('50%'.as_css_size).to eq '50%' }
26
+ specify { expect('50em'.as_css_size).to eq '50em' }
27
+ specify { expect('auto'.as_css_size).to eq 'auto' }
28
+ specify { expect('inherit'.as_css_size).to eq 'inherit' }
28
29
  end
29
-
30
+
30
31
  describe 'sql_wildcard' do
31
- specify { expect('foobar'.sql_wildcard).to eq '%foobar%'}
32
+ specify { expect('foobar'.sql_wildcard).to eq '%foobar%' }
32
33
  end
33
34
 
34
35
  describe 'replace_non_alphanumeric' do
@@ -37,9 +38,9 @@ describe String do
37
38
  end
38
39
 
39
40
  describe 'sanitize_filename' do
40
- specify { expect('foobar.doc'.sanitize_filename).to eq 'foobar.doc'}
41
- specify { expect('/user/home/foobar.doc'.sanitize_filename).to eq 'foobar.doc'}
42
- specify { expect('/user/home/f9o o(b+a^r.d*c'.sanitize_filename).to eq 'f9o_o_b_a_r.d_c'}
41
+ specify { expect('foobar.doc'.sanitize_filename).to eq 'foobar.doc' }
42
+ specify { expect('/user/home/foobar.doc'.sanitize_filename).to eq 'foobar.doc' }
43
+ specify { expect('/user/home/f9o o(b+a^r.d*c'.sanitize_filename).to eq 'f9o_o_b_a_r.d_c' }
43
44
  end
44
45
 
45
46
  describe 'expand_url' do
@@ -57,7 +58,9 @@ describe String do
57
58
  end
58
59
 
59
60
  describe 'smart_titlecase' do
60
- specify { expect('a sample title and text: a treatsie'.smart_titlecase).to eq 'A Sample Title and Text: A Treatsie'}
61
+ specify do
62
+ expect('a sample title and text: a treatsie'.smart_titlecase).to eq 'A Sample Title and Text: A Treatsie'
63
+ end
61
64
  end
62
65
 
63
66
  describe 'smart_capitalize' do
@@ -67,33 +70,42 @@ describe String do
67
70
  end
68
71
 
69
72
  describe 'smart_truncate' do
70
- specify { expect('One time. Two times. 3 times. 4 times.'.smart_truncate(sentences: 3)).to eq 'One time. Two times. 3 times...' }
71
- specify { expect('one two three and four five six and seven and yet another eight'.smart_truncate(words: 6)).to eq 'one two three and four five...' }
72
- specify { expect('one two three and four five six and seven and yet another eight'.smart_truncate).to eq 'one two three and four five six and seven and yet another...' }
73
+ specify do
74
+ expect('One time. Two times. 3 times. 4 times.'.smart_truncate(sentences: 3))
75
+ .to eq 'One time. Two times. 3 times...'
76
+ end
77
+ specify do
78
+ expect('one two three and four five six and seven and yet another eight'.smart_truncate(words: 6))
79
+ .to eq 'one two three and four five...'
80
+ end
81
+ specify do
82
+ expect('one two three and four five six and seven and yet another eight'.smart_truncate)
83
+ .to eq 'one two three and four five six and seven and yet another...'
84
+ end
73
85
  end
74
86
 
75
87
  describe 'name_case' do
76
88
  before :each do
77
89
  @proper_names = [
78
- "Keith", "Leigh-Williams", "McCarthy",
79
- "O'Callaghan", "St. John", "von Streit",
80
- "van Dyke", "Van", "ap Llwyd Dafydd",
81
- "al Fahd", "Al",
82
- "el Grecco",
83
- "ben Gurion", "Ben",
84
- "da Vinci",
85
- "di Caprio", "du Pont", "de Legate",
86
- "del Crond", "der Sind", "van der Post",
87
- "von Trapp", "la Poisson", "le Figaro",
88
- "Mack Knife", "Dougal MacDonald",
90
+ 'Keith', 'Leigh-Williams', 'McCarthy',
91
+ "O'Callaghan", 'St. John', 'von Streit',
92
+ 'van Dyke', 'Van', 'ap Llwyd Dafydd',
93
+ 'al Fahd', 'Al',
94
+ 'el Grecco',
95
+ 'ben Gurion', 'Ben',
96
+ 'da Vinci',
97
+ 'di Caprio', 'du Pont', 'de Legate',
98
+ 'del Crond', 'der Sind', 'van der Post',
99
+ 'von Trapp', 'la Poisson', 'le Figaro',
100
+ 'Mack Knife', 'Dougal MacDonald',
89
101
  # Mac exceptions
90
- "Machin", "Machlin", "Machar",
91
- "Mackle", "Macklin", "Mackie",
92
- "Macquarie", "Machado", "Macevicius",
93
- "Maciulis", "Macias", "MacMurdo",
102
+ 'Machin', 'Machlin', 'Machar',
103
+ 'Mackle', 'Macklin', 'Mackie',
104
+ 'Macquarie', 'Machado', 'Macevicius',
105
+ 'Maciulis', 'Macias', 'MacMurdo',
94
106
  # Roman numerals
95
- "Henry VIII", "Louis III", "Louis XIV",
96
- "Charles II", "Fred XLIX",
107
+ 'Henry VIII', 'Louis III', 'Louis XIV',
108
+ 'Charles II', 'Fred XLIX'
97
109
  ]
98
110
  end
99
111
 
@@ -109,6 +121,5 @@ describe String do
109
121
  proper_cased = 'Iñtërnâtiônàlizætiøn'
110
122
  expect(proper_cased.downcase.name_case).to eq proper_cased
111
123
  end
112
-
113
124
  end
114
- end
125
+ end
@@ -1,16 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'dm_ruby_extensions'
3
5
 
4
6
  describe Time do
5
-
6
7
  describe 'localize' do
7
8
  it 'localize the date based on the format' do
8
9
  I18n.enforce_available_locales = false
9
10
  I18n.locale = :en
10
- time = Time.parse("2012-11-23 08:35 utc")
11
+ time = Time.parse('2012-11-23 08:35 utc')
11
12
  expect(time.localize).to eq 'Fri, 23 Nov 2012 08:35:00 +0000'
12
13
  expect(time.localize(format: :short)).to eq '23 Nov 08:35'
13
14
  expect(time.localize('%b %Y')).to eq 'Nov 2012'
14
15
  end
15
16
  end
16
- end
17
+ end
@@ -1,11 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'dm_ruby_extensions'
3
5
 
4
6
  describe TrueClass do
5
-
6
7
  describe 'as_boolean' do
7
8
  specify { expect(true.as_boolean).to eq true }
8
9
  end
9
-
10
-
11
- end
10
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pry-byebug'
2
4
  # This file was generated by the `rails generate rspec:install` command. Conventionally, all
3
5
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
@@ -39,48 +41,46 @@ RSpec.configure do |config|
39
41
  mocks.verify_partial_doubles = true
40
42
  end
41
43
 
42
- # The settings below are suggested to provide a good initial experience
43
- # with RSpec, but feel free to customize to your heart's content.
44
- =begin
45
- # These two settings work together to allow you to limit a spec run
46
- # to individual examples or groups you care about by tagging them with
47
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
48
- # get run.
49
- config.filter_run :focus
50
- config.run_all_when_everything_filtered = true
51
-
52
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
53
- # For more details, see:
54
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
55
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
56
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
57
- config.disable_monkey_patching!
58
-
59
- # Many RSpec users commonly either run the entire suite or an individual
60
- # file, and it's useful to allow more verbose output when running an
61
- # individual spec file.
62
- if config.files_to_run.one?
63
- # Use the documentation formatter for detailed output,
64
- # unless a formatter has already been configured
65
- # (e.g. via a command-line flag).
66
- config.default_formatter = 'doc'
67
- end
68
-
69
- # Print the 10 slowest examples and example groups at the
70
- # end of the spec run, to help surface which specs are running
71
- # particularly slow.
72
- config.profile_examples = 10
73
-
74
- # Run specs in random order to surface order dependencies. If you find an
75
- # order dependency and want to debug it, you can fix the order by providing
76
- # the seed, which is printed after each run.
77
- # --seed 1234
78
- config.order = :random
79
-
80
- # Seed global randomization in this process using the `--seed` CLI option.
81
- # Setting this allows you to use `--seed` to deterministically reproduce
82
- # test failures related to randomization by passing the same `--seed` value
83
- # as the one that triggered the failure.
84
- Kernel.srand config.seed
85
- =end
44
+ # The settings below are suggested to provide a good initial experience
45
+ # with RSpec, but feel free to customize to your heart's content.
46
+ # # These two settings work together to allow you to limit a spec run
47
+ # # to individual examples or groups you care about by tagging them with
48
+ # # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # # get run.
50
+ # config.filter_run :focus
51
+ # config.run_all_when_everything_filtered = true
52
+ #
53
+ # # Limits the available syntax to the non-monkey patched syntax that is recommended.
54
+ # # For more details, see:
55
+ # # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
56
+ # # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
57
+ # # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
58
+ # config.disable_monkey_patching!
59
+ #
60
+ # # Many RSpec users commonly either run the entire suite or an individual
61
+ # # file, and it's useful to allow more verbose output when running an
62
+ # # individual spec file.
63
+ # if config.files_to_run.one?
64
+ # # Use the documentation formatter for detailed output,
65
+ # # unless a formatter has already been configured
66
+ # # (e.g. via a command-line flag).
67
+ # config.default_formatter = 'doc'
68
+ # end
69
+ #
70
+ # # Print the 10 slowest examples and example groups at the
71
+ # # end of the spec run, to help surface which specs are running
72
+ # # particularly slow.
73
+ # config.profile_examples = 10
74
+ #
75
+ # # Run specs in random order to surface order dependencies. If you find an
76
+ # # order dependency and want to debug it, you can fix the order by providing
77
+ # # the seed, which is printed after each run.
78
+ # # --seed 1234
79
+ # config.order = :random
80
+ #
81
+ # # Seed global randomization in this process using the `--seed` CLI option.
82
+ # # Setting this allows you to use `--seed` to deterministically reproduce
83
+ # # test failures related to randomization by passing the same `--seed` value
84
+ # # as the one that triggered the failure.
85
+ # Kernel.srand config.seed
86
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm_ruby_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Walker
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-29 00:00:00.000000000 Z
11
+ date: 2024-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '6.0'
20
20
  type: :runtime
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: '4.0'
26
+ version: '6.0'
27
27
  description: Ruby base class extensions
28
28
  email:
29
29
  - github@digitalmoksha.com
@@ -31,13 +31,17 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".github/workflow/ci.yml"
34
35
  - ".gitignore"
35
36
  - ".rspec"
37
+ - ".rubocop.yml"
38
+ - ".ruby-version"
36
39
  - ".travis.yml"
37
40
  - Gemfile
38
41
  - LICENSE
39
42
  - README.md
40
43
  - Rakefile
44
+ - bin/console
41
45
  - dm_ruby_extensions.gemspec
42
46
  - lib/dm_ruby_extensions.rb
43
47
  - lib/dm_ruby_extensions/extend_array.rb
@@ -68,24 +72,23 @@ homepage: https://github.com/digitalmoksha/dm_ruby_extensions
68
72
  licenses:
69
73
  - MIT
70
74
  metadata: {}
71
- post_install_message:
75
+ post_install_message:
72
76
  rdoc_options: []
73
77
  require_paths:
74
78
  - lib
75
79
  required_ruby_version: !ruby/object:Gem::Requirement
76
80
  requirements:
77
- - - ">="
81
+ - - "~>"
78
82
  - !ruby/object:Gem::Version
79
- version: '0'
83
+ version: '3.0'
80
84
  required_rubygems_version: !ruby/object:Gem::Requirement
81
85
  requirements:
82
86
  - - ">="
83
87
  - !ruby/object:Gem::Version
84
88
  version: '0'
85
89
  requirements: []
86
- rubyforge_project:
87
- rubygems_version: 2.6.14.1
88
- signing_key:
90
+ rubygems_version: 3.4.10
91
+ signing_key:
89
92
  specification_version: 4
90
93
  summary: Simple Ruby base class extensions
91
94
  test_files: