guard-rackunit 1.0.0

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.
@@ -0,0 +1,23 @@
1
+ # Require this file using `require "spec_helper"` to ensure that it is only
2
+ # loaded once.
3
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
4
+
5
+ require 'rspec'
6
+ require 'rspec/mocks'
7
+ require 'debugger'
8
+ Debugger.start
9
+ Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.run_all_when_everything_filtered = true
14
+ config.filter_run :focus
15
+ config.order = 'random'
16
+ orig_stderr, orig_stdout = $stderr, $stdout
17
+ config.before(:all) do
18
+ $stderr, $stdout = StringIO.new(""), StringIO.new("")
19
+ end
20
+ config.after(:all) do
21
+ $stderr, $stdout = orig_stderr, orig_stdout
22
+ end
23
+ end
@@ -0,0 +1,86 @@
1
+ def test_path
2
+ support_file_path("/tests")
3
+ end
4
+
5
+ def with_failed_stderr(sample_path = '/samples/failed_tests')
6
+ File.open(support_file_path(sample_path)) do |io|
7
+ yield io
8
+ end
9
+ end
10
+
11
+ def with_successful_stdout
12
+ File.open(support_file_path("/samples/success")) do |io|
13
+ yield io
14
+ end
15
+ end
16
+
17
+ def support_file_path(name)
18
+ File.expand_path(File.dirname(__FILE__) + name)
19
+ end
20
+
21
+ def stub_successful_run(paths = [])
22
+ stub_paths(paths)
23
+ with_successful_stdout do |stdout|
24
+ thread = stub_success_process
25
+ stderr = StringIO.new('')
26
+ stub_run(stdout, stderr, thread)
27
+ if block_given?
28
+ yield stdout, stderr, thread.value
29
+ end
30
+ end
31
+ end
32
+
33
+ def stub_paths(paths)
34
+ paths.collect do |path|
35
+ allow(File).to receive(:exists?).at_least(:once).with(path).and_return true
36
+ end
37
+ end
38
+
39
+ def stub_failed_run(paths = [])
40
+ stub_paths(paths)
41
+ with_failed_stderr do |stderr|
42
+ stub_failed_run_err(stderr) do | stdout, stderr, thread|
43
+ if block_given?
44
+ yield stdout, stderr, thread
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ def stub_failed_process
51
+ process = double(Process::Status, :success? => false)
52
+ double('wait_thr', pid: 1, value: process)
53
+ end
54
+
55
+ def stub_success_process
56
+ process = double(Process::Status, :success? => true)
57
+ double('wait_thr', pid: 1, value: process)
58
+ end
59
+
60
+ def stub_failed_run_err(stderr, path = '')
61
+ stub_paths([path]) unless path.empty?
62
+ stdout = StringIO.new('')
63
+ thread = stub_failed_process
64
+ stub_run(stdout, stderr, thread)
65
+ if block_given?
66
+ yield stdout, stderr, thread.value
67
+ end
68
+ end
69
+
70
+ def stub_run(stdout, stderr, thread = stub_success_process)
71
+ Open3.stub(:popen3).and_yield(StringIO.new(''), stdout, stderr, thread)
72
+ end
73
+
74
+ def capture_stdout
75
+ # borrowed from
76
+ # https://github.com/cldwalker/hirb/blob/master/test/test_helper.rb
77
+ # MIT license
78
+ original_stdout = $stdout
79
+ $stdout = fake = StringIO.new
80
+ begin
81
+ yield
82
+ ensure
83
+ $stdout = original_stdout
84
+ end
85
+ fake.string
86
+ end
@@ -0,0 +1,12 @@
1
+ --------------------
2
+ parsing: """
3
+ FAILURE
4
+ message: "No exception raised"
5
+ name: check-exn
6
+ location: (#<path:/home/test-user/racket-project/tests/sample-tests.rkt> 19 4 389 113)
7
+ expression: (check-exn exn:fail:parsack? (lambda () (parsack-parse string)))
8
+ params: (#<procedure:exn:fail:parsack?> #<procedure:temp6>)
9
+
10
+ Check failure
11
+ --------------------
12
+ 1/101 test failures
@@ -0,0 +1,16 @@
1
+ --------------------
2
+ description
3
+ ERROR
4
+ string-trim: contract violation
5
+ expected: string?
6
+ given: 0
7
+ context...:
8
+ /usr/share/racket/collects/racket/string.rkt:75:0: string-trim22
9
+ /home/mine/tests/blob-tests.rkt:82:0: sexp-instruction->bytecode
10
+ /home/mine/tests/blob-tests.rkt: [running body]
11
+ /usr/share/racket/collects/compiler/commands/test.rkt:29:10: for-loop
12
+ f8
13
+ /usr/share/racket/collects/compiler/commands/../../racket/private/map.rkt:53:19: loop
14
+ /usr/share/racket/collects/compiler/commands/test.rkt: [running body]
15
+ /usr/share/racket/collects/raco/raco.rkt: [running body]
16
+ /usr/share/racket/collects/raco/main.rkt: [running body]
@@ -0,0 +1,2 @@
1
+ raco test: (submod "tests/vm-tests.rkt" test)
2
+ 8 tests passed
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-rackunit
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Chad Albers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 2.5.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 2.5.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard-rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 4.2.3
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 4.2.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 2.14.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.14.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: debugger
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.6.5
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.6.5
69
+ description: Guard::RackUnit runs Racket RackUnit tests
70
+ email: calbers@neomantic.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files:
74
+ - README.md
75
+ - ChangeLog
76
+ - LICENSE
77
+ files:
78
+ - lib/guard/rackunit/run_result.rb
79
+ - lib/guard/rackunit/runner.rb
80
+ - lib/guard/rackunit/notifier.rb
81
+ - lib/guard/rackunit/templates/Guardfile
82
+ - lib/guard/rackunit/command.rb
83
+ - lib/guard/rackunit/version.rb
84
+ - lib/guard/rackunit.rb
85
+ - README.md
86
+ - ChangeLog
87
+ - LICENSE
88
+ - spec/lib/guard/rackunit/notifier_spec.rb
89
+ - spec/lib/guard/rackunit/command_spec.rb
90
+ - spec/lib/guard/rackunit/run_result_spec.rb
91
+ - spec/lib/guard/rackunit/runner_spec.rb
92
+ - spec/lib/guard/rackunit_spec.rb
93
+ - spec/support/helpers.rb
94
+ - spec/support/samples/success
95
+ - spec/support/samples/failed_tests
96
+ - spec/support/samples/runtime_error
97
+ - spec/spec_helper.rb
98
+ homepage: https://github.com/neomantic/guard-rackunit
99
+ licenses:
100
+ - GNU General Public License v3
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options:
104
+ - --main
105
+ - README.md
106
+ - --charset=UTF-8
107
+ require_paths:
108
+ - - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.0.7
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Guard plugin for Racket's RackUnit
125
+ test_files:
126
+ - spec/lib/guard/rackunit/notifier_spec.rb
127
+ - spec/lib/guard/rackunit/command_spec.rb
128
+ - spec/lib/guard/rackunit/run_result_spec.rb
129
+ - spec/lib/guard/rackunit/runner_spec.rb
130
+ - spec/lib/guard/rackunit_spec.rb
131
+ - spec/support/helpers.rb
132
+ - spec/support/samples/success
133
+ - spec/support/samples/failed_tests
134
+ - spec/support/samples/runtime_error
135
+ - spec/spec_helper.rb