mspec 1.5.8 → 1.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/mspec/guards/extensions.rb +4 -3
- data/lib/mspec/guards/noncompliance.rb +4 -3
- data/lib/mspec/guards/support.rb +5 -4
- data/lib/mspec/version.rb +1 -1
- data/spec/guards/extensions_spec.rb +8 -2
- data/spec/guards/noncompliance_spec.rb +8 -2
- data/spec/guards/support_spec.rb +9 -3
- metadata +2 -2
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ spec = Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
20
20
|
s.authors = ["Brian Ford"]
|
21
|
-
s.date = %q{2009-2-
|
21
|
+
s.date = %q{2009-2-10}
|
22
22
|
s.email = %q{bford@engineyard.com}
|
23
23
|
s.has_rdoc = true
|
24
24
|
s.extra_rdoc_files = %w[ README LICENSE ]
|
@@ -2,9 +2,10 @@ require 'mspec/guards/guard'
|
|
2
2
|
|
3
3
|
class ExtensionsGuard < SpecGuard
|
4
4
|
def match?
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
if @args.include? :ruby
|
6
|
+
raise Exception, "improper use of extended_on guard"
|
7
|
+
end
|
8
|
+
!standard? and implementation?(*@args)
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
@@ -2,9 +2,10 @@ require 'mspec/guards/guard'
|
|
2
2
|
|
3
3
|
class NonComplianceGuard < SpecGuard
|
4
4
|
def match?
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
if @args.include? :ruby
|
6
|
+
raise Exception, "improper use of deviates_on guard"
|
7
|
+
end
|
8
|
+
!standard? and implementation?(*@args)
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
data/lib/mspec/guards/support.rb
CHANGED
@@ -2,16 +2,17 @@ require 'mspec/guards/guard'
|
|
2
2
|
|
3
3
|
class SupportedGuard < SpecGuard
|
4
4
|
def match?
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
if @args.include? :ruby
|
6
|
+
raise Exception, "improper use of not_supported_on guard"
|
7
|
+
end
|
8
|
+
standard? or !implementation?(*@args)
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
11
12
|
class Object
|
12
13
|
def not_supported_on(*args)
|
13
14
|
g = SupportedGuard.new(*args)
|
14
|
-
yield if g.yield?
|
15
|
+
yield if g.yield?
|
15
16
|
g.unregister
|
16
17
|
end
|
17
18
|
end
|
data/lib/mspec/version.rb
CHANGED
@@ -21,14 +21,20 @@ describe Object, "#extended_on" do
|
|
21
21
|
ScratchPad.clear
|
22
22
|
end
|
23
23
|
|
24
|
-
it "raises an Exception when
|
25
|
-
Object.const_set :RUBY_NAME, "
|
24
|
+
it "raises an Exception when passed :ruby" do
|
25
|
+
Object.const_set :RUBY_NAME, "jruby"
|
26
26
|
lambda {
|
27
27
|
extended_on(:ruby) { ScratchPad.record :yield }
|
28
28
|
}.should raise_error(Exception)
|
29
29
|
ScratchPad.recorded.should_not == :yield
|
30
30
|
end
|
31
31
|
|
32
|
+
it "does not yield when #standard? returns true" do
|
33
|
+
Object.const_set :RUBY_NAME, "ruby"
|
34
|
+
extended_on(:rubinius) { ScratchPad.record :yield }
|
35
|
+
ScratchPad.recorded.should_not == :yield
|
36
|
+
end
|
37
|
+
|
32
38
|
it "does not yield when #implementation? returns false" do
|
33
39
|
Object.const_set :RUBY_NAME, "jruby"
|
34
40
|
extended_on(:rubinius) { ScratchPad.record :yield }
|
@@ -21,14 +21,20 @@ describe Object, "#deviates_on" do
|
|
21
21
|
ScratchPad.clear
|
22
22
|
end
|
23
23
|
|
24
|
-
it "raises an Exception when
|
25
|
-
Object.const_set :RUBY_NAME, "
|
24
|
+
it "raises an Exception when passed :ruby" do
|
25
|
+
Object.const_set :RUBY_NAME, "jruby"
|
26
26
|
lambda {
|
27
27
|
deviates_on(:ruby) { ScratchPad.record :yield }
|
28
28
|
}.should raise_error(Exception)
|
29
29
|
ScratchPad.recorded.should_not == :yield
|
30
30
|
end
|
31
31
|
|
32
|
+
it "does not yield when #standard? returns true" do
|
33
|
+
Object.const_set :RUBY_NAME, "ruby"
|
34
|
+
deviates_on(:rubinius) { ScratchPad.record :yield }
|
35
|
+
ScratchPad.recorded.should_not == :yield
|
36
|
+
end
|
37
|
+
|
32
38
|
it "does not yield when #implementation? returns false" do
|
33
39
|
Object.const_set :RUBY_NAME, "jruby"
|
34
40
|
deviates_on(:rubinius) { ScratchPad.record :yield }
|
data/spec/guards/support_spec.rb
CHANGED
@@ -21,8 +21,8 @@ describe Object, "#not_supported_on" do
|
|
21
21
|
ScratchPad.clear
|
22
22
|
end
|
23
23
|
|
24
|
-
it "raises an Exception when
|
25
|
-
Object.const_set :RUBY_NAME, "
|
24
|
+
it "raises an Exception when passed :ruby" do
|
25
|
+
Object.const_set :RUBY_NAME, "jruby"
|
26
26
|
lambda {
|
27
27
|
not_supported_on(:ruby) { ScratchPad.record :yield }
|
28
28
|
}.should raise_error(Exception)
|
@@ -35,9 +35,15 @@ describe Object, "#not_supported_on" do
|
|
35
35
|
ScratchPad.recorded.should_not == :yield
|
36
36
|
end
|
37
37
|
|
38
|
-
it "yields when #
|
38
|
+
it "yields when #standard? returns true" do
|
39
39
|
Object.const_set :RUBY_NAME, "ruby"
|
40
40
|
not_supported_on(:rubinius) { ScratchPad.record :yield }
|
41
41
|
ScratchPad.recorded.should == :yield
|
42
42
|
end
|
43
|
+
|
44
|
+
it "yields when #implementation? returns false" do
|
45
|
+
Object.const_set :RUBY_NAME, "jruby"
|
46
|
+
not_supported_on(:rubinius) { ScratchPad.record :yield }
|
47
|
+
ScratchPad.recorded.should == :yield
|
48
|
+
end
|
43
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Ford
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-10 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|