remarkable 3.1.8 → 3.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,41 +1,41 @@
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
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
@@ -1,25 +1,25 @@
1
- en:
2
- remarkable:
1
+ en:
2
+ remarkable:
3
3
  specs:
4
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}}"
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
12
  optionals:
13
- allow_nil:
14
- positive: "allowing nil"
15
- negative: "not allowing nil"
16
- allow_blank:
17
- positive: "with blank equal {{inspect}}"
13
+ allow_nil:
14
+ positive: "allowing nil"
15
+ negative: "not allowing nil"
16
+ allow_blank:
17
+ positive: "with blank equal {{inspect}}"
18
18
  not_given: "not checking for blank"
19
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}}"
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 +1,21 @@
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}}"
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}}"
@@ -1,26 +1,26 @@
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
+ 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 +1,29 @@
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
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
9
  optional :last_name, :alias => :family_name
10
10
  optional :bands, :splat => true
11
11
  optional :builder, :block => true
12
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
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 +1,32 @@
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
+ 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 +1,31 @@
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
+ 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 +1,51 @@
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
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
10
  optional :allow_blank
11
- optional :values, :splat => true
12
-
13
- after_initialize :set_after_initialize
14
-
15
- before_assert do
11
+ optional :values, :splat => true
12
+
13
+ after_initialize :set_after_initialize
14
+
15
+ before_assert do
16
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
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