mynyml-redgreen 0.5 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ pkg/*
@@ -0,0 +1,25 @@
1
+ .gitignore
2
+ LICENSE
3
+ Manifest
4
+ README
5
+ Rakefile
6
+ lib/redgreen.rb
7
+ lib/redgreen/expectations.rb
8
+ lib/redgreen/minitest.rb
9
+ lib/redgreen/testunit.rb
10
+ redgreen.gemspec
11
+ specs.watchr
12
+ test/README
13
+ test/contest/test_failure.rb
14
+ test/contest/test_success.rb
15
+ test/context/test_failure.rb
16
+ test/context/test_success.rb
17
+ test/expectations/test_failure.rb
18
+ test/expectations/test_success.rb
19
+ test/minitest/test_failure.rb
20
+ test/minitest/test_success.rb
21
+ test/shoulda/test_failure.rb
22
+ test/shoulda/test_success.rb
23
+ test/tests.rake
24
+ test/testunit/test_failure.rb
25
+ test/testunit/test_success.rb
data/README CHANGED
@@ -24,15 +24,13 @@ Place it in your test file (or test_helper.rb), and run your suite.
24
24
 
25
25
  ==== Testing Framework Compatibility
26
26
 
27
- * test/unit
27
+ * test/unit based frameworks:
28
+ * test/unit
29
+ * contest
30
+ * context
31
+ * shoula
32
+ * probably all others
28
33
  * minitest/unit
34
+ * expectations
29
35
 
30
-
31
- ==== TODO
32
-
33
- * Add test framework adapters
34
- * contest # propably already works; need testing
35
- * context # propably already works; need testing
36
- * shoulda # propably already works; need testing
37
- * expectations
38
- * ...
36
+ Patches or requests for other framework adapters are very welcome
data/Rakefile CHANGED
@@ -1,71 +1,56 @@
1
- # --------------------------------------------------
2
- # based on thin's Rakefile (http://github.com/macournoyer/thin)
3
- # --------------------------------------------------
4
- require 'rake/gempackagetask'
5
- require 'rake/rdoctask'
6
- require 'pathname'
7
- require 'yaml'
8
-
9
1
  load 'test/tests.rake'
10
- task :default => :test_all
11
-
12
- RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
13
- WIN = (RUBY_PLATFORM =~ /mswin|cygwin/)
14
- SUDO = (WIN ? "" : "sudo")
15
-
16
- def gem
17
- RUBY_1_9 ? 'gem19' : 'gem'
18
- end
2
+ task(:default => "test:all")
19
3
 
20
- def all_except(res)
21
- Dir['**/*'].reject do |path|
22
- Array(res).any? {|re| path.match(re) }
4
+ # --------------------------------------------------
5
+ # Tests
6
+ # --------------------------------------------------
7
+ namespace(:test) do
8
+
9
+ desc "Run all tests"
10
+ task(:all) do
11
+ tests = Dir['test/**/test_*.rb'] - ['test/test_helper.rb']
12
+ cmd = "ruby -rubygems -I.:lib -e'%w( #{tests.join(' ')} ).each {|file| require file }'"
13
+ puts(cmd) if ENV['VERBOSE']
14
+ system(cmd)
23
15
  end
24
- end
25
-
26
- spec = Gem::Specification.new do |s|
27
- s.name = 'redgreen'
28
- s.version = '0.5'
29
- s.summary = "Standalone redgreen eye candy for test results, ala autotest"
30
- s.description = "Standalone redgreen eye candy for test results, ala autotest"
31
- s.author = "Martin Aumont"
32
- s.email = 'mynyml@gmail.com'
33
- s.homepage = ''
34
- s.has_rdoc = true
35
- s.require_path = "lib"
36
- s.files = all_except([/doc/, /pkg/])
37
- s.add_dependency 'mynyml-override', '>= 0.5'
38
- s.add_dependency 'term-ansicolor', '>= 1.0.4'
39
- end
40
-
41
- desc "Generate rdoc documentation."
42
- Rake::RDocTask.new("rdoc") { |rdoc|
43
- rdoc.rdoc_dir = 'doc/rdoc'
44
- rdoc.title = "RedGreen"
45
- rdoc.options << '--line-numbers' << '--inline-source'
46
- rdoc.options << '--charset' << 'utf-8'
47
- rdoc.rdoc_files.include('README')
48
- rdoc.rdoc_files.include('lib/**/*.rb')
49
- }
50
16
 
51
- Rake::GemPackageTask.new(spec) do |p|
52
- p.gem_spec = spec
17
+ desc "Run all tests on multiple ruby versions (requires rvm)"
18
+ task(:portability) do
19
+ versions = %w( 1.8.6 1.8.7 1.9 1.9.2 jruby )
20
+ versions.each do |version|
21
+ system <<-BASH
22
+ bash -c 'source ~/.rvm/scripts/rvm;
23
+ rvm use #{version};
24
+ echo "--------- #{version} ----------";
25
+ rake -s test:all'
26
+ BASH
27
+ end
28
+ end
53
29
  end
54
30
 
55
- desc "Remove package products"
56
- task :clean => :clobber_package
57
-
58
- desc "Update the gemspec for GitHub's gem server"
59
- task :gemspec do
60
- Pathname("#{spec.name}.gemspec").open('w') {|f| f << YAML.dump(spec) }
31
+ # --------------------------------------------------
32
+ # Docs
33
+ # --------------------------------------------------
34
+ desc "Generate YARD Documentation"
35
+ task :yardoc do
36
+ require 'yard'
37
+ files = %w( lib/**/*.rb )
38
+ options = %w( -o doc/yard --readme README --files LICENSE )
39
+ YARD::CLI::Yardoc.run *(options + files)
61
40
  end
62
41
 
63
- desc "Install gem"
64
- task :install => [:clobber, :package] do
65
- sh "#{SUDO} #{gem} install pkg/#{spec.full_name}.gem"
42
+ # --------------------------------------------------
43
+ # Stats
44
+ # --------------------------------------------------
45
+ desc "LOC count"
46
+ task(:loc) do
47
+ loc = 0
48
+ Dir['lib/**/*'].each do |file|
49
+ next if File.directory?(file)
50
+ File.read(file).each_line do |line|
51
+ loc += 1 unless line.strip.empty? || line.strip =~ /^#/
52
+ end
53
+ end
54
+ puts "lib files contain #{loc} SLOCs"
66
55
  end
67
56
 
68
- desc "Uninstall gem"
69
- task :uninstall => :clean do
70
- sh "#{SUDO} #{gem} uninstall -v #{spec.version} -x #{spec.name}"
71
- end
@@ -14,5 +14,7 @@ end
14
14
 
15
15
  dir = Pathname(__FILE__).dirname.parent.join('lib/redgreen')
16
16
 
17
- require dir.join('testunit') if defined?(Test::Unit::TestCase)
18
- require dir.join('minitest') if defined?(MiniTest::Unit::TestCase)
17
+ if defined?(Expectations::SuiteRunner) then require dir.join('expectations')
18
+ elsif defined?(MiniTest::Unit::TestCase) then require dir.join('minitest')
19
+ elsif defined?(Test::Unit::TestCase) then require dir.join('testunit')
20
+ end
@@ -0,0 +1,19 @@
1
+ require 'expectations/suite_results'
2
+ require 'override'
3
+
4
+ class Expectations::SuiteResults
5
+ override :print_success
6
+ def print_success
7
+ super
8
+ out.puts RedGreen.visual
9
+ out.puts
10
+ end
11
+
12
+ override :print_fail
13
+ def print_fail
14
+ super
15
+ RedGreen.colour = :red
16
+ out.puts RedGreen.visual
17
+ out.puts
18
+ end
19
+ end
@@ -1,90 +1,23 @@
1
- --- !ruby/object:Gem::Specification
2
- name: redgreen
3
- version: !ruby/object:Gem::Version
4
- version: "0.5"
5
- platform: ruby
6
- authors:
7
- - Martin Aumont
8
- autorequire:
9
- bindir: bin
10
- cert_chain: []
11
-
12
- date: 2009-08-19 00:00:00 -04:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: mynyml-override
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0.5"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: term-ansicolor
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.0.4
34
- version:
35
- description: Standalone redgreen eye candy for test results, ala autotest
36
- email: mynyml@gmail.com
37
- executables: []
38
-
39
- extensions: []
40
-
41
- extra_rdoc_files: []
42
-
43
- files:
44
- - Rakefile
45
- - test
46
- - test/testunit
47
- - test/testunit/test_failure.rb
48
- - test/testunit/test_success.rb
49
- - test/tests.rake
50
- - test/minitest
51
- - test/minitest/test_failure.rb
52
- - test/minitest/test_success.rb
53
- - lib
54
- - lib/redgreen
55
- - lib/redgreen/testunit.rb
56
- - lib/redgreen/minitest.rb
57
- - lib/redgreen.rb
58
- - redgreen.gemspec
59
- - LICENSE
60
- - README
61
- has_rdoc: true
62
- homepage: ""
63
- licenses: []
64
-
65
- post_install_message:
66
- rdoc_options: []
67
-
68
- require_paths:
69
- - lib
70
- required_ruby_version: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: "0"
75
- version:
76
- required_rubygems_version: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: "0"
81
- version:
82
- requirements: []
83
-
84
- rubyforge_project:
85
- rubygems_version: 1.3.5
86
- signing_key:
87
- specification_version: 3
88
- summary: Standalone redgreen eye candy for test results, ala autotest
89
- test_files: []
1
+ Gem::Specification.new do |s|
2
+ s.name = 'mynyml-redgreen'
3
+ s.version = '0.5.1'
4
+ s.summary = "Standalone redgreen eye candy for test results, ala autotest"
5
+ s.description = "Standalone redgreen eye candy for test results, ala autotest."
6
+ s.author = "Martin Aumont"
7
+ s.email = 'mynyml@gmail.com'
8
+ s.homepage = 'http://mynyml.com'
9
+ s.rubyforge_project = "mynyml-redgreen"
10
+ s.has_rdoc = true
11
+ s.require_path = "lib"
12
+ s.files = File.read("Manifest").strip.split("\n")
13
+
14
+ s.add_dependency 'mynyml-override', '>= 0.5.2' #gemcutter
15
+ s.add_dependency 'term-ansicolor', '>= 1.0.4'
16
+
17
+ s.add_development_dependency 'minitest', '>= 1.3.1'
18
+ s.add_development_dependency 'expectations', '>= 1.2.1'
19
+ s.add_development_dependency 'thoughtbot-shoulda', '>= 2.10.1'
20
+ s.add_development_dependency 'citrusbyte-contest', '>= 0.1.1'
21
+ s.add_development_dependency 'jeremymcanally-context', '>= 0.5.5'
22
+ end
90
23
 
@@ -0,0 +1,37 @@
1
+ # Run me with:
2
+ #
3
+ # $ watchr specs.watchr
4
+
5
+ # --------------------------------------------------
6
+ # Helpers
7
+ # --------------------------------------------------
8
+ def run(cmd)
9
+ puts(cmd)
10
+ system(cmd)
11
+ end
12
+
13
+ def run_all_tests
14
+ # see Rakefile for the definition of the test:all task
15
+ system( "rake -s test:all VERBOSE=true" )
16
+ end
17
+
18
+ # --------------------------------------------------
19
+ # Watchr Rules
20
+ # --------------------------------------------------
21
+ watch( '^examples\.rb' ) { |m| system( "ruby -rubygems -Ilib %s" % m[0] ) }
22
+ watch( '^test.*/test_.*\.rb' ) { |m| run( "ruby -rubygems -Ilib %s" % m[0] ) }
23
+ watch( '^lib/(.*)\.rb' ) { |m| run( "ruby -rubygems -Ilib test/test_%s.rb" % m[1] ) }
24
+ watch( '^test/test_helper\.rb' ) { run_all_tests }
25
+
26
+ # --------------------------------------------------
27
+ # Signal Handling
28
+ # --------------------------------------------------
29
+ # Ctrl-\
30
+ Signal.trap('QUIT') do
31
+ puts " --- Running all tests ---\n\n"
32
+ run_all_tests
33
+ end
34
+
35
+ # Ctrl-C
36
+ Signal.trap('INT') { abort("\n") }
37
+
@@ -0,0 +1,11 @@
1
+ To run the full test suite, call <tt>rake</tt>.
2
+
3
+ The results are non-intuitive, but simple; for each adapter there is a passing
4
+ test and a failing test - each passing test should have a green bar at the end,
5
+ and each failing test a red one. This is not ideal, but it's a small test suite
6
+ and it keeps things simple.
7
+
8
+ To run a test suite individually, use
9
+
10
+ ruby -rubygems test/minitest/test_success.rb
11
+
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'contest'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestContestFailure < Test::Unit::TestCase
7
+ def test_failure
8
+ flunk
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'contest'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestContestSuccess < Test::Unit::TestCase
7
+ def test_success
8
+ assert true
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'context'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestContextFailure < Test::Unit::TestCase
7
+ def test_failure
8
+ flunk
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'context'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestContextSuccess < Test::Unit::TestCase
7
+ def test_success
8
+ assert true
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'expectations'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ Expectations do
7
+ expect "THIS TEST SHOULD FAIL" do
8
+ true
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'expectations'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ Expectations do
7
+ expect "THIS TEST SHOULD PASS" do
8
+ "THIS TEST SHOULD PASS"
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'shoulda'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestShouldaFailure < Test::Unit::TestCase
7
+ def test_failure
8
+ flunk
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'shoulda'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestShouldaSuccess < Test::Unit::TestCase
7
+ def test_success
8
+ assert true
9
+ end
10
+ end
@@ -1,14 +1,35 @@
1
1
  require 'pathname'
2
2
 
3
- task(:test_all) do
4
- test_root = Pathname(__FILE__).dirname
5
-
6
- files = %w(
7
- testunit/test_success.rb
8
- testunit/test_failure.rb
9
- minitest/test_success.rb
10
- minitest/test_failure.rb
11
- )
12
- files.map! {|file| Pathname(file).expand_path(test_root) }
13
- files.each {|file| system("ruby -rubygems #{file}") }
3
+ namespace(:test) do
4
+
5
+ task(:all) do
6
+ test_root = Pathname(__FILE__).dirname
7
+
8
+ files = %w(
9
+ testunit/test_success.rb
10
+ testunit/test_failure.rb
11
+ minitest/test_success.rb
12
+ minitest/test_failure.rb
13
+ contest/test_success.rb
14
+ contest/test_failure.rb
15
+ context/test_success.rb
16
+ context/test_failure.rb
17
+ shoulda/test_success.rb
18
+ shoulda/test_failure.rb
19
+ expectations/test_success.rb
20
+ expectations/test_failure.rb
21
+ )
22
+ files.map! {|file| Pathname(file).expand_path(test_root) }
23
+ files.each {|file| system("ruby -rubygems -I.:lib #{file}") }
24
+ end
25
+
26
+ task(:by_fw) do
27
+ test_root = Pathname(__FILE__).dirname.expand_path
28
+ frameworks = ENV['FW'].downcase.split(',')
29
+
30
+ frameworks.each do |framework|
31
+ files = Dir[test_root + framework.strip + '*']
32
+ files.each {|file| system("ruby -rubygems -I.:lib #{file}") }
33
+ end
34
+ end
14
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mynyml-redgreen
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.5"
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Aumont
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-18 21:00:00 -07:00
12
+ date: 2009-11-03 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "0.5"
23
+ version: 0.5.2
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: term-ansicolor
@@ -32,7 +32,57 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.0.4
34
34
  version:
35
- description: Standalone redgreen eye candy for test results, ala autotest
35
+ - !ruby/object:Gem::Dependency
36
+ name: minitest
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.3.1
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: expectations
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.2.1
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: thoughtbot-shoulda
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 2.10.1
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: citrusbyte-contest
67
+ type: :development
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 0.1.1
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: jeremymcanally-context
77
+ type: :development
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 0.5.5
84
+ version:
85
+ description: Standalone redgreen eye candy for test results, ala autotest.
36
86
  email: mynyml@gmail.com
37
87
  executables: []
38
88
 
@@ -41,25 +91,33 @@ extensions: []
41
91
  extra_rdoc_files: []
42
92
 
43
93
  files:
94
+ - .gitignore
95
+ - LICENSE
96
+ - Manifest
97
+ - README
44
98
  - Rakefile
45
- - test
46
- - test/testunit
47
- - test/testunit/test_failure.rb
48
- - test/testunit/test_success.rb
49
- - test/tests.rake
50
- - test/minitest
51
- - test/minitest/test_failure.rb
52
- - test/minitest/test_success.rb
53
- - lib
54
- - lib/redgreen
55
- - lib/redgreen/testunit.rb
56
- - lib/redgreen/minitest.rb
57
99
  - lib/redgreen.rb
100
+ - lib/redgreen/expectations.rb
101
+ - lib/redgreen/minitest.rb
102
+ - lib/redgreen/testunit.rb
58
103
  - redgreen.gemspec
59
- - LICENSE
60
- - README
104
+ - specs.watchr
105
+ - test/README
106
+ - test/contest/test_failure.rb
107
+ - test/contest/test_success.rb
108
+ - test/context/test_failure.rb
109
+ - test/context/test_success.rb
110
+ - test/expectations/test_failure.rb
111
+ - test/expectations/test_success.rb
112
+ - test/minitest/test_failure.rb
113
+ - test/minitest/test_success.rb
114
+ - test/shoulda/test_failure.rb
115
+ - test/shoulda/test_success.rb
116
+ - test/tests.rake
117
+ - test/testunit/test_failure.rb
118
+ - test/testunit/test_success.rb
61
119
  has_rdoc: true
62
- homepage: ""
120
+ homepage: http://mynyml.com
63
121
  licenses: []
64
122
 
65
123
  post_install_message:
@@ -81,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
139
  version:
82
140
  requirements: []
83
141
 
84
- rubyforge_project:
142
+ rubyforge_project: mynyml-redgreen
85
143
  rubygems_version: 1.3.5
86
144
  signing_key:
87
145
  specification_version: 3