fun_with_gems 0.0.2 → 0.0.8
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.
- checksums.yaml +5 -13
- data/.document +5 -0
- data/CHANGELOG.markdown +29 -0
- data/Gemfile +6 -11
- data/README.rdoc +125 -1
- data/ROADMAP.md +6 -0
- data/Rakefile +15 -46
- data/VERSION +1 -1
- data/lib/fun_with/gems/api_extender.rb +46 -0
- data/lib/fun_with/gems/configuration_installer.rb +86 -0
- data/lib/fun_with/gems/constant_builder.rb +36 -0
- data/lib/fun_with/gems/core_extender.rb +65 -0
- data/lib/fun_with/gems/core_extensions/module.rb +9 -3
- data/lib/fun_with/gems/fun_gem_api.rb +62 -3
- data/lib/fun_with/gems/gem_api.rb +78 -47
- data/lib/fun_with/gems/inclusionizer.rb +34 -0
- data/lib/fun_with/gems/library_requirer.rb +54 -0
- data/lib/fun_with/gems/rake_class_methods.rb +111 -0
- data/lib/fun_with/gems/rakefile.rb +114 -0
- data/lib/fun_with/gems/root_setter.rb +19 -0
- data/lib/fun_with/gems/test_case_extender.rb +27 -0
- data/lib/fun_with/gems/testing/assertions.rb +22 -0
- data/lib/fun_with/gems/testing/gem_to_test_methods.rb +37 -0
- data/lib/fun_with/gems/testing/test_case_extensions.rb +39 -0
- data/lib/fun_with/gems/testing/test_results.rb +40 -0
- data/lib/fun_with/gems/testing/test_setup.rb +22 -0
- data/lib/fun_with/gems/testing/test_suite_runner.rb +28 -0
- data/lib/fun_with/gems/testing/validator.rb +52 -0
- data/lib/fun_with/gems/versionizer.rb +41 -0
- data/lib/fun_with_gems.rb +15 -14
- data/lib/tasks/fun_with/gems/publish.rake +8 -0
- data/lib/tasks/fun_with/gems/validate.rake +28 -0
- data/tasks/empty/empty.rake +6 -0
- data/tasks/empty/environment.rake +7 -0
- data/test/assertions.rb +15 -0
- data/test/data/test_gems/array_inherits_enumerable/VERSION +1 -0
- data/test/data/test_gems/array_inherits_enumerable/lib/array_inherits_enumerable/core_extensions/comparable.rb +9 -0
- data/test/data/test_gems/array_inherits_enumerable/lib/array_inherits_enumerable/core_extensions/enumerable.rb +10 -0
- data/test/data/test_gems/array_inherits_enumerable/lib/array_inherits_enumerable/core_extensions/numeric.rb +22 -0
- data/test/data/test_gems/array_inherits_enumerable/lib/array_inherits_enumerable.rb +1 -0
- data/test/data/test_gems/fun_with_llamas/lib/fun_with/llamas/gem_api.rb +10 -0
- data/test/data/test_gems/fun_with_llamas/lib/fun_with/llamas/llama.rb +40 -0
- data/test/data/test_gems/fun_with_llamas/lib/fun_with/llamas/trainer.rb +15 -0
- data/test/data/test_gems/integer_magic/VERSION +1 -0
- data/test/data/test_gems/integer_magic/config/gem_config.rb +4 -0
- data/test/data/test_gems/integer_magic/lib/integer_magic/core_extensions/integer.rb +28 -0
- data/test/data/test_gems/integer_magic/lib/integer_magic/core_extensions/numeric.rb +13 -0
- data/test/data/test_gems/integer_magic/lib/integer_magic.rb +1 -0
- data/test/helper.rb +9 -38
- data/test/test_core_extensions.rb +10 -0
- data/test/test_fun_with_gems.rb +9 -16
- data/test/test_library_requirer.rb +13 -0
- data/test/test_the_test_case.rb +24 -0
- data/test/test_the_test_gems.rb +152 -0
- metadata +123 -40
- data/lib/fun_with/gems/mechanic.rb +0 -27
- data/lib/fun_with/gems/validator.rb +0 -69
- data/test/test_gem/lib/fun_with/llamas/llama.rb +0 -9
- data/test/test_gem/lib/fun_with/llamas/trainer.rb +0 -9
- /data/test/{test_gem → data/test_gems/fun_with_llamas}/VERSION +0 -0
- /data/test/{test_gem → data/test_gems/fun_with_llamas}/lib/fun_with_llamas.rb +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module FunWith
|
|
2
|
+
module Gems
|
|
3
|
+
module Testing
|
|
4
|
+
class TestSuiteRunner
|
|
5
|
+
attr_accessor :gem_const
|
|
6
|
+
|
|
7
|
+
def initialize fwgem
|
|
8
|
+
self.gem_const = fwgem
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def passes_tests?
|
|
12
|
+
result = self.run_tests
|
|
13
|
+
result.passed?
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def run_tests
|
|
17
|
+
filepath = self.gem_const.root
|
|
18
|
+
|
|
19
|
+
results = TestResults.new( self.gem_const )
|
|
20
|
+
|
|
21
|
+
puts "running tests on #{self.gem_const} from #{filepath}"
|
|
22
|
+
results.output = `cd #{filepath} && rake test`
|
|
23
|
+
results
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module FunWith
|
|
2
|
+
module Gems
|
|
3
|
+
module Testing
|
|
4
|
+
class Validator
|
|
5
|
+
def self.validate( gem_const )
|
|
6
|
+
self.new( gem_const ).validate
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def initialize( gem_const )
|
|
10
|
+
@gem_const = gem_const
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# should be available via the gem itgem_const?
|
|
14
|
+
def validate
|
|
15
|
+
@fun_gem_errors = []
|
|
16
|
+
|
|
17
|
+
if @gem_const.respond_to?(:root)
|
|
18
|
+
if @gem_const.root.is_a?( FunWith::Files::FilePath )
|
|
19
|
+
@fun_gem_errors << ".root() doesn't exist" unless @gem_const.root.directory?
|
|
20
|
+
@fun_gem_errors << "VERSION file doesn't exist" unless @gem_const.root("VERSION").file?
|
|
21
|
+
@fun_gem_errors << "CHANGELOG.markdown doesn't exist" unless @gem_const.root("CHANGELOG.markdown")
|
|
22
|
+
@fun_gem_errors << "lib directory doesn't exist" unless @gem_const.root("lib").directory?
|
|
23
|
+
else
|
|
24
|
+
@fun_gem_errors << ".root() doesn't give a filepath"
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
@fun_gem_errors << "doesn't respond to .root()"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
if ! @gem_const.respond_to?(:version)
|
|
31
|
+
@fun_gem_errors << "doesn't respond to .version()"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
@fun_gem_errors
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def fun_gem_errors
|
|
38
|
+
@fun_gem_errors
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def git_up_to_date?( filepath )
|
|
42
|
+
# On branch master
|
|
43
|
+
# Your branch is ahead of 'origin/master' by 1 commit.
|
|
44
|
+
# (use "git push" to publish your local commits)
|
|
45
|
+
#
|
|
46
|
+
# nothing to commit, working directory clean
|
|
47
|
+
#
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module FunWith
|
|
2
|
+
module Gems
|
|
3
|
+
class Versionizer
|
|
4
|
+
TRAILING_VERSION_STRING_MATCHER = /(?<=-)(\d|\.)+$/
|
|
5
|
+
|
|
6
|
+
def self.versionize( *args )
|
|
7
|
+
self.new.versionize( *args )
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def versionize( gem_const, version_string = nil )
|
|
11
|
+
version_string = infer_version_string_for_gem( gem_const )
|
|
12
|
+
FunWith::VersionStrings.versionize( gem_const, version_string ) if version_string.fwf_present?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
protected
|
|
16
|
+
def infer_version_string_for_gem( gem_const, version_string = nil )
|
|
17
|
+
version_string || version_string_from_gem_version_file( gem_const ) || version_string_from_gem_folder( gem_const )
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def version_string_from_gem_version_file( gem_const )
|
|
21
|
+
if gem_const.respond_to?(:root)
|
|
22
|
+
vfile = gem_const.root( "VERSION" )
|
|
23
|
+
(vfile.file? && vfile.readable?) ? vfile.read : nil
|
|
24
|
+
else
|
|
25
|
+
nil
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# most gems get installed into a rubygems folder under the folder name <gem_name>-X.XX.X
|
|
30
|
+
def version_string_from_gem_folder( gem_const )
|
|
31
|
+
if gem_const.respond_to?(:root)
|
|
32
|
+
if m = gem_const.root.path.match( TRAILING_VERSION_STRING_MATCHER )
|
|
33
|
+
return m[0]
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
return nil
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
data/lib/fun_with_gems.rb
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
require "fun_with_version_strings"
|
|
2
2
|
require "fun_with_files"
|
|
3
3
|
|
|
4
|
-
# FunWith::VersionStrings.versionize( FunWith::Files )
|
|
5
|
-
|
|
6
4
|
lib_dir = __FILE__.fwf_filepath.dirname
|
|
7
|
-
lib_dir.join( "fun_with", "gems"
|
|
8
|
-
lib_dir.join( "fun_with", "gems", "fun_gem_api.rb" ).requir
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
lib_dir.join( "fun_with", "gems" ).requir
|
|
6
|
+
# lib_dir.join( "fun_with", "gems", "fun_gem_api.rb" ).requir
|
|
7
|
+
|
|
8
|
+
FunWith::Gems.extend( FunWith::Gems::GemAPI ) # For most FunGems, this would happen automatically.
|
|
9
|
+
|
|
10
|
+
# Skip the things FunWith::Files does for itself
|
|
11
|
+
FunWith::Gems.make_gem_fun( FunWith::Files,
|
|
12
|
+
require: false,
|
|
13
|
+
set_root: false,
|
|
14
|
+
set_version: false #,
|
|
15
|
+
# configuration: false
|
|
16
|
+
)
|
|
17
|
+
|
|
12
18
|
|
|
13
|
-
FunWith::Gems.
|
|
19
|
+
FunWith::Gems.make_gem_fun( FunWith::Gems )
|
|
14
20
|
|
|
15
|
-
#
|
|
16
|
-
# rootifies
|
|
17
|
-
# requir's the lib/fun_with directory
|
|
18
|
-
# Do this because FunWithFiles doesn't do it itself.
|
|
19
|
-
FunWith::Gems.make_gem_fun( FunWith::Files, :require => false, :set_root => false, :set_version => false )
|
|
20
|
-
FunWith::Gems.make_gem_fun( "FunWith::Gems" )
|
|
21
|
+
# Module.send( :include, FunWith::Gems::CoreExtensions::Module ) # happens automatically
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
namespace :fun_with do
|
|
2
|
+
namespace :gems do
|
|
3
|
+
desc "Validate your gem (passes tests, has FunWith::Gems functionality)."
|
|
4
|
+
task :validate do
|
|
5
|
+
g = FunWith::Gems::Rakefile.get_gem
|
|
6
|
+
|
|
7
|
+
if g.is_fun_gem?
|
|
8
|
+
if g.valid_gem?
|
|
9
|
+
puts "#{g} passed validation."
|
|
10
|
+
|
|
11
|
+
if g.passes_tests?
|
|
12
|
+
puts "#{g} passed its test suite"
|
|
13
|
+
true
|
|
14
|
+
else
|
|
15
|
+
puts "#{g} failed its test suite"
|
|
16
|
+
false
|
|
17
|
+
end
|
|
18
|
+
else
|
|
19
|
+
puts "#{g} failed validation"
|
|
20
|
+
false
|
|
21
|
+
end
|
|
22
|
+
else
|
|
23
|
+
puts "#{g} is not a FunWith::Gems gem."
|
|
24
|
+
false
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/test/assertions.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
module FunWith
|
|
3
|
+
module Gems
|
|
4
|
+
module Testing
|
|
5
|
+
# This is where you put custom assertions that only need to be available to the gem's test suite.
|
|
6
|
+
# To make an assertion available to a gem that uses this gem as a dependency, put it in
|
|
7
|
+
# <GEM_ROOT>/lib/<GEM>/testing/assertions.rb
|
|
8
|
+
module Assertions
|
|
9
|
+
def assert_example_assertion
|
|
10
|
+
assert true
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This example uses the inclusionize system
|
|
2
|
+
module ArrayInheritsEnumerable
|
|
3
|
+
module CoreExtensions
|
|
4
|
+
module Numeric
|
|
5
|
+
module Constants
|
|
6
|
+
COUNTLESS = Float::INFINITY
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
module ClassMethods
|
|
10
|
+
def give_me_a_random_number
|
|
11
|
+
:no
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module InstanceMethods
|
|
16
|
+
def prime?
|
|
17
|
+
:maybe
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
FunWith::Gems.make_gem_fun( "ArrayInheritsEnumerable" )
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module FunWith
|
|
2
|
+
module Llamas
|
|
3
|
+
class Llama
|
|
4
|
+
attr_accessor :name
|
|
5
|
+
|
|
6
|
+
def initialize( name )
|
|
7
|
+
@name = name
|
|
8
|
+
@regards = {}
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def scorns( trainer )
|
|
12
|
+
remember_trainer( trainer )
|
|
13
|
+
@regards[ trainer.name ] -= 1
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Ptooi!
|
|
17
|
+
def spit( trainer )
|
|
18
|
+
remember_trainer( trainer )
|
|
19
|
+
@regards[ trainer.name ] -= 1
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def brushed_by( trainer )
|
|
23
|
+
remember_trainer( trainer )
|
|
24
|
+
@regards[ trainer.name ] += 1
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def remember_trainer( trainer )
|
|
28
|
+
@regards[ trainer.name ] ||= 0
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def knows?( trainer )
|
|
32
|
+
@regards.has_key?( trainer.name )
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def trainer_score( trainer )
|
|
36
|
+
@regards[ trainer.name ]
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.1.4
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module IntegerMagic
|
|
2
|
+
module CoreExtensions
|
|
3
|
+
module Integer # the CoreClassName
|
|
4
|
+
include FunWith::Gems::Inclusionizer
|
|
5
|
+
|
|
6
|
+
module Constants
|
|
7
|
+
ZERO = 0
|
|
8
|
+
HIGHEST_PRIME_NUMBER = 9
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module ClassMethods
|
|
12
|
+
def thinking_of_a_number_between_zero_and( n )
|
|
13
|
+
return :you_guessed_correctly
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module InstanceMethods
|
|
18
|
+
def even?
|
|
19
|
+
self % 2 == 0
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def odd?
|
|
23
|
+
self % 2 == 1
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module IntegerMagic
|
|
2
|
+
module CoreExtensions
|
|
3
|
+
|
|
4
|
+
# uses the simpler module definition (none of the ::ClassMethods / ::InstanceMethods submodule nonsense)
|
|
5
|
+
# but still gets included properly
|
|
6
|
+
module Numeric
|
|
7
|
+
def integer?
|
|
8
|
+
self.is_a?( Integer )
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
FunWith::Gems.make_gem_fun( "IntegerMagic" )
|
data/test/helper.rb
CHANGED
|
@@ -1,45 +1,16 @@
|
|
|
1
1
|
require 'fun_with_testing'
|
|
2
|
-
|
|
3
|
-
# require 'simplecov'
|
|
4
|
-
#
|
|
5
|
-
# module SimpleCov::Configuration
|
|
6
|
-
# def clean_filters
|
|
7
|
-
# @filters = []
|
|
8
|
-
# end
|
|
9
|
-
# end
|
|
10
|
-
#
|
|
11
|
-
# SimpleCov.configure do
|
|
12
|
-
# clean_filters
|
|
13
|
-
# load_adapter 'test_frameworks'
|
|
14
|
-
# end
|
|
15
|
-
#
|
|
16
|
-
# ENV["COVERAGE"] && SimpleCov.start do
|
|
17
|
-
# add_filter "/.rvm/"
|
|
18
|
-
# end
|
|
19
|
-
|
|
20
|
-
# require 'rubygems'
|
|
21
|
-
# require 'bundler'
|
|
22
|
-
|
|
23
|
-
# begin
|
|
24
|
-
# Bundler.setup(:default, :development)
|
|
25
|
-
# rescue Bundler::BundlerError => e
|
|
26
|
-
# $stderr.puts e.message
|
|
27
|
-
# $stderr.puts "Run `bundle install` to install missing gems"
|
|
28
|
-
# exit e.status_code
|
|
29
|
-
# end
|
|
30
|
-
# require 'test/unit'
|
|
31
|
-
# require 'shoulda'
|
|
32
|
-
|
|
33
|
-
# $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
34
|
-
# $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
35
|
-
|
|
36
2
|
require 'fun_with_gems'
|
|
37
3
|
|
|
38
|
-
FunWith::Gems
|
|
4
|
+
unless defined?(FunWith::Gems)
|
|
5
|
+
puts "FunWith::Gems not defined"
|
|
6
|
+
end
|
|
39
7
|
|
|
40
|
-
#
|
|
41
|
-
|
|
8
|
+
# I don't recall why this was needed
|
|
9
|
+
FunWith::Gems.make_gem_fun( FunWith::Testing, :require => false )
|
|
42
10
|
|
|
43
11
|
class FunWith::Gems::TestCase < FunWith::Testing::TestCase
|
|
44
|
-
include
|
|
12
|
+
# include: true option means that, within the test suite, the gem's namespace
|
|
13
|
+
# is included, so classes within that namespace can be referenced without using
|
|
14
|
+
# the namespace.
|
|
15
|
+
self.make_testing_fun( FunWith::Gems, include: true )
|
|
45
16
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestCoreExtensions < FunWith::Gems::TestCase
|
|
4
|
+
context "testing core extensions" do
|
|
5
|
+
should "have this test under core extensions" do
|
|
6
|
+
assert_respond_to( Module.new, :is_fun_gem? )
|
|
7
|
+
assert_false( Module.new.is_fun_gem? )
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
data/test/test_fun_with_gems.rb
CHANGED
|
@@ -10,6 +10,12 @@ class TestFunWithGems < FunWith::Gems::TestCase
|
|
|
10
10
|
|
|
11
11
|
should "be a proper gem" do
|
|
12
12
|
assert_respond_to( FunWith::Gems, :version )
|
|
13
|
+
assert_respond_to( FunWith::Gems, :is_fun_gem? )
|
|
14
|
+
assert( FunWith::Gems.is_fun_gem? )
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
should "be a proper gem (using the assertion method provided by Testing::Assertions)" do
|
|
18
|
+
assert_fun_gem( FunWith::Gems )
|
|
13
19
|
end
|
|
14
20
|
|
|
15
21
|
should "respond to API methods" do
|
|
@@ -31,26 +37,13 @@ class TestFunWithGems < FunWith::Gems::TestCase
|
|
|
31
37
|
should "respond to fwf_...() methods" do
|
|
32
38
|
assert_respond_to( "", :fwf_blank? )
|
|
33
39
|
assert_respond_to( "", :fwf_present? )
|
|
40
|
+
|
|
41
|
+
assert_respond_to( Set.new, :fwf_blank? )
|
|
42
|
+
assert_respond_to( Set.new, :fwf_present? )
|
|
34
43
|
end
|
|
35
44
|
|
|
36
45
|
should "validate self" do
|
|
37
46
|
assert FunWith::Gems.valid_gem?
|
|
38
47
|
end
|
|
39
48
|
end
|
|
40
|
-
|
|
41
|
-
context "testing gem loading" do
|
|
42
|
-
should "load llama gem" do
|
|
43
|
-
FunWith::Gems.root( "test", "test_gem", "lib", "fun_with_llamas.rb" ).requir
|
|
44
|
-
|
|
45
|
-
assert defined?( FunWith )
|
|
46
|
-
assert defined?( FunWith::Llamas )
|
|
47
|
-
assert defined?( FunWith::Llamas::Llama )
|
|
48
|
-
assert defined?( FunWith::Llamas::Trainer )
|
|
49
|
-
assert_respond_to( FunWith::Llamas::Llama.new, :spit )
|
|
50
|
-
|
|
51
|
-
assert_equal 3, FunWith::Llamas.version.major
|
|
52
|
-
|
|
53
|
-
assert FunWith::Llamas.valid_gem?
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
49
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestLibraryRequirer < FunWith::Gems::TestCase
|
|
4
|
+
context "testing guess_caller_file()" do
|
|
5
|
+
should "meet expectations" do
|
|
6
|
+
lb = LibraryRequirer.new
|
|
7
|
+
|
|
8
|
+
assert_equal "hello_there/world.rb", lb.constant_name_to_filename( "HelloThere::World" )
|
|
9
|
+
assert_equal "swing_set/api_manager.rb", lb.constant_name_to_filename( "SwingSet::APIManager" )
|
|
10
|
+
assert_equal "tasks.rb", lb.constant_name_to_filename( "Tasks" )
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestTheTestCase < FunWith::Gems::TestCase
|
|
4
|
+
context "putting a test case through its paces" do
|
|
5
|
+
should "have GemToTest methods installed" do
|
|
6
|
+
assert_respond_to self, :gem_to_test
|
|
7
|
+
assert_respond_to self.class, :gem_to_test
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
should "have external fun_gem assertions installed" do
|
|
11
|
+
assert_respond_to self, :assert_gem_is_fine
|
|
12
|
+
assert_respond_to self, :assert_fun_gem
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
should "know which gem is being tested" do
|
|
16
|
+
assert_equal FunWith::Gems, self.gem_to_test
|
|
17
|
+
assert_equal FunWith::Gems, self.class.gem_to_test
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
should "have assertions from test/assertions.rb available within this test suite" do
|
|
21
|
+
assert_respond_to self, :assert_example_assertion
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|