testme 0.4.9 → 0.4.35

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.
data/.gitignore CHANGED
@@ -4,4 +4,3 @@ doc
4
4
  .DS_Store
5
5
  /Gemfile.lock
6
6
  /notes
7
- /*.gem
data/.testme ADDED
@@ -0,0 +1,8 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+ require "bundler/setup"
4
+ Bundler.require :default, :test
5
+
6
+ TESTME_DIR = '/test/'
7
+ TESTME_FORMAT = :console
8
+ TESTME_COLORS = :default
data/Gemfile CHANGED
@@ -2,5 +2,4 @@ source :rubygems
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'rake'
6
5
  gem 'rspec', '>= 2.11.0'
data/README.md CHANGED
@@ -39,43 +39,28 @@
39
39
 
40
40
  ## Setup
41
41
 
42
- `gem install testme`
42
+ #### Put in your Gemfile
43
43
 
44
- *Then in your project root directory*
44
+ `gem "testme", :git => "git@github.com:DanielShuey/testme.git"`
45
45
 
46
- `testme setup`
47
-
48
- /.testme
49
- /test/
50
- /test/app.test.rb
46
+ ## Config
51
47
 
52
- *Default .testme boiler plate on setup*
53
- *this might need to be reconfigured to cater to your project*
48
+ ##### Put a `.testme` file in your project root to set up a bootstrap
49
+
50
+ ### Config Boiler plate
54
51
 
55
- require "testme"
56
-
57
- TESTME_DIR = '/test/'
58
- TESTME_SUFFIX = '.test.rb'
59
- TESTME_FORMAT = :console
60
- TESTME_COLORS = :default
61
-
62
- #### Example config with bundler
52
+ *in ~/project_root/.testme*
63
53
 
64
54
  require "rubygems"
65
55
  require "bundler"
66
56
  require "bundler/setup"
67
57
  Bundler.require :default, :test
68
-
58
+
69
59
  TESTME_DIR = '/test/'
70
- TESTME_SUFFIX = '.test.rb'
71
60
  TESTME_FORMAT = :console
72
61
  TESTME_COLORS = :default
73
-
74
- ## Config
75
-
76
- In your project root will be a `.testme` file, this is your bootstrap that runs before your tests
77
-
78
- The `/test/` folder will house all your test files, you can change this in your bootstrap
62
+
63
+ ***
79
64
 
80
65
  ### Config options
81
66
 
@@ -99,19 +84,19 @@ TESTME_COLORS = :default
99
84
  #### Test all
100
85
  default test folder: `/test/**/*`
101
86
 
102
- $ testme
87
+ $ bundle exec testme
103
88
 
104
89
  #### Test all in directory
105
90
 
106
- $ testme test/features
91
+ $ bundle exec testme test/features
107
92
 
108
93
  #### Test file
109
94
 
110
- $ testme test/account.test.rb
95
+ $ bundle exec testme test/account.test.rb
111
96
 
112
97
  #### Inline testing
113
98
 
114
- $ testme app/models
99
+ $ bundle exec testme app/models
115
100
 
116
101
  ##### Inline testing examples
117
102
 
data/bin/testme CHANGED
@@ -1,70 +1,32 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- if ARGV[0] == 'setup'
4
-
5
- puts 'Creating bootstrap "/.testme"'
6
-
7
- File.open("./.testme", "w") {|f| f.write(
8
- %q[require "testme"
9
-
10
- TESTME_DIR = '/test/'
11
- TESTME_SUFFIX = '.test.rb'
12
- TESTME_FORMAT = :console
13
- TESTME_COLORS = :default]
14
- )} unless File.exists?("./.testme")
15
-
16
- puts 'Creating test folder "/test"'
17
-
18
- Dir::mkdir('./test/') unless File.directory?("./test/") || File.exists?("./test/")
19
-
20
- puts 'Creating empty test file "/app.test.rb"'
21
-
22
- File.open('./test/app.test.rb', 'w') {|f| f.write(
23
- ""
24
- )} unless File.exists?("./.test/app.test.rb")
25
-
26
- puts 'Setup complete'
3
+ TESTME_RUNNING = true
27
4
 
5
+ if File.exists?("#{Dir.pwd}/.testme")
6
+ load "#{Dir.pwd}/.testme"
28
7
  else
8
+ require "testme"
9
+ end
29
10
 
30
- TESTME_INIT = true
31
-
32
- if File.exists?("#{Dir.pwd}/.testme")
33
- load "#{Dir.pwd}/.testme"
34
- else
35
- require "testme"
11
+ if ARGV.empty?
12
+ testme do
13
+ Dir["#{Dir.pwd}/#{TestMe::TESTME_DIR}/**/*.rb"].each{|f| load f }
36
14
  end
37
15
 
38
- TESTME_RUNNING = true
39
-
40
- if ARGV.empty?
41
- testme do
42
- Dir["#{Dir.pwd}/#{TestMe::TESTME_DIR}/**/*#{TestMe::TESTME_SUFFIX}"].each{|f| load f }
43
- end
44
-
45
- else
46
- ARGV.each do |arg|
47
- @file = "#{Dir.pwd}/#{arg}"
48
-
49
- # Check if directory
50
- if File.directory?(@file)
51
- Dir["#{@file}/**/*.rb"].each do |f|
52
- if @file.include?(TestMe::TESTME_SUFFIX)
53
- testme do
54
- load @file
55
- end
56
- else
57
- load @file
58
- end
59
- end
60
- elsif File.exists?(@file)
61
- if @file.include?(TestMe::TESTME_SUFFIX)
62
- testme do
63
- load @file
64
- end
65
- else
16
+ else
17
+ ARGV.each do |arg|
18
+ @file = "#{Dir.pwd}/#{arg}"
19
+
20
+ # Check if directory
21
+ if File.directory? @file
22
+ Dir["#{@file}/**/*.rb"].each{|f| load f }
23
+ elsif File.exists? @file
24
+ if @file.include? '.test.rb'
25
+ testme do
66
26
  load @file
67
27
  end
28
+ else
29
+ require @file
68
30
  end
69
31
  end
70
32
  end
data/lib/logic.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  def testme &block
2
- if defined? TESTME_RUNNING
3
- extend TestMe
4
- block.call
5
- end
2
+ extend TestMe
3
+ block.call
6
4
  end
7
5
 
8
6
  module TestMe
data/lib/testme.rb CHANGED
@@ -54,17 +54,15 @@ def testme █ end
54
54
  # Optional configuration
55
55
  # ---------------------------------------------------------------- #
56
56
  module TestMe
57
- TESTME_DIR = defined?(::TESTME_DIR) ? ::TESTME_DIR : '/test/'
57
+ TESTME_DIR = '/test/' unless defined? TESTME_DIR
58
58
  # default: '/test/'
59
59
 
60
- TESTME_SUFFIX = defined?(::TESTME_SUFFIX) ? ::TESTME_SUFFIX : '.test.rb'
61
-
62
- TESTME_FORMAT = defined?(::TESTME_FORMAT) ? ::TESTME_FORMAT : :console
60
+ TESTME_FORMAT = :console unless defined? TESTME_FORMAT
63
61
  # choose how results are displayed
64
62
  # options: :none, :text, :console
65
63
  # default: :console
66
64
 
67
- TESTME_COLORS = defined?(::TESTME_COLORS) ? ::TESTME_COLORS : :default
65
+ TESTME_COLORS = :default unless defined? TESTME_COLORS
68
66
  # color scheme for console output
69
67
  # options: :default
70
68
  # default: :default
@@ -75,7 +73,7 @@ end
75
73
  # ---------------------------------------------------------------- #
76
74
  # This is here to disable inline tests at runtime
77
75
  # ---------------------------------------------------------------- #
78
- if defined? TESTME_INIT
76
+ if defined? TESTME_RUNNING
79
77
  # Gems
80
78
  require 'rainbow'
81
79
  require 'colorize'
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- TESTME_INIT = true
2
1
  TESTME_RUNNING = true
3
2
  TESTME_FORMAT = :none
4
3
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.35
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -56,10 +56,10 @@ files:
56
56
  - .gitignore
57
57
  - .rspec
58
58
  - .rvmrc
59
+ - .testme
59
60
  - Gemfile
60
61
  - LICENSE
61
62
  - README.md
62
- - Rakefile
63
63
  - bin/testme
64
64
  - lib/double.rb
65
65
  - lib/formatter.rb
@@ -82,18 +82,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
82
  - - ! '>='
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
- segments:
86
- - 0
87
- hash: 286752561
88
85
  required_rubygems_version: !ruby/object:Gem::Requirement
89
86
  none: false
90
87
  requirements:
91
88
  - - ! '>='
92
89
  - !ruby/object:Gem::Version
93
90
  version: '0'
94
- segments:
95
- - 0
96
- hash: 286752561
97
91
  requirements: []
98
92
  rubyforge_project:
99
93
  rubygems_version: 1.8.24
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- task :push do
2
- puts `rm *.gem`
3
- puts `gem build testme.gemspec`
4
- puts `gem push *.gem`
5
- puts `rm *.gem`
6
- end