scampi 0.1.4 → 0.1.6

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
  SHA256:
3
- metadata.gz: 82b9fac36711a5125614536636294d45b5d94a013894a7de447e131cf46f6cc8
4
- data.tar.gz: 4ba5a553e3f7d94ce7c53c8f331af6646aaf06f18b5ef88838b4585c33987e40
3
+ metadata.gz: 3d4ea4ec73208870f1578c9a9692ad391f76e5a40de28ad371d966ebeeeea095
4
+ data.tar.gz: e542d8bb09d7d121976f41daa04b1f62609302a81fdd030bd9183525dea18086
5
5
  SHA512:
6
- metadata.gz: 55a95005509df9d72b5cf3ccf1e1dbcae5f71f67cb6cc697a63e874e3e23d175b2fef36c73a726f902da8b83c9676207a261f4c5438e4a65d01c37c736d04691
7
- data.tar.gz: 252ca9f7c5f9fb2b8837bb1c1201054372455f2c7740500f9ba8e2a8234aad2f48c44e27b46faec49124329729d2adb2ff4b2dc017d4bd9198b9d9000de8de00
6
+ metadata.gz: 03c07b2b4e3eea11ab08873bf96467b0bca682f55230ce644451e4628d638bcec91bebd01046d9ca907b5c55bf4ea024b25d0a0aca719f977bacd7b3139e97bd
7
+ data.tar.gz: 777988311e98de67d4d340314fe2d4d87980b3fefa275c28d202dc29d37017ad0fe0f42069e26927a5f78ed38415884ecf42868018ca047bd2033b6cced5476e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scampi (0.1.4)
4
+ scampi (0.1.6)
5
5
  colorize-extended
6
6
 
7
7
  GEM
@@ -22,7 +22,7 @@ DEPENDENCIES
22
22
  CHECKSUMS
23
23
  colorize (1.1.0) sha256=30b5237f0603f6662ab8d1fc2bd4a96142b806c6415d79e45ef5fdc6a0cfc837
24
24
  colorize-extended (0.1.0) sha256=e8c39986e41ee2e14623c8fa02cf851ef4b83d2fe1392daa2b4d81f0df7bedc9
25
- scampi (0.1.4)
25
+ scampi (0.1.6)
26
26
 
27
27
  BUNDLED WITH
28
28
  4.0.7
data/README.md CHANGED
@@ -11,16 +11,18 @@ Tests can live alongside your code using the `test` block — it only runs when
11
11
  def greet(name) = "hello #{name}"
12
12
 
13
13
  test do
14
+ greeting = proc { |name| greet(name) }
15
+
14
16
  it "equality and matching" do
15
- greet("world").should == "hello world"
16
- greet("world").should.equal "hello world"
17
- greet("world").should =~ /hello/
18
- greet("world").should.match(/hello/)
17
+ greeting.("world").should == "hello world"
18
+ greeting.("world").should.equal "hello world"
19
+ greeting.("world").should =~ /hello/
20
+ greeting.("world").should.match(/hello/)
19
21
  end
20
22
 
21
23
  it "negation" do
22
- greet("world").should.not == "goodbye"
23
- greet("world").should.not.match(/goodbye/)
24
+ greeting.("world").should.not == "goodbye"
25
+ greeting.("world").should.not.match(/goodbye/)
24
26
  end
25
27
 
26
28
  it "predicates" do
@@ -1,38 +1 @@
1
- module Kernel
2
- # Conditionally run a test block.
3
- #
4
- # When placed in a Ruby file, the block is executed only when the file is
5
- # run directly (ruby myfile.rb) or when ENV["TEST"] is set to "true".
6
- # This lets you co-locate tests alongside implementation code.
7
- #
8
- # # mylib.rb
9
- # def greet(name) = "hello #{name}"
10
- #
11
- # test do
12
- # describe "greet" do
13
- # it "says hello" do
14
- # greet("world").should == "hello world"
15
- # end
16
- # end
17
- # end
18
- #
19
- def test(&block)
20
- loc = caller_locations(1, 1).first
21
- caller_file = loc.absolute_path || loc.path
22
-
23
- if ENV["TEST"] == "true"
24
- require_relative 'scampi' unless defined?(Scampi)
25
- Scampi.summary_on_exit
26
- block.call
27
- elsif caller_file && $0
28
- program = File.expand_path($0) rescue $0
29
- caller_expanded = File.expand_path(caller_file) rescue caller_file
30
- if caller_expanded == program
31
- require_relative 'scampi' unless defined?(Scampi)
32
- Scampi.summary_on_exit
33
- block.call
34
- end
35
- end
36
- end
37
- private :test
38
- end
1
+ require 'scampi'
@@ -0,0 +1,38 @@
1
+ module Kernel
2
+ # Conditionally run a test block.
3
+ #
4
+ # When placed in a Ruby file, the block is executed only when the file is
5
+ # run directly (ruby myfile.rb) or when ENV["TEST"] is set to "true".
6
+ # This lets you co-locate tests alongside implementation code.
7
+ #
8
+ # # mylib.rb
9
+ # def greet(name) = "hello #{name}"
10
+ #
11
+ # test do
12
+ # describe "greet" do
13
+ # it "says hello" do
14
+ # greet("world").should == "hello world"
15
+ # end
16
+ # end
17
+ # end
18
+ #
19
+ def test(&block)
20
+ loc = caller_locations(1, 1).first
21
+ caller_file = loc.absolute_path || loc.path
22
+
23
+ if ENV["TEST"] == "true"
24
+ require_relative '../scampi' unless defined?(Scampi)
25
+ Scampi.summary_on_exit
26
+ block.call
27
+ elsif caller_file && $0
28
+ program = File.expand_path($0) rescue $0
29
+ caller_expanded = File.expand_path(caller_file) rescue caller_file
30
+ if caller_expanded == program
31
+ require_relative '../scampi' unless defined?(Scampi)
32
+ Scampi.summary_on_exit
33
+ block.call
34
+ end
35
+ end
36
+ end
37
+ private :test
38
+ end
@@ -1,5 +1,3 @@
1
1
  module Scampi
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.6"
3
3
  end
4
-
5
- require_relative '../rubygems_plugin'
@@ -1,5 +1,3 @@
1
1
  module Scampi
2
2
  VERSION = "<%= version %>"
3
3
  end
4
-
5
- require_relative '../rubygems_plugin'
data/lib/scampi.rb CHANGED
@@ -141,4 +141,4 @@ require_relative 'scampi/error'
141
141
  require_relative 'scampi/context'
142
142
  require_relative 'scampi/should'
143
143
  require_relative 'scampi/monkey_patches'
144
- require_relative 'rubygems_plugin'
144
+ require_relative 'scampi/kernel_ext'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scampi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan K
@@ -52,6 +52,7 @@ files:
52
52
  - lib/scampi.rb
53
53
  - lib/scampi/context.rb
54
54
  - lib/scampi/error.rb
55
+ - lib/scampi/kernel_ext.rb
55
56
  - lib/scampi/monkey_patches.rb
56
57
  - lib/scampi/should.rb
57
58
  - lib/scampi/version.rb