remarkable 3.0.1 → 3.0.2
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/CHANGELOG +11 -11
- data/LICENSE +1 -1
- data/README +189 -189
- data/lib/remarkable.rb +6 -6
- data/lib/remarkable/base.rb +2 -2
- data/lib/remarkable/dsl.rb +15 -15
- data/lib/remarkable/dsl/assertions.rb +8 -8
- data/lib/remarkable/dsl/callbacks.rb +39 -39
- data/lib/remarkable/dsl/matches.rb +52 -52
- data/lib/remarkable/dsl/optionals.rb +46 -46
- data/lib/remarkable/macros.rb +33 -33
- data/lib/remarkable/matchers.rb +13 -13
- data/lib/remarkable/messages.rb +10 -10
- data/lib/remarkable/pending.rb +27 -27
- data/lib/remarkable/version.rb +1 -1
- data/spec/base_spec.rb +8 -8
- data/spec/dsl/assertions_spec.rb +3 -3
- data/spec/dsl/optionals_spec.rb +2 -2
- data/spec/locale/en.yml +1 -1
- data/spec/locale/pt-BR.yml +1 -1
- data/spec/macros_spec.rb +7 -7
- data/spec/matchers/single_contain_matcher.rb +6 -6
- data/spec/messages_spec.rb +5 -5
- data/spec/pending_spec.rb +7 -7
- metadata +2 -2
data/lib/remarkable/matchers.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# Remarkable core module
|
2
|
-
module Remarkable
|
3
|
-
# A module that keeps all matchers added. This is useful because it allows
|
4
|
-
# to include matchers in Test::Unit as well.
|
5
|
-
module Matchers; end
|
6
|
-
|
2
|
+
module Remarkable
|
3
|
+
# A module that keeps all matchers added. This is useful because it allows
|
4
|
+
# to include matchers in Test::Unit as well.
|
5
|
+
module Matchers; end
|
6
|
+
|
7
7
|
# Helper that includes required Remarkable modules into the given klass.
|
8
8
|
def self.include_matchers!(base, klass)
|
9
|
-
klass.send :extend, Remarkable::Macros
|
10
|
-
|
9
|
+
klass.send :extend, Remarkable::Macros
|
10
|
+
|
11
11
|
if defined?(base::Matchers)
|
12
|
-
klass.send :include, base::Matchers
|
13
|
-
|
14
|
-
Remarkable::Matchers.send :extend, base::Matchers
|
15
|
-
Remarkable::Matchers.send :include, base::Matchers
|
16
|
-
end
|
12
|
+
klass.send :include, base::Matchers
|
13
|
+
|
14
|
+
Remarkable::Matchers.send :extend, base::Matchers
|
15
|
+
Remarkable::Matchers.send :include, base::Matchers
|
16
|
+
end
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
data/lib/remarkable/messages.rb
CHANGED
@@ -19,14 +19,14 @@ module Remarkable
|
|
19
19
|
#
|
20
20
|
def failure_message_for_should
|
21
21
|
Remarkable.t 'remarkable.core.failure_message_for_should', :expectation => @expectation
|
22
|
-
end
|
22
|
+
end
|
23
23
|
alias :failure_message :failure_message_for_should
|
24
24
|
|
25
25
|
# Provides a default negative failure message. Overwrite it if needed.
|
26
26
|
#
|
27
27
|
def failure_message_for_should_not
|
28
28
|
Remarkable.t 'remarkable.core.failure_message_for_should_not', :expectation => @expectation
|
29
|
-
end
|
29
|
+
end
|
30
30
|
alias :negative_failure_message :failure_message_for_should_not
|
31
31
|
|
32
32
|
private
|
@@ -55,18 +55,18 @@ module Remarkable
|
|
55
55
|
# bunch of options (check dsl/matches.rb for more information).
|
56
56
|
#
|
57
57
|
def default_i18n_options
|
58
|
-
interpolation_options.update(
|
58
|
+
interpolation_options.update(
|
59
59
|
:scope => matcher_i18n_scope,
|
60
60
|
:subject_name => subject_name,
|
61
61
|
:subject_inspect => @subject.inspect
|
62
62
|
)
|
63
|
-
end
|
64
|
-
|
65
|
-
# Method to be overwritten if user wants to provide more interpolation
|
66
|
-
# options to I18n.
|
67
|
-
#
|
68
|
-
def interpolation_options
|
69
|
-
{}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Method to be overwritten if user wants to provide more interpolation
|
66
|
+
# options to I18n.
|
67
|
+
#
|
68
|
+
def interpolation_options
|
69
|
+
{}
|
70
70
|
end
|
71
71
|
|
72
72
|
# Returns the not word from I18n API.
|
data/lib/remarkable/pending.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
module Remarkable
|
2
|
-
module Macros
|
2
|
+
module Macros
|
3
3
|
|
4
4
|
protected
|
5
|
-
|
6
|
-
def pending(description=nil, &block)
|
7
|
-
PendingSandbox.new(description, self).instance_eval(&block)
|
8
|
-
end
|
9
|
-
|
10
|
-
class PendingSandbox < Struct.new(:description, :spec) #:nodoc:
|
11
|
-
include Macros
|
12
|
-
|
13
|
-
def example(mather_description=nil)
|
14
|
-
method_caller = caller.detect{ |c| c !~ /method_missing'/ }
|
15
|
-
|
16
|
-
error = begin
|
17
|
-
::Spec::Example::ExamplePendingError.new(description || 'TODO', method_caller)
|
18
|
-
rescue # For rspec <= 1.1.12
|
19
|
-
::Spec::Example::ExamplePendingError.new(description || 'TODO')
|
20
|
-
end
|
21
|
-
|
22
|
-
spec.send(:example, mather_description){ raise error }
|
23
|
-
end
|
24
|
-
alias :it :example
|
25
|
-
alias :specify :example
|
26
|
-
|
27
|
-
def should_or_should_not_method_missing(should_or_should_not, method, calltrace, *args, &block)
|
28
|
-
example(get_description_from_matcher(should_or_should_not, method, *args, &block))
|
29
|
-
end
|
30
|
-
end
|
5
|
+
|
6
|
+
def pending(description=nil, &block)
|
7
|
+
PendingSandbox.new(description, self).instance_eval(&block)
|
8
|
+
end
|
9
|
+
|
10
|
+
class PendingSandbox < Struct.new(:description, :spec) #:nodoc:
|
11
|
+
include Macros
|
12
|
+
|
13
|
+
def example(mather_description=nil)
|
14
|
+
method_caller = caller.detect{ |c| c !~ /method_missing'/ }
|
15
|
+
|
16
|
+
error = begin
|
17
|
+
::Spec::Example::ExamplePendingError.new(description || 'TODO', method_caller)
|
18
|
+
rescue # For rspec <= 1.1.12
|
19
|
+
::Spec::Example::ExamplePendingError.new(description || 'TODO')
|
20
|
+
end
|
21
|
+
|
22
|
+
spec.send(:example, mather_description){ raise error }
|
23
|
+
end
|
24
|
+
alias :it :example
|
25
|
+
alias :specify :example
|
26
|
+
|
27
|
+
def should_or_should_not_method_missing(should_or_should_not, method, calltrace, *args, &block)
|
28
|
+
example(get_description_from_matcher(should_or_should_not, method, *args, &block))
|
29
|
+
end
|
30
|
+
end
|
31
31
|
|
32
32
|
end
|
33
33
|
end
|
data/lib/remarkable/version.rb
CHANGED
data/spec/base_spec.rb
CHANGED
@@ -30,13 +30,13 @@ describe Remarkable::Base do
|
|
30
30
|
|
31
31
|
it { should contain(1) }
|
32
32
|
it { should_not contain(10) }
|
33
|
-
|
34
|
-
class MatchersSandbox
|
35
|
-
include Remarkable::Matchers
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should allow Macros and Matchers to be added to any class' do
|
39
|
-
MatchersSandbox.new.should respond_to(:contain)
|
40
|
-
end
|
33
|
+
|
34
|
+
class MatchersSandbox
|
35
|
+
include Remarkable::Matchers
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should allow Macros and Matchers to be added to any class' do
|
39
|
+
MatchersSandbox.new.should respond_to(:contain)
|
40
|
+
end
|
41
41
|
|
42
42
|
end
|
data/spec/dsl/assertions_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Remarkable::DSL::Assertions do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
@matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1, 2, 3)
|
8
|
-
end
|
8
|
+
end
|
9
9
|
|
10
10
|
it 'should provide default structure for assertions' do
|
11
11
|
should collection_contain(1)
|
@@ -39,8 +39,8 @@ describe Remarkable::DSL::Assertions do
|
|
39
39
|
it 'should provide an interface for default_options hook' do
|
40
40
|
matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1, :args => true)
|
41
41
|
matcher.instance_variable_get('@options').should == { :working => true, :args => true }
|
42
|
-
end
|
43
|
-
|
42
|
+
end
|
43
|
+
|
44
44
|
it 'should provide an interface for after_initialize hook' do
|
45
45
|
matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1)
|
46
46
|
matcher.instance_variable_get('@after_initialize').should be_true
|
data/spec/dsl/optionals_spec.rb
CHANGED
@@ -21,9 +21,9 @@ describe Remarkable::DSL::Optionals do
|
|
21
21
|
it "should allow alias to be set" do
|
22
22
|
@matcher.family_name('Valim')
|
23
23
|
@matcher.instance_variable_get('@options')[:last_name].should == 'Valim'
|
24
|
-
end
|
24
|
+
end
|
25
25
|
|
26
|
-
it 'should provide a description with optionals' do
|
26
|
+
it 'should provide a description with optionals' do
|
27
27
|
@matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
|
28
28
|
@matcher.description.should == 'contain 1 not checking for blank'
|
29
29
|
|
data/spec/locale/en.yml
CHANGED
data/spec/locale/pt-BR.yml
CHANGED
@@ -15,7 +15,7 @@ pt-BR:
|
|
15
15
|
|
16
16
|
specs:
|
17
17
|
collection_contain:
|
18
|
-
description: "conter os valores fornecidos"
|
18
|
+
description: "conter os valores fornecidos"
|
19
19
|
expectations:
|
20
20
|
included: "{{value}} estivesse incluso em {{subject_inspect}}"
|
21
21
|
is_array?: "valor dado é um array, mas é {{subject_name}}"
|
data/spec/macros_spec.rb
CHANGED
@@ -9,18 +9,18 @@ describe Remarkable::Macros do
|
|
9
9
|
|
10
10
|
should_not_contain(4)
|
11
11
|
should_not_contain(1, 4)
|
12
|
-
|
13
|
-
describe "with disabled examples" do
|
14
|
-
# Example disabled without parameters to ensure rescue works properly
|
15
|
-
xshould_not_single_contain
|
12
|
+
|
13
|
+
describe "with disabled examples" do
|
14
|
+
# Example disabled without parameters to ensure rescue works properly
|
15
|
+
xshould_not_single_contain
|
16
16
|
xshould_contain(5)
|
17
|
-
xshould_not_contain(1)
|
18
|
-
end
|
17
|
+
xshould_not_contain(1)
|
18
|
+
end
|
19
19
|
|
20
20
|
describe "with blocks" do
|
21
21
|
subject { [1, 2, 3] }
|
22
22
|
|
23
|
-
should_not_single_contain(4)
|
23
|
+
should_not_single_contain(4)
|
24
24
|
should_single_contain(4){ |array| array << 4 }
|
25
25
|
end
|
26
26
|
end
|
@@ -7,8 +7,8 @@ module Remarkable
|
|
7
7
|
assertions :is_array?, :included?
|
8
8
|
|
9
9
|
optional :allow_nil
|
10
|
-
optional :allow_blank
|
11
|
-
|
10
|
+
optional :allow_blank
|
11
|
+
|
12
12
|
after_initialize :set_after_initialize
|
13
13
|
|
14
14
|
before_assert do
|
@@ -34,10 +34,10 @@ module Remarkable
|
|
34
34
|
|
35
35
|
def default_options
|
36
36
|
{ :working => true }
|
37
|
-
end
|
38
|
-
|
39
|
-
def set_after_initialize
|
40
|
-
@after_initialize = true
|
37
|
+
end
|
38
|
+
|
39
|
+
def set_after_initialize
|
40
|
+
@after_initialize = true
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
data/spec/messages_spec.rb
CHANGED
@@ -3,10 +3,10 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe Remarkable::Messages do
|
4
4
|
subject { [1, 2, 3] }
|
5
5
|
|
6
|
-
describe 'without I18n' do
|
6
|
+
describe 'without I18n' do
|
7
7
|
before(:each) do
|
8
8
|
@matcher = Remarkable::Specs::Matchers::ContainMatcher.new(1, 2, 3)
|
9
|
-
end
|
9
|
+
end
|
10
10
|
|
11
11
|
it 'should provide a description' do
|
12
12
|
@matcher.description.should == 'contain the given values'
|
@@ -29,9 +29,9 @@ describe Remarkable::Messages do
|
|
29
29
|
|
30
30
|
describe 'with I18n' do
|
31
31
|
before(:all) do
|
32
|
-
Remarkable.locale = :"pt-BR"
|
33
|
-
end
|
34
|
-
|
32
|
+
Remarkable.locale = :"pt-BR"
|
33
|
+
end
|
34
|
+
|
35
35
|
before(:each) do
|
36
36
|
@matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1, 2, 3)
|
37
37
|
end
|
data/spec/pending_spec.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
describe Remarkable::Macros do
|
3
|
+
describe Remarkable::Macros do
|
4
4
|
|
5
|
-
describe "with pending examples" do
|
6
|
-
pending "pending examples" do
|
7
|
-
should_contain(5)
|
8
|
-
it("should not be run"){ true.should be_false }
|
9
|
-
end
|
10
|
-
end
|
5
|
+
describe "with pending examples" do
|
6
|
+
pending "pending examples" do
|
7
|
+
should_contain(5)
|
8
|
+
it("should not be run"){ true.should be_false }
|
9
|
+
end
|
10
|
+
end
|
11
11
|
|
12
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remarkable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Brando
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-04-
|
13
|
+
date: 2009-04-13 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|