asrt 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ae767d14b182a4d8c749050c58a0a7dc5663b55
4
- data.tar.gz: 0bacdf797d4bafbeecffc64126bcd03b4136d351
3
+ metadata.gz: e0d671264b1c242e39d2573a3af4c5b47d508c55
4
+ data.tar.gz: 7be563b687cf57904b36718e0ffbae8962844345
5
5
  SHA512:
6
- metadata.gz: d48ee7d8f08a0e3b2b867295f3d0b7488bbcab17f10482766371a9ccb09267085846eb1a35a195ff15385f0f7b11d6258a73cb13f4cdfeaf102f1bb710398daa
7
- data.tar.gz: 850a6b2186ade4151ba04be01557fdfc0ac2ebefd5afb96d3614d3e7c88bafc290c4fcf3c3b6d610e6d31e4c9a002d4f3333d49beaeee4f14c17efea07e37b92
6
+ metadata.gz: ff7c7bb692ed6dfb883560892024b060aba6cc51c54a324ccb54ebaeaa10438de22b9fce433620acf7968c2b2913436e4e8cdbb499e0401a0744a50801a437ba
7
+ data.tar.gz: 36ffdea526827b99a600fc1b50b5061fb6e48c5a04be059b1218232d61b344708d3a3cbc672d64ed1effc3734b13aa5eb38f8c5f22e13c6984c305ef83e77030
data/Gemfile CHANGED
@@ -1,14 +1,14 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ group :coverage do
4
+ gem 'coveralls', require: false
5
+ end
6
+
3
7
  group :test do
4
8
  gem 'rspec'
5
9
  gem 'rake'
6
10
  end
7
11
 
8
- group :coverage do
9
- gem 'coveralls', require: false
10
- end
11
-
12
- group :development do
12
+ group :development, :test do
13
13
  gem 'pry'
14
14
  end
data/README.rst CHANGED
@@ -7,6 +7,18 @@
7
7
  asrt
8
8
  ==========
9
9
 
10
+ .. image:: https://travis-ci.org/ct-clearhaus/asrt.png?branch=master
11
+ :alt: Build Status
12
+ :target: https://travis-ci.org/ct-clearhaus/asrt
13
+
14
+ .. image:: https://codeclimate.com/github/ct-clearhaus/asrt.png
15
+ :alt: Code Climate
16
+ :target: https://codeclimate.com/github/ct-clearhaus/asrt
17
+
18
+ .. image:: https://coveralls.io/repos/ct-clearhaus/asrt/badge.png?branch=master
19
+ :alt: Coveralls
20
+ :target: https://coveralls.io/r/ct-clearhaus/asrt
21
+
10
22
  .. image:: http://img.shields.io/license/MIT.png?color=green
11
23
  :alt: MIT License
12
24
  :target: http://opensource.org/licenses/MIT
@@ -15,14 +27,14 @@ Introduction
15
27
  ------------
16
28
 
17
29
  `This gem <https://rubygems.org/gems/asrt>`_ simply gives you :ruby:`asrt` so
18
- you can do
30
+ you can do assertions like this:
19
31
 
20
32
  .. code-block:: ruby
21
33
 
22
34
  def funny(input)
23
35
  asrt input.is_a?(String), 'Me only eat strings.'
24
36
 
25
- input + ' is funny'
37
+ input.strip + ' is funny'
26
38
  end
27
39
 
28
40
  Why use :ruby:`asrt` rather than :ruby:`assert`? Well, it's short and you may
@@ -44,19 +56,6 @@ Dependencies
44
56
  None.
45
57
 
46
58
 
47
- Examples
48
- --------
49
-
50
- .. code-block:: ruby
51
-
52
- def funny(input)
53
- asrt input.is_a?(String), 'Me only eat strings.'
54
-
55
- input + ' is funny'
56
- end
57
-
58
-
59
-
60
59
  Contribute
61
60
  ----------
62
61
 
data/Rakefile CHANGED
@@ -5,4 +5,5 @@ task :default => :test
5
5
  desc 'Run all specs'
6
6
  RSpec::Core::RakeTask.new(:test) do |task|
7
7
  task.pattern = './spec/asrt/*_spec.rb'
8
+ task.rspec_opts = '--require spec_helper'.split
8
9
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'asrt'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.summary = 'Assertion library.'
5
5
  s.description = 'Allows you to assert things to be true in your code.'
6
6
  s.license = 'MIT'
@@ -10,6 +10,8 @@ module Asrt
10
10
  okay = (condition == true)
11
11
  else
12
12
  message, garbage = args
13
+ file_line = block.source_location
14
+ message = (file_line << message).join(':')
13
15
 
14
16
  okay = (yield rescue false) == true
15
17
  end
@@ -28,9 +28,16 @@ describe 'Asrt::Fallible#asrt' do
28
28
  expect{ asrt { true } }.to_not raise_error
29
29
  end
30
30
 
31
+ context 'when failing with a block' do
32
+ it 'includes file name and line number in the message' do
33
+ expect{ asrt { false } }.to raise_error(Asrt::AssertionError, /\A#{__FILE__}:\d+:\z/)
34
+ expect{ asrt 'msg' do false end }.to raise_error(Asrt::AssertionError, /\A#{__FILE__}:\d+:msg\z/)
35
+ end
36
+ end
37
+
31
38
  it 'should fail with the given message, when failing' do
32
39
  expect{ asrt false, 'msg' }.to raise_error(Asrt::AssertionError, 'msg')
33
- expect{ asrt 'msg' do false end }.to raise_error(Asrt::AssertionError, 'msg')
40
+ expect{ asrt 'msg' do false end }.to raise_error(Asrt::AssertionError, /msg/)
34
41
  end
35
42
 
36
43
  it 'should complain when too many arguments are given' do
@@ -0,0 +1,2 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asrt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casper Thomsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-30 00:00:00.000000000 Z
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Allows you to assert things to be true in your code.
14
14
  email: ct@clearhaus.com
@@ -27,6 +27,7 @@ files:
27
27
  - lib/asrt.rb
28
28
  - spec/asrt/fallible_spec.rb
29
29
  - spec/asrt/infallible_spec.rb
30
+ - spec/spec_helper.rb
30
31
  homepage: https://github.com/ct-clearhaus/asrt
31
32
  licenses:
32
33
  - MIT