mini_shoulda 0.1.0 → 0.2.0
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 +3 -0
- data/CHANGELOG +2 -0
- data/Gemfile +6 -0
- data/README.rdoc +5 -0
- data/Rakefile +13 -0
- data/lib/mini_shoulda.rb +1 -1
- data/lib/mini_shoulda/spec.rb +2 -2
- data/lib/mini_shoulda/version.rb +3 -0
- data/mini_shoulda.gemspec +19 -0
- data/test/scope_test.rb +31 -0
- data/test/spec_test.rb +58 -0
- data/test/test_helper.rb +28 -0
- metadata +21 -22
data/.gitignore
ADDED
data/CHANGELOG
CHANGED
data/Gemfile
ADDED
data/README.rdoc
CHANGED
@@ -39,6 +39,11 @@ basic shoulda syntax. A simple example says it all.
|
|
39
39
|
end
|
40
40
|
|
41
41
|
|
42
|
+
= Install
|
43
|
+
|
44
|
+
$ gem install mini_shoulda
|
45
|
+
|
46
|
+
|
42
47
|
= What About ActiveRecord Macros
|
43
48
|
|
44
49
|
It is not my goal to implement all the ActiveRecord macros nor things like should_have_db_columns :)
|
data/Rakefile
ADDED
data/lib/mini_shoulda.rb
CHANGED
data/lib/mini_shoulda/spec.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "mini_shoulda/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'mini_shoulda'
|
7
|
+
s.version = MiniShoulda::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ['Ken Collins']
|
10
|
+
s.email = ['ken@metaskills.net']
|
11
|
+
s.homepage = 'http://github.com/metaskills/mini_shoulda'
|
12
|
+
s.summary = 'MiniShoulda - A minimal shoulda DSL built on top of MiniTest::Spec.'
|
13
|
+
s.description = 'MiniShoulda - A minimal shoulda DSL built on top of MiniTest::Spec.'
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
s.add_dependency('minitest', '~> 2.0.2')
|
19
|
+
end
|
data/test/scope_test.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
# TODO: This test should disappear when we no longer have to patch MiniTest's
|
4
|
+
# Kernel#describe block using our 'mini_shoulda/minitest_describe_patch' file.
|
5
|
+
|
6
|
+
class ScopeTest < MiniShoulda::SpecCase
|
7
|
+
|
8
|
+
should 'use base instance helpers' do
|
9
|
+
assert public_helper?
|
10
|
+
assert protected_helper?
|
11
|
+
end
|
12
|
+
|
13
|
+
should 'use base class helpers and not run this block' do
|
14
|
+
refute true, 'should not have run this'
|
15
|
+
end unless class_helper?
|
16
|
+
|
17
|
+
context 'in another scope' do
|
18
|
+
|
19
|
+
should 'use base instance helpers' do
|
20
|
+
assert public_helper?
|
21
|
+
assert protected_helper?
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'use base class helpers and not run this block' do
|
25
|
+
refute true, 'should not have run this'
|
26
|
+
end unless class_helper?
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
end
|
data/test/spec_test.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SpecTest < MiniShoulda::SpecCase
|
4
|
+
|
5
|
+
before do
|
6
|
+
@level0 = 'level0'
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should keep it blocks working' do
|
10
|
+
assert true
|
11
|
+
end
|
12
|
+
|
13
|
+
should 'add should blocks' do
|
14
|
+
assert true
|
15
|
+
end
|
16
|
+
|
17
|
+
should_eventually 'is working!' do
|
18
|
+
refute true, 'should_eventually is not working if this test fails'
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'with new scope' do
|
22
|
+
|
23
|
+
it 'should keep it blocks working' do
|
24
|
+
assert true
|
25
|
+
end
|
26
|
+
|
27
|
+
should 'add should blocks' do
|
28
|
+
assert true
|
29
|
+
end
|
30
|
+
|
31
|
+
should 'get outter before' do
|
32
|
+
assert @level0
|
33
|
+
assert_equal 'level0', @level0
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'with context scope' do
|
39
|
+
|
40
|
+
setup do
|
41
|
+
@object = Object.new
|
42
|
+
end
|
43
|
+
|
44
|
+
should 'add should blocks' do
|
45
|
+
assert true
|
46
|
+
end
|
47
|
+
|
48
|
+
should 'get objects from setup' do
|
49
|
+
assert @object
|
50
|
+
assert_instance_of Object, @object
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
end
|
58
|
+
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.setup
|
4
|
+
require 'mini_shoulda'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
class MiniShoulda::SpecCase < MiniTest::Spec
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
def class_helper?
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def public_helper?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def protected_helper?
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_shoulda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.2.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Ken Collins
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-03-25 00:00:00 -04:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,15 +21,12 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ~>
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 2
|
30
|
-
- 0
|
31
|
-
- 2
|
32
24
|
version: 2.0.2
|
33
25
|
type: :runtime
|
34
26
|
version_requirements: *id001
|
35
27
|
description: MiniShoulda - A minimal shoulda DSL built on top of MiniTest::Spec.
|
36
|
-
email:
|
28
|
+
email:
|
29
|
+
- ken@metaskills.net
|
37
30
|
executables: []
|
38
31
|
|
39
32
|
extensions: []
|
@@ -41,19 +34,27 @@ extensions: []
|
|
41
34
|
extra_rdoc_files: []
|
42
35
|
|
43
36
|
files:
|
37
|
+
- .gitignore
|
44
38
|
- CHANGELOG
|
39
|
+
- Gemfile
|
45
40
|
- MIT-LICENSE
|
46
41
|
- README.rdoc
|
42
|
+
- Rakefile
|
43
|
+
- lib/mini_shoulda.rb
|
47
44
|
- lib/mini_shoulda/minitest_describe_patch.rb
|
48
45
|
- lib/mini_shoulda/spec.rb
|
49
|
-
- lib/mini_shoulda.rb
|
46
|
+
- lib/mini_shoulda/version.rb
|
47
|
+
- mini_shoulda.gemspec
|
48
|
+
- test/scope_test.rb
|
49
|
+
- test/spec_test.rb
|
50
|
+
- test/test_helper.rb
|
50
51
|
has_rdoc: true
|
51
52
|
homepage: http://github.com/metaskills/mini_shoulda
|
52
53
|
licenses: []
|
53
54
|
|
54
55
|
post_install_message:
|
55
|
-
rdoc_options:
|
56
|
-
|
56
|
+
rdoc_options: []
|
57
|
+
|
57
58
|
require_paths:
|
58
59
|
- lib
|
59
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -61,23 +62,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
62
|
requirements:
|
62
63
|
- - ">="
|
63
64
|
- !ruby/object:Gem::Version
|
64
|
-
segments:
|
65
|
-
- 0
|
66
65
|
version: "0"
|
67
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
67
|
none: false
|
69
68
|
requirements:
|
70
69
|
- - ">="
|
71
70
|
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 0
|
74
71
|
version: "0"
|
75
72
|
requirements: []
|
76
73
|
|
77
74
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.6.2
|
79
76
|
signing_key:
|
80
77
|
specification_version: 3
|
81
78
|
summary: MiniShoulda - A minimal shoulda DSL built on top of MiniTest::Spec.
|
82
|
-
test_files:
|
83
|
-
|
79
|
+
test_files:
|
80
|
+
- test/scope_test.rb
|
81
|
+
- test/spec_test.rb
|
82
|
+
- test/test_helper.rb
|