solid_assert 1.0.0 → 1.1.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
- SHA1:
3
- metadata.gz: 1e4e886c38ff86c869a75fce0ac8da897a043abe
4
- data.tar.gz: 26f7826d31e506cd3bf45c51a88c42a01463a155
2
+ SHA256:
3
+ metadata.gz: 4627026d63e35103c5c22f19de8c4ef776ebc1d172d4bc897813c315aec1c731
4
+ data.tar.gz: e98bfadd3b7a5e26ba087ebcb7a88167bbea26f5c279684dcc55bf292ca55813
5
5
  SHA512:
6
- metadata.gz: 3100ef42a3d7b364cc5d063438d670f524191e5db21689bf25737477838978e86bf54f0c42da5bef5536c959ea6abea4e1335a02e6ff4cdd089ea2a2e862ae9c
7
- data.tar.gz: 03063ace5b4b1ea666538d4bb3323b6134504ac5031046e136c16d11dbf1186751f1d749128a25e6541ef270b9fa5fdaf5dfc89d02c3877f4ce283ba3b49b5a4
6
+ metadata.gz: 03b063229bc1eab36ca5787178262b5ff579d04494e78ae66b3cec5b5afcca318024f7161a2dcf1b616d8b87b006085f9fff6c8def64eb387cab010f029f4ba5
7
+ data.tar.gz: f041e3d8d4ac25f60ac82a65c2395816f9d96edd6fc8124bc7bb866c3169b9f541a8622f513f67b314106d51ac2de982a4607bf6442d4f2108dc91c93ab06909
data/README.md CHANGED
@@ -10,10 +10,6 @@ Assertions are meant to test conditions about the integrity of your code. You sh
10
10
  - This line of code should never be executed.
11
11
  - At this point, this list should contain one entry for each key in this hash.
12
12
 
13
- Notice that assertions shouldn't be used for handling error situations. Use Ruby built-in exception handling for that.
14
-
15
- Assertions are typically used in development mode. You might want to disable them in production for performance reasons.
16
-
17
13
  # Installation
18
14
 
19
15
  Add to your `Gemfile`:
@@ -31,13 +27,16 @@ SolidAssert.enable_assertions
31
27
  SolidAssert.disable_assertions
32
28
  ```
33
29
 
34
- Assertions are disabled by default.
30
+ Assertions are disabled by default and are typically used in development mode only. You might want to disable them in production for performance reasons.
35
31
 
36
32
  Use `assert` for testing conditions. You can optionally provide an error message.
37
33
 
38
34
  ```ruby
39
- assert some_string != "some value"
40
- assert clients.empty?, "The list must not be empty!"
35
+ assert some_string != "unexpected value"
36
+ assert user.authenticated?
37
+
38
+ assert apples_count > 5, "Not enough apples!"
39
+ assert !clients.empty?, "The list must NOT be empty!"
41
40
  ```
42
41
 
43
42
  Use `invariant` for testing blocks of code. This comes handy
@@ -60,6 +59,10 @@ invariant "Lists must have equal sizes!" do
60
59
  end
61
60
  ```
62
61
 
62
+ ### Assertion Error
63
+
64
+ Failed assertion will raise `SolidAssert::AssertionFailedError` error. You shouldn't catch it in a `rescue` block! If it raised then something is wrong with either your code or with you assumption. *Assertions shouldn't be used for handling error situations!* Use Ruby built-in exception handling for that.
65
+
63
66
  ## Rails
64
67
 
65
68
  Create a file named `solid_assert.rb` in the `config/initializers` dir with the following content:
@@ -72,5 +75,5 @@ This way assertions will be disabled in production and enabled in the rest of en
72
75
 
73
76
  ## References
74
77
 
75
- - [Programming with assertions](http://download.oracle.com/javase/1.4.2/docs/guide/lang/assert.html). A great article on assertions. It is about the Java language, but the concepts apply to any programming language.
78
+ - [Programming with assertions](https://docs.oracle.com/javase/8/docs/technotes/guides/language/assert.html). A great article on assertions. It is about the Java language, but the concepts apply to any programming language.
76
79
  - There are good references to assertive programming in some classic books like [The Pragmatic Programmer From Journeyman to Master](http://www.amazon.com/exec/obidos/ASIN/020161622X/ref=nosim/jorgmanrpersp-20), [Code Complete](http://www.amazon.com/exec/obidos/ASIN/0735619670/ref=nosim/jorgmanrpersp-20) and [Writing solid code](http://www.amazon.com/exec/obidos/ASIN/1556155514/ref=nosim/jorgmanrpersp-20)
@@ -1,3 +1,3 @@
1
1
  module SolidAssert
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/solid_assert.gemspec CHANGED
@@ -15,9 +15,9 @@ Gem::Specification.new do |spec|
15
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
16
  spec.require_paths = ["lib"]
17
17
 
18
- spec.required_ruby_version = "~> 2.0"
18
+ spec.required_ruby_version = ">= 2.3"
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.11"
21
- spec.add_development_dependency "rake", "~> 10.5"
20
+ spec.add_development_dependency "bundler", "~> 2.0"
21
+ spec.add_development_dependency "rake", "~> 13.0"
22
22
  spec.add_development_dependency "rspec", "~> 3.4"
23
23
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_assert
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2021-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '2.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.11'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.5'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.5'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.4'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.4'
55
55
  description: Assert utility for ruby. It lets you code your assumptions and code invariants,
@@ -61,9 +61,9 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
- - .gitignore
65
- - .rspec
66
- - .travis.yml
64
+ - ".gitignore"
65
+ - ".rspec"
66
+ - ".travis.yml"
67
67
  - Gemfile
68
68
  - LICENSE.txt
69
69
  - README.md
@@ -78,24 +78,23 @@ homepage: https://github.com/jorgemanrubia/solid_assert
78
78
  licenses:
79
79
  - MIT
80
80
  metadata: {}
81
- post_install_message:
81
+ post_install_message:
82
82
  rdoc_options: []
83
83
  require_paths:
84
84
  - lib
85
85
  required_ruby_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '2.0'
89
+ version: '2.3'
90
90
  required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.4.8
98
- signing_key:
96
+ rubygems_version: 3.1.4
97
+ signing_key:
99
98
  specification_version: 4
100
99
  summary: Assert utility for ruby
101
100
  test_files: []