cutest-cj 1.2.4 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cutest +2 -1
  3. data/cutest.gemspec +1 -0
  4. data/lib/cutest.rb +13 -10
  5. data/test/run.rb +0 -1
  6. metadata +15 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92455ef2621ffc03d72b7c668d15e197ef5b41fe
4
- data.tar.gz: f97510d289eccd25608ea698b13b11f934206e59
3
+ metadata.gz: 14a96c44d653cd8a8372783b6f4cb0907715402f
4
+ data.tar.gz: 584bf8ef2bed9fc3a40c09f5a2f3c47497ab6aae
5
5
  SHA512:
6
- metadata.gz: a3ead93fcd65e94a6957a133199bf9d45aa2320fb37c4cc3d90162971f2f911cf320e427cc927d51d705101bc0a70e6a2d5148d6653842dc340d36abeaa1893c
7
- data.tar.gz: 197f7e987c7f78be3b94da7275982360b5910bc6292a142330080d0ec8bbc937b1261798da86a09b4b2dedc17eab3fe11cbf2d02de37592ee311613924a3aa00
6
+ metadata.gz: 733d91f8afd0fc4843bb324c098d5434c20298bc670e6834b2e8f9336825108d1b5b24cf80f76ee5454da56c8f912b73071a5eb6fdc7586238c126a3533db18d
7
+ data.tar.gz: de42a0fdce510e763bf37428f5147fc7b3f6998efcab15f5117f63507aba2ab6cd19ac2c343ee23e3237c8ea75b03be1b57094c8846d3829692c3ba57ce8c2b5
data/bin/cutest CHANGED
@@ -9,6 +9,7 @@ end
9
9
 
10
10
  require_relative "../lib/cutest"
11
11
  require "clap"
12
+ require "mocoso"
12
13
 
13
14
  files = Clap.run ARGV,
14
15
  "-r" => lambda { |file| require file },
@@ -24,7 +25,7 @@ files = Clap.run ARGV,
24
25
  if files.any?
25
26
  begin
26
27
  env = '.env'
27
- rack_env = ".#{ENV['RACK_ENV']}#{env}"
28
+ rack_env = ".#{env}.#{ENV['RACK_ENV']}"
28
29
 
29
30
  if File.file? rack_env
30
31
  Cutest.load_envs rack_env
data/cutest.gemspec CHANGED
@@ -18,4 +18,5 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'pry'
19
19
  s.add_dependency 'awesome_print'
20
20
  s.add_dependency "clap"
21
+ s.add_dependency "mocoso"
21
22
  end
data/lib/cutest.rb CHANGED
@@ -2,7 +2,7 @@ require 'benchmark'
2
2
 
3
3
  class Cutest
4
4
  unless defined?(VERSION)
5
- VERSION = "1.2.4"
5
+ VERSION = "1.3.0"
6
6
  FILTER = %r[/(ruby|jruby|rbx)[-/]([0-9\.])+]
7
7
  CACHE = Hash.new { |h, k| h[k] = File.readlines(k) }
8
8
  end
@@ -55,7 +55,7 @@ class Cutest
55
55
  trace = $!.backtrace
56
56
  pivot = trace.index { |line| line.match(file) }
57
57
 
58
- puts "\n \e[93mTest: \e[0m%s\e[31m✘\e[0m\n" % (cutest[:test] != '' ? "#{cutest[:test]} " : '')
58
+ puts " \e[93mTest: \e[0m%s\e[31m✘\e[0m\n" % (cutest[:test] != '' ? "#{cutest[:test]} " : '')
59
59
 
60
60
  if pivot
61
61
  other = trace[0..pivot].select { |line| line !~ FILTER }
@@ -95,15 +95,15 @@ class Cutest
95
95
  end
96
96
  end
97
97
 
98
- print " \033[93m#{$!.class}: "
99
- print "\033[31m#{$!.message}\n"
98
+ puts " \033[93m#{$!.class}: \033[31m#{$!.message}"
99
+ puts ""
100
100
  end
101
101
 
102
102
  def self.display_trace(line)
103
103
  fn, ln = line.split(":")
104
104
 
105
- puts " → \033[0mfile: #{fn} ↪#{ln}\e[0m"
106
- puts " → \033[90mline: #{code(fn, ln)}\e[0m"
105
+ puts " → \033[0mfile: #{fn} ↪#{ln}\e[0m"
106
+ puts " → \033[90mline: #{code(fn, ln)}\e[0m"
107
107
  end
108
108
 
109
109
  class AssertionFailed < StandardError
@@ -121,7 +121,8 @@ class Cutest
121
121
  end
122
122
 
123
123
  module Kernel
124
- private
124
+
125
+ private
125
126
 
126
127
  # Use Thread.current[:cutest] to store information about test preparation
127
128
  # and setup.
@@ -136,7 +137,8 @@ private
136
137
  # isolation between tests.
137
138
  def scope(name = nil, &block)
138
139
  if !cutest[:scope] || cutest[:scope] == name
139
- print "\n \033[93mScope: \033[0m#{cutest[:scope]}\n\n "
140
+ puts "\033[93mScope: \033[0m#{cutest[:scope]}"
141
+ puts ""
140
142
  Cutest::Scope.new(&block).call
141
143
  end
142
144
  end
@@ -186,7 +188,8 @@ private
186
188
  prepare.each { |blk| blk.call }
187
189
  block.call(setup && setup.call)
188
190
  end
189
- print " \n \033[93mTest: \033[0m#{cutest[:test]} \033[32m✔\033[0m\n \e[94m#{time_taken}\033[0m\n "
191
+ puts " \033[93mTest: \033[0m#{cutest[:test]} \033[32m✔\033[0m"
192
+ puts "\e[94m#{time_taken}\033[0m"
190
193
  end
191
194
 
192
195
  cutest[:test] = nil
@@ -226,6 +229,6 @@ private
226
229
 
227
230
  # Executed when an assertion succeeds.
228
231
  def success
229
- print "•"
232
+ puts " •"
230
233
  end
231
234
  end
data/test/run.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  test "output of successful run" do
2
- require 'pry'
3
2
  expected = "•"
4
3
 
5
4
  out = %x{./bin/cutest test/fixtures/success.rb}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutest-cj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski
@@ -54,6 +54,20 @@ dependencies:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: mocoso
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
57
71
  description: Run tests in separate processes to avoid shared state.
58
72
  email:
59
73
  - djanowski@dimaion.com