test-belt 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -27,9 +27,9 @@ TestBelt only impacts your testing environment or setup and is designed only for
27
27
  # other testing gem dependencies ...
28
28
  end
29
29
 
30
- == Test Helper
31
- Using the TestBelt test helper loads in the testing libraries I like and use. In your test files or a common test helper file, require in the helper:
32
- require 'test_belt/helper'
30
+ == Test Helpers
31
+ Requiring test belt loads in the testing libraries I like and use. In your test files or a common test helper file, require in test belt:
32
+ require 'test_belt'
33
33
 
34
34
  This will give you the following tools. I use most of these helpers in testing this gem. To see examples of these in action, peruse this gem's test files (https://github.com/kelredd/test-belt/tree/master/test) and run the test suite with:
35
35
  $ rake test
@@ -64,7 +64,8 @@ I've added some contexts callbacks in addition to the setup/teardown callbacks S
64
64
  * suite_started / on_suite_started - runs one time before any of the tests across the entire test suite are run
65
65
  * suite_finished / on_suite_finished - runs one time after all of the tests across the entire test suite are run
66
66
 
67
- == Rake tasks for running tests
67
+ == Generated Rake tasks
68
+ === For running tests
68
69
  TestBelt can provide an automatic set of rake tasks for testing subsets of your code base. These tasks are defined based on the structure of your test files. To use this first add this to your Rakefile:
69
70
 
70
71
  require 'rubygems'
@@ -75,6 +76,14 @@ To see what this gives you:
75
76
 
76
77
  $ rake -T
77
78
 
79
+ === IRB with your environment loaded
80
+ Many times in developing code, I need to quickly load up IRB with my environment. TestBelt will give you a rake task for doing that. Simply create an env.rb file that loads your environment in your test file directory (/test for example). See https://github.com/kelredd/test-belt/tree/master/test/env.rb and demo for this gem with:
81
+
82
+ $ rake irb
83
+ > TestBelt
84
+ => TestBelt
85
+ >
86
+
78
87
  == License
79
88
 
80
89
  Copyright (c) 2010 Kelly D. Redding
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'rake/gempackagetask'
3
-
4
3
  require 'lib/test_belt/version'
5
4
 
6
5
  spec = Gem::Specification.new do |s|
@@ -47,9 +47,20 @@ module TestBelt::RakeTasks
47
47
 
48
48
  class << self
49
49
  def for(test_namespace = :test)
50
+ self.irb_task(test_namespace.to_s)
50
51
  self.to_tasks(test_namespace.to_s)
51
52
  end
52
53
 
54
+ def irb_task(path)
55
+ env_file = File.join(path, "env.rb")
56
+ if File.exist?(env_file)
57
+ desc "Open irb preloaded with #{env_file}"
58
+ task :irb do
59
+ sh "irb -rubygems -r ./#{env_file}"
60
+ end
61
+ end
62
+ end
63
+
53
64
  def to_tasks(path)
54
65
  suite_name = File.basename(path)
55
66
 
@@ -3,7 +3,7 @@ module TestBelt
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
data/lib/test_belt.rb CHANGED
@@ -1,2 +1,2 @@
1
- module TestBelt
2
- end
1
+ module TestBelt; end
2
+ require 'test_belt/helper'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-belt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding