remarkable 3.1.9 → 3.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,8 +64,7 @@ unless RAILS_I18N
64
64
  require 'i18n'
65
65
  rescue LoadError
66
66
  require 'rubygems'
67
- # TODO Move to i18n gem as soon as it gets updated
68
- gem 'svenfuchs-i18n'
67
+ gem 'i18n'
69
68
  require 'i18n'
70
69
  end
71
70
 
@@ -1,3 +1,3 @@
1
1
  module Remarkable
2
- VERSION = '3.1.9' unless self.const_defined?(:VERSION)
2
+ VERSION = '3.1.10' unless self.const_defined?(:VERSION)
3
3
  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.1.9
4
+ version: 3.1.10
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-08-30 00:00:00 +02:00
13
+ date: 2009-10-01 00:00:00 -03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -39,20 +39,20 @@ files:
39
39
  - README
40
40
  - LICENSE
41
41
  - CHANGELOG
42
- - lib/remarkable/pending.rb
42
+ - lib/remarkable/base.rb
43
+ - lib/remarkable/core_ext/array.rb
43
44
  - lib/remarkable/dsl/assertions.rb
44
- - lib/remarkable/dsl/optionals.rb
45
45
  - lib/remarkable/dsl/callbacks.rb
46
- - lib/remarkable/rspec.rb
47
- - lib/remarkable/base.rb
46
+ - lib/remarkable/dsl/optionals.rb
48
47
  - lib/remarkable/dsl.rb
49
48
  - lib/remarkable/i18n.rb
50
49
  - lib/remarkable/macros.rb
51
- - lib/remarkable/version.rb
52
50
  - lib/remarkable/matchers.rb
53
- - lib/remarkable/core_ext/array.rb
54
51
  - lib/remarkable/messages.rb
55
52
  - lib/remarkable/negative.rb
53
+ - lib/remarkable/pending.rb
54
+ - lib/remarkable/rspec.rb
55
+ - lib/remarkable/version.rb
56
56
  - lib/remarkable.rb
57
57
  - locale/en.yml
58
58
  has_rdoc: true
@@ -79,24 +79,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements: []
80
80
 
81
81
  rubyforge_project: remarkable
82
- rubygems_version: 1.3.5
82
+ rubygems_version: 1.3.4
83
83
  signing_key:
84
84
  specification_version: 3
85
85
  summary: "Remarkable: a framework for rspec matchers, with support to macros and I18n."
86
- test_files:
87
- - spec/dsl/optionals_spec.rb
88
- - spec/dsl/assertions_spec.rb
89
- - spec/messages_spec.rb
90
- - spec/locale/pt-BR.yml
91
- - spec/locale/en.yml
92
- - spec/i18n_spec.rb
93
- - spec/base_spec.rb
94
- - spec/spec_helper.rb
95
- - spec/matchers_spec.rb
96
- - spec/macros_spec.rb
97
- - spec/spec.opts
98
- - spec/pending_spec.rb
99
- - spec/matchers/be_a_person_matcher.rb
100
- - spec/matchers/contain_matcher.rb
101
- - spec/matchers/collection_contain_matcher.rb
102
- - spec/matchers/single_contain_matcher.rb
86
+ test_files: []
87
+
data/spec/base_spec.rb DELETED
@@ -1,46 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe Remarkable::Base do
4
- subject { [1, 2, 3] }
5
-
6
- it 'should provide default structure to matchers' do
7
- [1, 2, 3].should contain(1)
8
- [1, 2, 3].should contain(1, 2)
9
- [1, 2, 3].should contain(1, 2, 3)
10
-
11
- [1, 2, 3].should_not contain(4)
12
- [1, 2, 3].should_not contain(1, 4)
13
- end
14
-
15
- it 'should not change rspec matchers default behavior' do
16
- should include(3)
17
- [1, 2, 3].should include(3)
18
-
19
- 1.should == 1
20
- true.should be_true
21
- false.should be_false
22
- proc{ 1 + '' }.should raise_error(TypeError)
23
- end
24
-
25
- it 'should store spec instance binding' do
26
- matcher = contain(1)
27
- should matcher
28
- matcher.instance_variable_get('@spec').class.ancestors.should include(Spec::Example::ExampleGroup)
29
- end
30
-
31
- it 'should be positive' do
32
- contain(1).should be_positive
33
- contain(1).should_not be_negative
34
- end
35
-
36
- it { should contain(1) }
37
- it { should_not contain(10) }
38
-
39
- class MatchersSandbox
40
- include Remarkable::Matchers
41
- end
42
-
43
- it 'should allow Macros and Matchers to be added to any class' do
44
- MatchersSandbox.new.should respond_to(:contain)
45
- end
46
- end
@@ -1,54 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe Remarkable::DSL::Assertions do
4
- subject { [1, 2, 3] }
5
-
6
- before(:each) do
7
- @matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1, 2, 3)
8
- end
9
-
10
- it 'should provide default structure for assertions' do
11
- should collection_contain(1)
12
- should collection_contain(1, 2)
13
- should collection_contain(1, 2, 3)
14
-
15
- should_not collection_contain(4)
16
- should_not collection_contain(1, 4)
17
- end
18
-
19
- it 'should provide default structure for single assertions' do
20
- should single_contain(1)
21
- should_not single_contain(4)
22
- nil.should_not single_contain(1)
23
- end
24
-
25
- it 'should provide collection in description' do
26
- @matcher.description.should == 'contain 1, 2, and 3'
27
- end
28
-
29
- it 'should provide value to expectation messages' do
30
- @matcher.matches?([4])
31
- @matcher.failure_message.should == 'Expected that 1 is included in [4]'
32
- end
33
-
34
- it 'should accept blocks as argument' do
35
- should_not single_contain(4)
36
- should single_contain(4){ self << 4 }
37
- end
38
-
39
- it 'should provide an interface for default_options hook' do
40
- matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1, :args => true)
41
- matcher.instance_variable_get('@options').should == { :working => true, :args => true }
42
- end
43
-
44
- it 'should provide an interface for after_initialize hook' do
45
- matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1)
46
- matcher.instance_variable_get('@after_initialize').should be_true
47
- end
48
-
49
- it 'should provide an interface for before_assert hook' do
50
- matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1)
51
- [1, 2, 3].should matcher
52
- matcher.instance_variable_get('@before_assert').should be_true
53
- end
54
- end
@@ -1,237 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
-
4
- describe Remarkable::DSL::Optionals do
5
-
6
- describe "without config blocks" do
7
-
8
- before(:each) do
9
- @matcher = Remarkable::Specs::Matchers::BeAPersonMatcher.new
10
- end
11
-
12
- describe "as optionals" do
13
- it "should allow optionals to be set" do
14
- @matcher.first_name('José')
15
- @matcher.options[:first_name].should == 'José'
16
-
17
- @matcher.last_name('Valim')
18
- @matcher.options[:last_name].should == 'Valim'
19
- end
20
-
21
- it "should allow defaults values" do
22
- @matcher.age
23
- @matcher.options[:age].should == 18
24
- end
25
-
26
- it "should allow alias to be set" do
27
- @matcher.family_name('Valim')
28
- @matcher.options[:last_name].should == 'Valim'
29
- end
30
-
31
- it "should allow multiple options to be given" do
32
- @matcher.bands(:incubus, :foo_fighters)
33
- @matcher.options[:bands].should == [:incubus, :foo_fighters]
34
- end
35
-
36
- it "should allow multiple options to be appended once at a time" do
37
- @matcher.bands(:incubus)
38
- @matcher.bands(:foo_fighters)
39
- @matcher.options[:bands].should == [:incubus, :foo_fighters]
40
- end
41
-
42
- it "should allow blocks to given to options" do
43
- @matcher.builder {|i| i + 10 }
44
- @matcher.options[:builder].call(10).should == 20
45
-
46
- @matcher.builder proc{|i| i + 20 }
47
- @matcher.options[:builder].call(10).should == 30
48
- end
49
- end
50
-
51
- describe "as optionals=" do
52
- it "should allow optionals to be set" do
53
- @matcher.first_name = 'José'
54
- @matcher.options[:first_name].should == 'José'
55
-
56
- @matcher.last_name = 'Valim'
57
- @matcher.options[:last_name].should == 'Valim'
58
- end
59
-
60
- it "should allow alias to be set" do
61
- @matcher.family_name = 'Valim'
62
- @matcher.options[:last_name].should == 'Valim'
63
- end
64
-
65
- it "should allow multiple options to be given" do
66
- @matcher.bands = [ :incubus, :foo_fighters ]
67
- @matcher.options[:bands].should == [ :incubus, :foo_fighters ]
68
- end
69
-
70
- it "should overwrite previous options" do
71
- @matcher.bands = [ :incubus ]
72
- @matcher.bands = [ :foo_fighters ]
73
- @matcher.options[:bands].should == [:foo_fighters]
74
- end
75
-
76
- it "should allow blocks to given to options" do
77
- @matcher.builder = proc{|i| i + 20 }
78
- @matcher.options[:builder].call(10).should == 30
79
- end
80
- end
81
-
82
- end
83
-
84
- describe "with config blocks" do
85
-
86
- def builder(*args, &block)
87
- Remarkable::Specs::Matchers::BeAPersonMatcher.new(*args, &block)
88
- end
89
-
90
- describe "as optionals" do
91
- it "should allow optionals to be set" do
92
- matcher = builder do |m|
93
- m.first_name 'José'
94
- m.last_name 'Valim'
95
- end
96
-
97
- matcher.options[:first_name].should == 'José'
98
- matcher.options[:last_name].should == 'Valim'
99
- end
100
-
101
- it "should allow defaults values" do
102
- matcher = builder do |m|
103
- m.age
104
- end
105
-
106
- matcher.options[:age].should == 18
107
- end
108
-
109
- it "should allow alias to be set" do
110
- matcher = builder do |m|
111
- m.family_name 'Valim'
112
- end
113
-
114
- matcher.options[:last_name].should == 'Valim'
115
- end
116
-
117
- it "should allow multiple options to be given" do
118
- matcher = builder do |m|
119
- m.bands(:incubus, :foo_fighters)
120
- end
121
-
122
- matcher.options[:bands].should == [:incubus, :foo_fighters]
123
- end
124
-
125
- it "should allow multiple options to be appended once at a time" do
126
- matcher = builder do |m|
127
- m.bands(:incubus)
128
- m.bands(:foo_fighters)
129
- end
130
-
131
- matcher.options[:bands].should == [:incubus, :foo_fighters]
132
- end
133
-
134
- it "should allow blocks to given to options" do
135
- matcher = builder do |m|
136
- m.builder {|i| i + 10 }
137
- end
138
-
139
- matcher.options[:builder].call(10).should == 20
140
-
141
- matcher = builder do |m|
142
- m.builder proc {|i| i + 20 }
143
- end
144
-
145
- matcher.options[:builder].call(10).should == 30
146
- end
147
- end
148
-
149
- describe "as optionals=" do
150
- it "should allow optionals to be set" do
151
- matcher = builder do |m|
152
- m.first_name = 'José'
153
- m.last_name = 'Valim'
154
- end
155
-
156
- matcher.options[:first_name].should == 'José'
157
- matcher.options[:last_name].should == 'Valim'
158
- end
159
-
160
- it "should allow alias to be set" do
161
- matcher = builder do |m|
162
- m.family_name = 'Valim'
163
- end
164
-
165
- matcher.options[:last_name].should == 'Valim'
166
- end
167
-
168
- it "should allow multiple options to be given" do
169
- matcher = builder do |m|
170
- m.bands = [ :incubus, :foo_fighters ]
171
- end
172
-
173
- matcher.options[:bands].should == [ :incubus, :foo_fighters ]
174
- end
175
-
176
- it "should overwrite previous options" do
177
- matcher = builder do |m|
178
- m.bands = [ :incubus ]
179
- m.bands = [ :foo_fighters ]
180
- end
181
-
182
- matcher.options[:bands].should == [ :foo_fighters ]
183
- end
184
-
185
- it "should allow blocks to given to options" do
186
- matcher = builder do |m|
187
- m.builder = proc {|i| i + 20 }
188
- end
189
-
190
- matcher.options[:builder].call(10).should == 30
191
- end
192
- end
193
-
194
- end
195
-
196
- describe "description" do
197
- it "should provide a description with optionals" do
198
- matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
199
- matcher.description.should == 'contain 1 not checking for blank'
200
-
201
- matcher.allow_blank(10)
202
- matcher.description.should == 'contain 1 with blank equal 10'
203
-
204
- matcher.allow_blank(true)
205
- matcher.description.should == 'contain 1 with blank equal true'
206
-
207
- matcher.allow_nil(true)
208
- matcher.description.should == 'contain 1 allowing nil and with blank equal true'
209
-
210
- matcher.allow_nil(false)
211
- matcher.description.should == 'contain 1 not allowing nil and with blank equal true'
212
- end
213
-
214
- it "should provide a sentence interpolation option to optionals" do
215
- matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
216
- matcher.values(1, 2, 3)
217
- matcher.description.should == 'contain 1 not checking for blank and values equal to 1, 2, and 3'
218
- end
219
-
220
- it "should inspect values in sentence interpolation options" do
221
- matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
222
- matcher.values(:a, :b, :c)
223
- matcher.description.should == 'contain 1 not checking for blank and values equal to :a, :b, and :c'
224
- end
225
-
226
- it "should provide a description with optionals through namespace lookup" do
227
- matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1)
228
- matcher.description.should == 'contain 1'
229
-
230
- matcher.allow_nil(true)
231
- matcher.description.should == 'contain 1 allowing nil'
232
-
233
- matcher.allow_nil(false)
234
- matcher.description.should == 'contain 1 not allowing nil'
235
- end
236
- end
237
- end
data/spec/i18n_spec.rb DELETED
@@ -1,41 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe Remarkable::I18n do
4
- subject { [1, 2, 3] }
5
-
6
- before(:all) do
7
- Remarkable.locale = :"pt-BR"
8
- end
9
-
10
- it 'should have a locale apart from I18n' do
11
- I18n.locale.should_not == Remarkable.locale
12
- end
13
-
14
- it 'should delegate translate to I18n API overwriting the default locale' do
15
- ::I18n.should_receive(:translate).with('remarkable.core.not', :locale => :"pt-BR").and_return('translated')
16
- Remarkable.t('remarkable.core.not').should == 'translated'
17
- end
18
-
19
- it 'should delegate localize to I18n API overwriting the default locale' do
20
- ::I18n.should_receive(:localize).with('remarkable.core.not', :locale => :"pt-BR").and_return('localized')
21
- Remarkable.l('remarkable.core.not').should == 'localized'
22
- end
23
-
24
- it 'should delegate add_locale to I18n backend' do
25
- backend = mock(::I18n::Backend)
26
- ::I18n.should_receive(:backend).and_return(backend)
27
- backend.should_receive(:load_translations).with('a', 'b', 'c')
28
-
29
- Remarkable.add_locale('a', 'b', 'c')
30
- end
31
-
32
- after(:all) do
33
- Remarkable.locale = :en
34
- end
35
-
36
- Remarkable.locale = :"pt-BR"
37
- should_collection_contain(1)
38
- should_not_collection_contain(4)
39
- xshould_not_collection_contain(5)
40
- Remarkable.locale = :en
41
- end
data/spec/locale/en.yml DELETED
@@ -1,25 +0,0 @@
1
- en:
2
- remarkable:
3
- specs:
4
- optionals:
5
- allow_nil:
6
- positive: "allowing nil"
7
- negative: "not allowing nil"
8
- contain:
9
- description: "contain the given values"
10
- single_contain:
11
- description: "contain {{value}}"
12
- optionals:
13
- allow_nil:
14
- positive: "allowing nil"
15
- negative: "not allowing nil"
16
- allow_blank:
17
- positive: "with blank equal {{inspect}}"
18
- not_given: "not checking for blank"
19
- values:
20
- positive: "values equal to {{sentence}}"
21
- collection_contain:
22
- description: "contain {{values}}"
23
- expectations:
24
- included: "{{more}}{{value}} is included in {{subject_inspect}}"
25
- is_array?: "subject is a array, but got {{subject_name}}"
@@ -1,21 +0,0 @@
1
- pt-BR:
2
- remarkable:
3
- core:
4
- not: não
5
- should: deve
6
- should_not: não deve
7
- example_disabled: Exemplo desativado
8
- failure_message_for_should: Esperava que {{expectation}}
9
- failure_message_for_should_not: Não esperava que {{expectation}}
10
-
11
- helpers:
12
- words_connector: ', '
13
- two_words_connector: ' e '
14
- last_word_connector: ' e '
15
-
16
- specs:
17
- collection_contain:
18
- description: "conter os valores fornecidos"
19
- expectations:
20
- included: "{{value}} estivesse incluso em {{subject_inspect}}"
21
- is_array?: "valor dado é um array, mas é {{subject_name}}"
data/spec/macros_spec.rb DELETED
@@ -1,26 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe Remarkable::Macros do
4
- subject { [1, 2, 3] }
5
-
6
- should_contain(1)
7
- should_contain(1, 2)
8
- should_contain(1, 2, 3)
9
-
10
- should_not_contain(4)
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
16
- xshould_contain(5)
17
- xshould_not_contain(1)
18
- end
19
-
20
- describe "with blocks" do
21
- subject { [1, 2, 3] }
22
-
23
- should_not_single_contain(4)
24
- should_single_contain(4){ self << 4 }
25
- end
26
- end
@@ -1,29 +0,0 @@
1
- module Remarkable
2
- module Specs
3
- module Matchers
4
- class BeAPersonMatcher < Remarkable::Base
5
- arguments
6
-
7
- optional :first_name
8
- optional :age, :default => 18
9
- optional :last_name, :alias => :family_name
10
- optional :bands, :splat => true
11
- optional :builder, :block => true
12
-
13
- attr_reader :options
14
-
15
- def description
16
- "be a person"
17
- end
18
-
19
- def expectation
20
- "is not a person"
21
- end
22
- end
23
-
24
- def be_a_person(*args, &block)
25
- BeAPersonMatcher.new(*args, &block).spec(self)
26
- end
27
- end
28
- end
29
- end
@@ -1,32 +0,0 @@
1
- module Remarkable
2
- module Specs
3
- module Matchers
4
- class CollectionContainMatcher < Remarkable::Base
5
- arguments :collection => :values, :as => :value
6
-
7
- optional :working, :allow_nil
8
- default_options :working => true
9
-
10
- assertion :is_array? do
11
- @subject.is_a?(Array)
12
- end
13
-
14
- collection_assertion :included? do
15
- return @subject.include?(@value), :more => 'that '
16
- end
17
-
18
- after_initialize do
19
- @after_initialize = true
20
- end
21
-
22
- before_assert do
23
- @before_assert = true
24
- end
25
- end
26
-
27
- def collection_contain(*args, &block)
28
- CollectionContainMatcher.new(*args, &block).spec(self)
29
- end
30
- end
31
- end
32
- end
@@ -1,31 +0,0 @@
1
- module Remarkable
2
- module Specs
3
- module Matchers
4
- class ContainMatcher < Remarkable::Base
5
- def initialize(*values)
6
- @values = values
7
- end
8
-
9
- def matches?(subject)
10
- @subject = subject
11
-
12
- assert_collection(nil, @values) do |value|
13
- @value = value
14
- included?
15
- end
16
- end
17
-
18
- def included?
19
- return true if @subject.include?(@value)
20
-
21
- @expectation = "#{@value} is included in #{@subject.inspect}"
22
- false
23
- end
24
- end
25
-
26
- def contain(*args, &block)
27
- ContainMatcher.new(*args, &block).spec(self)
28
- end
29
- end
30
- end
31
- end
@@ -1,51 +0,0 @@
1
- module Remarkable
2
- module Specs
3
- module Matchers
4
- class SingleContainMatcher < Remarkable::Base
5
- arguments :value, :block => :iterator
6
-
7
- assertions :is_array?, :included?
8
-
9
- optional :allow_nil
10
- optional :allow_blank
11
- optional :values, :splat => true
12
-
13
- after_initialize :set_after_initialize
14
-
15
- before_assert do
16
- @before_assert = true
17
- @subject.instance_eval(&@iterator) if @iterator
18
- end
19
-
20
- protected
21
-
22
- def included?
23
- return true if @subject.include?(@value)
24
-
25
- @expectation = "#{@value} is not included in #{@subject.inspect}"
26
- false
27
- end
28
-
29
- def is_array?
30
- return true if @subject.is_a?(Array)
31
-
32
- @expectation = "subject is a #{subject_name}"
33
- false
34
- end
35
-
36
- def default_options
37
- { :working => true }
38
- end
39
-
40
- def set_after_initialize
41
- @after_initialize = true
42
- end
43
-
44
- end
45
-
46
- def single_contain(*args, &block)
47
- SingleContainMatcher.new(*args, &block).spec(self)
48
- end
49
- end
50
- end
51
- end
@@ -1,50 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe Remarkable::Matchers do
4
- it 'should include matchers in a specified target' do
5
- klass = Class.new
6
-
7
- module Foo
8
- module Matchers
9
- end
10
- end
11
-
12
- Remarkable.include_matchers!(Foo, klass)
13
- klass.ancestors.should include(Foo::Matchers)
14
-
15
- meta = (class << klass; self; end)
16
- meta.ancestors.should include(Remarkable::Macros)
17
- meta.ancestors.should include(Remarkable::Pending)
18
- end
19
-
20
- it 'should include matchers in Remarkable::Matchers' do
21
- klass = Class.new
22
-
23
- module Foo
24
- module Matchers
25
- end
26
- end
27
-
28
- Remarkable.include_matchers!(Foo, klass)
29
- Remarkable::Matchers.ancestors.should include(Foo::Matchers)
30
- (class << Remarkable::Matchers; self; end).ancestors.should include(Foo::Matchers)
31
- end
32
-
33
- it 'should raise an error if include matchers is called without target and rspec is not loaded' do
34
- Remarkable.stub!(:rspec_defined?).and_return(false)
35
- lambda {
36
- Remarkable.include_matchers!(String)
37
- }.should raise_error(ArgumentError, "You haven't supplied the target to include_matchers! and RSpec is not loaded, so we cannot infer one.")
38
- end
39
-
40
- it 'should not include modules twice' do
41
- klass = Class.new
42
- meta = (class << klass; self; end)
43
-
44
- meta.should_receive(:ancestors).twice.and_return([Remarkable::Pending, Remarkable::Macros])
45
- klass.should_not_receive(:extend).with(Remarkable::Pending)
46
- klass.should_not_receive(:extend).with(Remarkable::Macros)
47
-
48
- Remarkable.include_matchers!(Module.new, klass)
49
- end
50
- end
@@ -1,66 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
-
4
- describe Remarkable::Messages do
5
- subject { [1, 2, 3] }
6
-
7
- describe 'without I18n' do
8
- before(:each) do
9
- @matcher = Remarkable::Specs::Matchers::ContainMatcher.new(1, 2, 3)
10
- end
11
-
12
- it 'should provide a description' do
13
- @matcher.description.should == 'contain the given values'
14
- end
15
-
16
- it 'should provide a failure message' do
17
- @matcher.matches?([4])
18
- @matcher.failure_message.should == 'Expected 1 is included in [4]'
19
- end
20
-
21
- it 'should provide a negative failure message' do
22
- @matcher.matches?([1])
23
- @matcher.negative_failure_message.should == 'Did not expect 2 is included in [1]'
24
- end
25
-
26
- it 'should provide a not word' do
27
- @matcher.send(:not_word).should == 'not '
28
- end
29
- end
30
-
31
- describe 'with I18n' do
32
- before(:all) do
33
- Remarkable.locale = :"pt-BR"
34
- end
35
-
36
- before(:each) do
37
- @matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1, 2, 3)
38
- end
39
-
40
- it 'should provide a default i18n scope' do
41
- @matcher.send(:matcher_i18n_scope).should == 'remarkable.specs.collection_contain'
42
- end
43
-
44
- it 'should provide a translated description' do
45
- @matcher.description.should == 'conter os valores fornecidos'
46
- end
47
-
48
- it 'should provide a translated failure message' do
49
- @matcher.matches?([4])
50
- @matcher.failure_message.should == 'Esperava que 1 estivesse incluso em [4]'
51
- end
52
-
53
- it 'should provide a translated negative failure message' do
54
- @matcher.matches?([1])
55
- @matcher.negative_failure_message.should == 'Não esperava que 2 estivesse incluso em [1]'
56
- end
57
-
58
- it 'should provide an i18n not word' do
59
- @matcher.send(:not_word).should == 'não '
60
- end
61
-
62
- after(:all) do
63
- Remarkable.locale = :en
64
- end
65
- end
66
- end
data/spec/pending_spec.rb DELETED
@@ -1,33 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe Remarkable::Pending do
4
-
5
- it "should create pending groups" do
6
- spec = self
7
-
8
- self.class.pending "pending examples" do
9
- self.instance_variable_get("@_pending_group").should spec.be_true
10
- self.instance_variable_get("@_pending_group_description").should spec.eql("pending examples")
11
- self.instance_variable_get("@_pending_group_execute").should spec.be_true
12
- end
13
-
14
- self.instance_variable_get("@_pending_group").should be_nil
15
- self.instance_variable_get("@_pending_group_description").should be_nil
16
- self.instance_variable_get("@_pending_group_execute").should be_nil
17
- end
18
-
19
- pending "pending examples" do
20
- # example "should show as not implemented"
21
- #
22
- # specify "should show as pending" do
23
- # raise "oops"
24
- # end
25
- #
26
- # it "should show as fixed" do
27
- # true.should be_true
28
- # end
29
-
30
- should_contain(5)
31
- end
32
-
33
- end
data/spec/spec.opts DELETED
@@ -1,4 +0,0 @@
1
- --colour
2
- --format progress
3
- --loadby mtime
4
- --reverse
data/spec/spec_helper.rb DELETED
@@ -1,15 +0,0 @@
1
- $TESTING=true
2
-
3
- require 'rubygems'
4
-
5
- dir = File.dirname(__FILE__)
6
- require File.join(dir, '..', 'lib', 'remarkable')
7
-
8
- Dir[File.join(dir, 'matchers', '*.rb')].each do |file|
9
- require file
10
- end
11
-
12
- Remarkable.include_matchers!(Remarkable::Specs, Spec::Example::ExampleGroup)
13
-
14
- Remarkable.add_locale File.join(dir, 'locale', 'en.yml')
15
- Remarkable.add_locale File.join(dir, 'locale', 'pt-BR.yml')