MacSpec 0.3.1
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/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +20 -0
- data/Rakefile +53 -0
- data/lib/mac_spec.rb +59 -0
- data/lib/mac_spec/matcher_system.rb +19 -0
- data/lib/mac_spec/matcher_system/built_in/change_expectations.rb +36 -0
- data/lib/mac_spec/matcher_system/built_in/enumerable_expectations.rb +43 -0
- data/lib/mac_spec/matcher_system/built_in/error_expectations.rb +68 -0
- data/lib/mac_spec/matcher_system/built_in/operator_expectations.rb +45 -0
- data/lib/mac_spec/matcher_system/built_in/truth_expectations.rb +148 -0
- data/lib/mac_spec/matcher_system/core/def_matcher.rb +14 -0
- data/lib/mac_spec/matcher_system/core/exceptions.rb +7 -0
- data/lib/mac_spec/matcher_system/core/expectation_builder.rb +11 -0
- data/lib/mac_spec/matcher_system/core/matcher_builder.rb +53 -0
- data/lib/mac_spec/matcher_system/core/modals.rb +36 -0
- data/lib/mac_spec/mocking_framework.rb +13 -0
- data/lib/mac_spec/mocking_framework/extensions/kernel_extension.rb +14 -0
- data/lib/mac_spec/mocking_framework/extensions/object_extension.rb +74 -0
- data/lib/mac_spec/mocking_framework/message_expectation.rb +127 -0
- data/lib/mac_spec/mocking_framework/mock.rb +20 -0
- data/lib/mac_spec/testing_framework.rb +13 -0
- data/lib/mac_spec/testing_framework/core/functions.rb +26 -0
- data/lib/mac_spec/testing_framework/core/kernel_extension.rb +27 -0
- data/lib/mac_spec/testing_framework/core/test_case_class_methods.rb +90 -0
- data/lib/mac_spec/version.rb +3 -0
- data/test/all.rb +6 -0
- data/test/mac_spec/matcher_system/built_in/change_expectations_test.rb +68 -0
- data/test/mac_spec/matcher_system/built_in/enumerable_expectations_test.rb +91 -0
- data/test/mac_spec/matcher_system/built_in/error_expectations_test.rb +144 -0
- data/test/mac_spec/matcher_system/built_in/operator_expectations_test.rb +136 -0
- data/test/mac_spec/matcher_system/built_in/truth_expectations_test.rb +373 -0
- data/test/mac_spec/matcher_system/core/def_matcher_test.rb +100 -0
- data/test/mac_spec/matcher_system/core/expectation_builder_test.rb +34 -0
- data/test/mac_spec/matcher_system/core/matcher_builder_test.rb +72 -0
- data/test/mac_spec/matcher_system/core/modals_test.rb +39 -0
- data/test/mac_spec/matcher_system/script.rb +29 -0
- data/test/mac_spec/matcher_system/test_helper.rb +2 -0
- data/test/mac_spec/mocking_framework/extensions/kernel_extension_test.rb +37 -0
- data/test/mac_spec/mocking_framework/extensions/object_extension_test.rb +9 -0
- data/test/mac_spec/mocking_framework/message_expectation_test.rb +9 -0
- data/test/mac_spec/mocking_framework/mock_test.rb +9 -0
- data/test/mac_spec/mocking_framework/regression/mocking_class_methods_test.rb +96 -0
- data/test/mac_spec/mocking_framework/regression/negative_expectation_test.rb +33 -0
- data/test/mac_spec/mocking_framework/regression/stub_test.rb +19 -0
- data/test/mac_spec/mocking_framework/test_helper.rb +1 -0
- data/test/mac_spec/test_helper.rb +1 -0
- data/test/mac_spec/testing_framework/performance/x_test_performance.rb +125 -0
- data/test/mac_spec/testing_framework/regression/before_test.rb +32 -0
- data/test/mac_spec/testing_framework/regression/deep_nested_example_groups_test.rb +20 -0
- data/test/mac_spec/testing_framework/regression/description_string_test.rb +13 -0
- data/test/mac_spec/testing_framework/regression/example_name_test.rb +11 -0
- data/test/mac_spec/testing_framework/regression/inherit_not_double_test.rb +39 -0
- data/test/mac_spec/testing_framework/regression/surrounding_module_scope_test.rb +31 -0
- data/test/mac_spec/testing_framework/regression/testing_functions_test.rb +66 -0
- data/test/mac_spec/testing_framework/test_helper.rb +1 -0
- data/test/test_helper.rb +1 -0
- metadata +150 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../test_helper.rb"
|
2
|
+
|
3
|
+
describe "top level" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@horst = "Horst"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "example1" do
|
10
|
+
@horst.should eql("Horst")
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "second level" do
|
14
|
+
|
15
|
+
before do
|
16
|
+
@inge = "Inge"
|
17
|
+
@horst = "NoHorst!"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "there should be NoHorst" do
|
21
|
+
@horst.should eql("NoHorst!")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "Inge should be here" do
|
25
|
+
@inge.should be("Inge")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "Horst should still be Horst" do
|
30
|
+
@horst.should be("Horst")
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../test_helper.rb"
|
2
|
+
|
3
|
+
describe "top level EG contains a before and deeper nested group" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@var_defined_in_top_level_e_g = "Horst"
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "2" do
|
10
|
+
describe "3" do
|
11
|
+
describe "4" do
|
12
|
+
describe "5" do
|
13
|
+
it "should know var_defined_in_top_level_e_g" do
|
14
|
+
@var_defined_in_top_level_e_g.should be("Horst")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../test_helper.rb"
|
2
|
+
|
3
|
+
describe "Prevent tests from beeing handed down" do
|
4
|
+
it "test it" do
|
5
|
+
assert true
|
6
|
+
end
|
7
|
+
|
8
|
+
$testcase = self
|
9
|
+
it "does not inherit tests" do
|
10
|
+
$testcase.instance_methods.should_not include(:test_test_it)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "doesn't make testname unusable" do
|
14
|
+
assert true
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "context" do
|
18
|
+
|
19
|
+
before do
|
20
|
+
@var_from_nesting = 1
|
21
|
+
end
|
22
|
+
$testcase = self
|
23
|
+
it "does not inherit tests from outer description block" do
|
24
|
+
$testcase.instance_methods.should_not include(:test_does_not_inherit_tests)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "does not inherit tests from outer description block that are defined after nesting" do
|
28
|
+
$testcase.instance_methods.should_not include(:test_does_not_inherit_tests_that_are_defined_after_nesting)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "doesn't make testname unusable" do
|
32
|
+
assert true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "does not inherit tests that are defined after nesting" do
|
37
|
+
@var_from_nesting.should be_nil
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../test_helper.rb"
|
2
|
+
|
3
|
+
module Hello
|
4
|
+
|
5
|
+
module Again
|
6
|
+
class A;end
|
7
|
+
def hello_again
|
8
|
+
"hello_again"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Hello
|
14
|
+
module Again
|
15
|
+
describe "Surrounding Module" do
|
16
|
+
it "has access to surrounding module" do
|
17
|
+
hello_again.should eql("hello_again")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "has access to Class in surrounding module " do
|
21
|
+
A
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "in nested context" do
|
25
|
+
it "has access to surrounding module" do
|
26
|
+
hello_again.should eql("hello_again")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../test_helper.rb"
|
2
|
+
|
3
|
+
describe MacSpec::TestingFramework::Functions do
|
4
|
+
|
5
|
+
describe "determine_class_name(name)" do
|
6
|
+
it "Horst -> Horst" do
|
7
|
+
MacSpec::TestingFramework::Functions::determine_class_name("Horst").should eql("Horst")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "HorstTest -> HorstTest" do
|
11
|
+
MacSpec::TestingFramework::Functions::determine_class_name("HorstTest").should eql("HorstTest")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "HorstTest Hello -> HorstTestHello" do
|
15
|
+
MacSpec::TestingFramework::Functions::determine_class_name("HorstTest Hello").should eql("HorstTestHello")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "Horst test hello -> HorstTestHello" do
|
19
|
+
MacSpec::TestingFramework::Functions::determine_class_name("Horst test hello").should eql("HorstTestHello")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#make_constantizeable(string)" do
|
24
|
+
it "returns arg if arg is not a string" do
|
25
|
+
MacSpec::TestingFramework::Functions.make_constantizeable(1).should eql(1)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "removes nonword chars" do
|
29
|
+
MacSpec::TestingFramework::Functions.make_constantizeable("@hello").should eql("hello")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "dosn't remove undescores" do
|
33
|
+
MacSpec::TestingFramework::Functions.make_constantizeable("_hel_lo").should eql("_hel_lo")
|
34
|
+
end
|
35
|
+
|
36
|
+
it "removes leading numbers" do
|
37
|
+
MacSpec::TestingFramework::Functions.make_constantizeable("11hello").should eql("hello")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "removes leading numbers but not undescores" do
|
41
|
+
MacSpec::TestingFramework::Functions.make_constantizeable("11_hello").should eql("_hello")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "doesn't remove inline whitespace" do
|
45
|
+
MacSpec::TestingFramework::Functions.make_constantizeable("h e l l o").should eql("h e l l o")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "removes leading whitespace" do
|
49
|
+
MacSpec::TestingFramework::Functions.make_constantizeable(" hello").should eql("hello")
|
50
|
+
MacSpec::TestingFramework::Functions.make_constantizeable("1 hello").should eql("hello")
|
51
|
+
MacSpec::TestingFramework::Functions.make_constantizeable("1 1 @ hello").should eql("hello")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#string?" do
|
56
|
+
it "recognizes a String" do
|
57
|
+
MacSpec::TestingFramework::Functions.string?("string").should be(true)
|
58
|
+
end
|
59
|
+
|
60
|
+
[1, 1.0, true, false, /regex/, (1..2), class<<self;end].each do |thing|
|
61
|
+
it "recognizes #{thing} to not be a string" do
|
62
|
+
MacSpec::TestingFramework::Functions.string?(thing).should be(false)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../test_helper.rb"
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../lib/mac_spec.rb'
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: MacSpec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 3
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Matthias Hennemeyer
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-03-03 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: MacSpec is a feature minimal RSpec clone that is specifically built to work with MacRuby.
|
22
|
+
email: mhennemeyer@me.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- LICENSE
|
29
|
+
- README.rdoc
|
30
|
+
files:
|
31
|
+
- .document
|
32
|
+
- .gitignore
|
33
|
+
- LICENSE
|
34
|
+
- README.rdoc
|
35
|
+
- Rakefile
|
36
|
+
- lib/mac_spec.rb
|
37
|
+
- lib/mac_spec/matcher_system.rb
|
38
|
+
- lib/mac_spec/matcher_system/built_in/change_expectations.rb
|
39
|
+
- lib/mac_spec/matcher_system/built_in/enumerable_expectations.rb
|
40
|
+
- lib/mac_spec/matcher_system/built_in/error_expectations.rb
|
41
|
+
- lib/mac_spec/matcher_system/built_in/operator_expectations.rb
|
42
|
+
- lib/mac_spec/matcher_system/built_in/truth_expectations.rb
|
43
|
+
- lib/mac_spec/matcher_system/core/def_matcher.rb
|
44
|
+
- lib/mac_spec/matcher_system/core/exceptions.rb
|
45
|
+
- lib/mac_spec/matcher_system/core/expectation_builder.rb
|
46
|
+
- lib/mac_spec/matcher_system/core/matcher_builder.rb
|
47
|
+
- lib/mac_spec/matcher_system/core/modals.rb
|
48
|
+
- lib/mac_spec/mocking_framework.rb
|
49
|
+
- lib/mac_spec/mocking_framework/extensions/kernel_extension.rb
|
50
|
+
- lib/mac_spec/mocking_framework/extensions/object_extension.rb
|
51
|
+
- lib/mac_spec/mocking_framework/message_expectation.rb
|
52
|
+
- lib/mac_spec/mocking_framework/mock.rb
|
53
|
+
- lib/mac_spec/testing_framework.rb
|
54
|
+
- lib/mac_spec/testing_framework/core/functions.rb
|
55
|
+
- lib/mac_spec/testing_framework/core/kernel_extension.rb
|
56
|
+
- lib/mac_spec/testing_framework/core/test_case_class_methods.rb
|
57
|
+
- lib/mac_spec/version.rb
|
58
|
+
- test/all.rb
|
59
|
+
- test/mac_spec/matcher_system/built_in/change_expectations_test.rb
|
60
|
+
- test/mac_spec/matcher_system/built_in/enumerable_expectations_test.rb
|
61
|
+
- test/mac_spec/matcher_system/built_in/error_expectations_test.rb
|
62
|
+
- test/mac_spec/matcher_system/built_in/operator_expectations_test.rb
|
63
|
+
- test/mac_spec/matcher_system/built_in/truth_expectations_test.rb
|
64
|
+
- test/mac_spec/matcher_system/core/def_matcher_test.rb
|
65
|
+
- test/mac_spec/matcher_system/core/expectation_builder_test.rb
|
66
|
+
- test/mac_spec/matcher_system/core/matcher_builder_test.rb
|
67
|
+
- test/mac_spec/matcher_system/core/modals_test.rb
|
68
|
+
- test/mac_spec/matcher_system/script.rb
|
69
|
+
- test/mac_spec/matcher_system/test_helper.rb
|
70
|
+
- test/mac_spec/mocking_framework/extensions/kernel_extension_test.rb
|
71
|
+
- test/mac_spec/mocking_framework/extensions/object_extension_test.rb
|
72
|
+
- test/mac_spec/mocking_framework/message_expectation_test.rb
|
73
|
+
- test/mac_spec/mocking_framework/mock_test.rb
|
74
|
+
- test/mac_spec/mocking_framework/regression/mocking_class_methods_test.rb
|
75
|
+
- test/mac_spec/mocking_framework/regression/negative_expectation_test.rb
|
76
|
+
- test/mac_spec/mocking_framework/regression/stub_test.rb
|
77
|
+
- test/mac_spec/mocking_framework/test_helper.rb
|
78
|
+
- test/mac_spec/test_helper.rb
|
79
|
+
- test/mac_spec/testing_framework/performance/x_test_performance.rb
|
80
|
+
- test/mac_spec/testing_framework/regression/before_test.rb
|
81
|
+
- test/mac_spec/testing_framework/regression/deep_nested_example_groups_test.rb
|
82
|
+
- test/mac_spec/testing_framework/regression/description_string_test.rb
|
83
|
+
- test/mac_spec/testing_framework/regression/example_name_test.rb
|
84
|
+
- test/mac_spec/testing_framework/regression/inherit_not_double_test.rb
|
85
|
+
- test/mac_spec/testing_framework/regression/surrounding_module_scope_test.rb
|
86
|
+
- test/mac_spec/testing_framework/regression/testing_functions_test.rb
|
87
|
+
- test/mac_spec/testing_framework/test_helper.rb
|
88
|
+
- test/test_helper.rb
|
89
|
+
has_rdoc: true
|
90
|
+
homepage: http://github.com/mhennemeyer/MacSpec
|
91
|
+
licenses: []
|
92
|
+
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options:
|
95
|
+
- --charset=UTF-8
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
version: "0"
|
112
|
+
requirements: []
|
113
|
+
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 1.3.6
|
116
|
+
signing_key:
|
117
|
+
specification_version: 3
|
118
|
+
summary: MacSpec is a feature minimal RSpec clone that is specifically built to work with MacRuby.
|
119
|
+
test_files:
|
120
|
+
- test/all.rb
|
121
|
+
- test/mac_spec/matcher_system/built_in/change_expectations_test.rb
|
122
|
+
- test/mac_spec/matcher_system/built_in/enumerable_expectations_test.rb
|
123
|
+
- test/mac_spec/matcher_system/built_in/error_expectations_test.rb
|
124
|
+
- test/mac_spec/matcher_system/built_in/operator_expectations_test.rb
|
125
|
+
- test/mac_spec/matcher_system/built_in/truth_expectations_test.rb
|
126
|
+
- test/mac_spec/matcher_system/core/def_matcher_test.rb
|
127
|
+
- test/mac_spec/matcher_system/core/expectation_builder_test.rb
|
128
|
+
- test/mac_spec/matcher_system/core/matcher_builder_test.rb
|
129
|
+
- test/mac_spec/matcher_system/core/modals_test.rb
|
130
|
+
- test/mac_spec/matcher_system/script.rb
|
131
|
+
- test/mac_spec/matcher_system/test_helper.rb
|
132
|
+
- test/mac_spec/mocking_framework/extensions/kernel_extension_test.rb
|
133
|
+
- test/mac_spec/mocking_framework/extensions/object_extension_test.rb
|
134
|
+
- test/mac_spec/mocking_framework/message_expectation_test.rb
|
135
|
+
- test/mac_spec/mocking_framework/mock_test.rb
|
136
|
+
- test/mac_spec/mocking_framework/regression/mocking_class_methods_test.rb
|
137
|
+
- test/mac_spec/mocking_framework/regression/negative_expectation_test.rb
|
138
|
+
- test/mac_spec/mocking_framework/regression/stub_test.rb
|
139
|
+
- test/mac_spec/mocking_framework/test_helper.rb
|
140
|
+
- test/mac_spec/test_helper.rb
|
141
|
+
- test/mac_spec/testing_framework/performance/x_test_performance.rb
|
142
|
+
- test/mac_spec/testing_framework/regression/before_test.rb
|
143
|
+
- test/mac_spec/testing_framework/regression/deep_nested_example_groups_test.rb
|
144
|
+
- test/mac_spec/testing_framework/regression/description_string_test.rb
|
145
|
+
- test/mac_spec/testing_framework/regression/example_name_test.rb
|
146
|
+
- test/mac_spec/testing_framework/regression/inherit_not_double_test.rb
|
147
|
+
- test/mac_spec/testing_framework/regression/surrounding_module_scope_test.rb
|
148
|
+
- test/mac_spec/testing_framework/regression/testing_functions_test.rb
|
149
|
+
- test/mac_spec/testing_framework/test_helper.rb
|
150
|
+
- test/test_helper.rb
|