shared_tests 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *~
2
+ *.gem
3
+ .bundle
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in shared_tests.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,16 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ shared_tests (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ activesupport (3.0.10)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ activesupport
16
+ shared_tests!
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+ require "active_support/inflector"
3
+
4
+ module SharedTests
5
+ def self.included(base)
6
+ base.send :extend, InstanceMethods
7
+ end
8
+
9
+ module InstanceMethods
10
+
11
+ def assert_shared_tests(options = {}, &block)
12
+ shared_test = options.delete(:of)
13
+ include "#{shared_test.to_s.camelize}Tests".constantize
14
+
15
+ define_method(:setup) do
16
+ super()
17
+ instance_eval(&block)
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module SharedTests
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "shared_tests/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "shared_tests"
7
+ s.version = SharedTests::VERSION
8
+ s.authors = ["Joaquin Rivera Padron"]
9
+ s.email = ["joahking@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Minimal DSL to write shared tests for Test::Unit}
12
+ s.description = %q{Assert shared behavior of objects easily using: assert_shared_tests :of => :some_shared_behavior }
13
+
14
+ s.rubyforge_project = "shared_tests"
15
+
16
+ s.add_development_dependency "activesupport"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ end
@@ -0,0 +1,30 @@
1
+ require 'test/unit'
2
+ require File.expand_path(File.dirname(__FILE__) + '/../lib/shared_tests')
3
+
4
+ # shared behavior we want to test
5
+ module ProgrammingMotherfucker
6
+ def who_am_i?
7
+ "a programming motherfucker"
8
+ end
9
+ end
10
+
11
+ # hacker instances are programming motherfuckers
12
+ class Hacker
13
+ include ProgrammingMotherfucker
14
+ end
15
+
16
+ # declaring the shared behavior test examples
17
+ module ProgrammingMotherfuckerTests
18
+ def test_is_a_programming_motherfucker?
19
+ assert @me.who_am_i? == "a programming motherfucker"
20
+ end
21
+ end
22
+
23
+ # and the hacker tests
24
+ class HackerTest < Test::Unit::TestCase
25
+ include SharedTests
26
+
27
+ assert_shared_tests :of => :programming_motherfucker do
28
+ @me = Hacker.new
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shared_tests
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Joaquin Rivera Padron
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-10-22 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activesupport
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :development
33
+ version_requirements: *id001
34
+ description: "Assert shared behavior of objects easily using: assert_shared_tests :of => :some_shared_behavior "
35
+ email:
36
+ - joahking@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - Gemfile.lock
47
+ - Rakefile
48
+ - lib/shared_tests.rb
49
+ - lib/shared_tests/version.rb
50
+ - shared_tests.gemspec
51
+ - test/shared_tests_test.rb
52
+ homepage: ""
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ requirements: []
79
+
80
+ rubyforge_project: shared_tests
81
+ rubygems_version: 1.8.11
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Minimal DSL to write shared tests for Test::Unit
85
+ test_files: []
86
+