rspec-i18n 1.1.0 → 1.2.0

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.
Files changed (64) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile +6 -0
  3. data/History.rdoc +40 -2
  4. data/License.txt +0 -1
  5. data/README.rdoc +19 -19
  6. data/Rakefile +54 -4
  7. data/TODO.txt +5 -24
  8. data/Tasks +3 -0
  9. data/VERSION.yml +3 -3
  10. data/bin/rspec-i18n +4 -13
  11. data/cucumber.yml +1 -0
  12. data/examples/i18n/de/german_spec.rb +39 -0
  13. data/examples/i18n/pt/{person_spec.rb → portuguese_spec.rb} +39 -7
  14. data/features/command_line/list_languages.feature +113 -0
  15. data/features/support/env.rb +13 -0
  16. data/lib/spec-i18n/command_line/language_help_formatter.rb +64 -58
  17. data/lib/spec-i18n/command_line/main.rb +1 -6
  18. data/lib/spec-i18n/command_line/options.rb +31 -17
  19. data/lib/spec-i18n/dsl/main.rb +23 -4
  20. data/lib/spec-i18n/example.rb +1 -0
  21. data/lib/spec-i18n/example/before_and_after_hooks.rb +26 -8
  22. data/lib/spec-i18n/example/example_group_methods.rb +9 -6
  23. data/lib/spec-i18n/example/pending.rb +19 -0
  24. data/lib/spec-i18n/example/subject.rb +2 -4
  25. data/lib/spec-i18n/expectations/extensions/kernel.rb +6 -4
  26. data/lib/spec-i18n/languages.yml +88 -50
  27. data/lib/spec-i18n/matchers.rb +0 -2
  28. data/lib/spec-i18n/matchers/be.rb +36 -49
  29. data/lib/spec-i18n/matchers/method_missing.rb +33 -17
  30. data/lib/spec-i18n/matchers/register_all_matchers.rb +1 -2
  31. data/lib/spec-i18n/matchers/translate_basic_matchers.rb +40 -14
  32. data/lib/spec-i18n/parser/natural_language.rb +228 -27
  33. data/lib/spec-i18n/platform.rb +0 -2
  34. data/lib/spec-i18n/runner/configuration.rb +64 -6
  35. data/lib/spec-i18n/spec_language.rb +29 -2
  36. data/rspec-i18n.gemspec +30 -20
  37. data/spec/spec-i18n/command_line/language_help_formatter_spec.rb +74 -49
  38. data/spec/spec-i18n/command_line/options_spec.rb +11 -2
  39. data/spec/spec-i18n/dsl/main_spec.rb +54 -12
  40. data/spec/spec-i18n/example/before_and_after_hooks_spec.rb +210 -88
  41. data/spec/spec-i18n/example/example_group_methods_spec.rb +26 -8
  42. data/spec/spec-i18n/example/pending_spec.rb +41 -0
  43. data/spec/spec-i18n/example/subject_spec.rb +27 -41
  44. data/spec/spec-i18n/expectations/kernel_spec.rb +29 -15
  45. data/spec/spec-i18n/matchers/be_close_spec.rb +7 -5
  46. data/spec/spec-i18n/matchers/be_instance_of_spec.rb +4 -5
  47. data/spec/spec-i18n/matchers/be_kind_of_spec.rb +3 -6
  48. data/spec/spec-i18n/matchers/be_spec.rb +255 -89
  49. data/spec/spec-i18n/matchers/eql_spec.rb +4 -6
  50. data/spec/spec-i18n/matchers/equal_spec.rb +28 -7
  51. data/spec/spec-i18n/matchers/exist_spec.rb +4 -5
  52. data/spec/spec-i18n/matchers/have_spec.rb +1 -1
  53. data/spec/spec-i18n/matchers/include_spec.rb +6 -8
  54. data/spec/spec-i18n/matchers/match_spec.rb +4 -5
  55. data/spec/spec-i18n/matchers/raise_error_spec.rb +5 -4
  56. data/spec/spec-i18n/matchers/satisfy_spec.rb +4 -5
  57. data/spec/spec-i18n/parser/natural_language_spec.rb +420 -58
  58. data/spec/spec-i18n/runner/{runner_spec.rb → rspec_i18n_language_spec.rb} +0 -0
  59. data/spec/spec-i18n/runner/{configuration_spec.rb → rspec_i18n_spec.rb} +28 -7
  60. data/spec/spec-i18n/spec_examples/pt/pessoa_spec.rb +63 -5
  61. data/spec/spec-i18n/spec_language_spec.rb +24 -10
  62. data/spec/spec.opts +1 -2
  63. data/spec/spec_helper.rb +26 -18
  64. metadata +102 -44
@@ -1,4 +1,3 @@
1
- require 'rbconfig'
2
1
  require 'yaml'
3
2
 
4
3
  module SpecI18n
@@ -6,5 +5,4 @@ module SpecI18n
6
5
  VERSION = [version[:major], version[:minor], version[:patch]].compact.join(".")
7
6
  SPEC_LANGUAGE_FILE = File.expand_path(File.dirname(__FILE__) + '/languages.yml')
8
7
  SPEC_LANGUAGES = YAML.load_file(SPEC_LANGUAGE_FILE)
9
- WINDOWS = Config::CONFIG['host_os'] =~ /mswin|mingw/
10
8
  end
@@ -1,26 +1,84 @@
1
1
  module Spec
2
2
  module Runner
3
3
  class Configuration
4
- def spec_language(language)
5
- @spec_language = language ? language.to_s : "en"
4
+
5
+ attr_reader :rspec_language
6
+
7
+ # Method to put in the Spec::Runner configure block and translated all the
8
+ # Rspec methods
9
+ #
10
+ # Spec::Runner.configure do |config|
11
+ # config.spec_language :es
12
+ # ...
13
+ # end
14
+ #
15
+ def spec_language(language_for_translated)
16
+ @rspec_language = language_for_translated ? language_for_translated.to_s : raise(UndefinedLanguageError, 'Language #{language_for_translated.class}')
17
+ warning_messages_for_incomplete_languages!(SpecI18n.natural_language)
6
18
  load_language
7
- @spec_language
19
+ rspec_language
8
20
  end
9
21
 
22
+ # Return the current language in configure block
23
+ #
10
24
  def language
11
- @spec_language
25
+ rspec_language
12
26
  end
13
27
 
14
- # Load all Modules and Classes for the language specified
28
+ # Translate all the keywords for the language specified
29
+ #
15
30
  def load_language
16
- Spec::DSL::Main.register_adverbs
31
+ load_dsl_keywords
32
+ load_expectation_keywords
33
+ load_example_keywords
34
+ load_hooks_keywords
35
+ load_all_matchers
36
+ load_subject_keywords
37
+ load_shared_examples_keywords
38
+ end
39
+
40
+ # Return a Warning for incomplete language
41
+ # Nil if natural_language is complete
42
+ #
43
+ def warning_messages_for_incomplete_languages!(natural_language)
44
+ if natural_language.incomplete?
45
+ message = "\n Language Warning: Incomplete Keywords For The Language '#{language}' \n"
46
+ Kernel.warn(message)
47
+ end
48
+ end
49
+
50
+ def load_dsl_keywords
51
+ Spec::DSL::Main.register_adverbs
52
+ end
53
+
54
+ def load_expectation_keywords
17
55
  Kernel.register_expectations_keywords
56
+ end
57
+
58
+ def load_example_keywords
18
59
  Spec::Example::ExampleGroupMethods.register_example_adverbs
60
+ Spec::Example::Pending.translate_pending_keywords
61
+ end
62
+
63
+ def load_hooks_keywords
19
64
  Spec::Example::BeforeAndAfterHooks.register_hooks
65
+ end
66
+
67
+ def load_all_matchers
20
68
  Spec::Matchers.register_all_matchers
69
+ end
70
+
71
+ def load_subject_keywords
21
72
  Spec::Example::Subject::ExampleGroupMethods.register_subjects
22
73
  Spec::Example::Subject::ExampleMethods.register_subjects
23
74
  end
75
+
76
+ def load_shared_examples_keywords
77
+ Spec::DSL::Main.translate_shared_examples_for
78
+ Spec::DSL::Main.translate_share_as_keywords
79
+ Spec::Example::ExampleGroupMethods.translate_it_should_behave_like
80
+ end
81
+
24
82
  end
25
83
 
26
84
  class UndefinedLanguageError < StandardError
@@ -1,10 +1,37 @@
1
1
  module SpecI18n
2
+
3
+ # Return the new NaturalLanguage from spec language configuration
4
+ #
5
+ def natural_language
6
+ Parser::NaturalLanguage.new(spec_language)
7
+ end
8
+
9
+ # Read the configuration language put in the Spec::Runner configure block
10
+ #
2
11
  def spec_language
3
12
  Spec::Runner.configuration.language
4
13
  end
5
- def natural_language
6
- Parser::NaturalLanguage.get(spec_language)
14
+
15
+ # Return all the languages in languages.yml
16
+ #
17
+ def all_languages
18
+ SpecI18n::SPEC_LANGUAGES
19
+ end
20
+
21
+ # Return the exaclty value of that keyword
22
+ #
23
+ def grep_value(lang, key)
24
+ SpecI18n::SPEC_LANGUAGES[lang][key]
25
+ end
26
+
27
+ # List all languages available in the languages.yml
28
+ #
29
+ def list_languages
30
+ languages = all_languages.keys.sort.collect do |lang|
31
+ [ lang, grep_value(lang, 'name'), grep_value(lang, 'native') ]
32
+ end
7
33
  end
34
+
8
35
  end
9
36
 
10
37
  include SpecI18n
data/rspec-i18n.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rspec-i18n}
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tomas D'Stefano"]
12
- s.date = %q{2010-03-13}
12
+ s.date = %q{2010-06-13}
13
13
  s.default_executable = %q{rspec-i18n}
14
14
  s.description = %q{A internacionalization tool written in Ruby for the Rspec Framework}
15
15
  s.email = %q{tomasdestefi@gmail.com}
@@ -19,14 +19,20 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  ".gitignore",
22
+ "Gemfile",
22
23
  "History.rdoc",
23
24
  "License.txt",
24
25
  "README.rdoc",
25
26
  "Rakefile",
26
27
  "TODO.txt",
28
+ "Tasks",
27
29
  "VERSION.yml",
28
30
  "bin/rspec-i18n",
29
- "examples/i18n/pt/person_spec.rb",
31
+ "cucumber.yml",
32
+ "examples/i18n/de/german_spec.rb",
33
+ "examples/i18n/pt/portuguese_spec.rb",
34
+ "features/command_line/list_languages.feature",
35
+ "features/support/env.rb",
30
36
  "lib/spec-i18n.rb",
31
37
  "lib/spec-i18n/command_line/language_help_formatter.rb",
32
38
  "lib/spec-i18n/command_line/main.rb",
@@ -36,6 +42,7 @@ Gem::Specification.new do |s|
36
42
  "lib/spec-i18n/example.rb",
37
43
  "lib/spec-i18n/example/before_and_after_hooks.rb",
38
44
  "lib/spec-i18n/example/example_group_methods.rb",
45
+ "lib/spec-i18n/example/pending.rb",
39
46
  "lib/spec-i18n/example/subject.rb",
40
47
  "lib/spec-i18n/expectations.rb",
41
48
  "lib/spec-i18n/expectations/extensions.rb",
@@ -59,6 +66,7 @@ Gem::Specification.new do |s|
59
66
  "spec/spec-i18n/dsl/main_spec.rb",
60
67
  "spec/spec-i18n/example/before_and_after_hooks_spec.rb",
61
68
  "spec/spec-i18n/example/example_group_methods_spec.rb",
69
+ "spec/spec-i18n/example/pending_spec.rb",
62
70
  "spec/spec-i18n/example/subject_spec.rb",
63
71
  "spec/spec-i18n/expectations/kernel_spec.rb",
64
72
  "spec/spec-i18n/matchers/be_close_spec.rb",
@@ -75,8 +83,8 @@ Gem::Specification.new do |s|
75
83
  "spec/spec-i18n/matchers/register_all_matchers_spec.rb",
76
84
  "spec/spec-i18n/matchers/satisfy_spec.rb",
77
85
  "spec/spec-i18n/parser/natural_language_spec.rb",
78
- "spec/spec-i18n/runner/configuration_spec.rb",
79
- "spec/spec-i18n/runner/runner_spec.rb",
86
+ "spec/spec-i18n/runner/rspec_i18n_language_spec.rb",
87
+ "spec/spec-i18n/runner/rspec_i18n_spec.rb",
80
88
  "spec/spec-i18n/spec_examples/pt/pessoa_spec.rb",
81
89
  "spec/spec-i18n/spec_language_spec.rb",
82
90
  "spec/spec.opts",
@@ -87,7 +95,7 @@ Gem::Specification.new do |s|
87
95
  --------------------------------------------------------------------------------
88
96
  U P G R A D I N G
89
97
 
90
- Thank you for installing rspec-i18n-1.1.0
98
+ Thank you for installing rspec-i18n-1.2.0
91
99
  Please be sure to read http://wiki.github.com/tomas-stefano/rspec-i18n/upgrading
92
100
  for information about this release.
93
101
 
@@ -97,7 +105,7 @@ Remember: 'TDD is a muscle. You have to exercise it.' =) (Brian Liles)
97
105
  }
98
106
  s.rdoc_options = ["--charset=UTF-8"]
99
107
  s.require_paths = ["lib"]
100
- s.rubygems_version = %q{1.3.5}
108
+ s.rubygems_version = %q{1.3.7}
101
109
  s.summary = %q{The internacionalization gem for Rspec}
102
110
  s.test_files = [
103
111
  "spec/spec-i18n/command_line/language_help_formatter_spec.rb",
@@ -106,6 +114,7 @@ Remember: 'TDD is a muscle. You have to exercise it.' =) (Brian Liles)
106
114
  "spec/spec-i18n/dsl/main_spec.rb",
107
115
  "spec/spec-i18n/example/before_and_after_hooks_spec.rb",
108
116
  "spec/spec-i18n/example/example_group_methods_spec.rb",
117
+ "spec/spec-i18n/example/pending_spec.rb",
109
118
  "spec/spec-i18n/example/subject_spec.rb",
110
119
  "spec/spec-i18n/expectations/kernel_spec.rb",
111
120
  "spec/spec-i18n/matchers/be_close_spec.rb",
@@ -122,40 +131,41 @@ Remember: 'TDD is a muscle. You have to exercise it.' =) (Brian Liles)
122
131
  "spec/spec-i18n/matchers/register_all_matchers_spec.rb",
123
132
  "spec/spec-i18n/matchers/satisfy_spec.rb",
124
133
  "spec/spec-i18n/parser/natural_language_spec.rb",
125
- "spec/spec-i18n/runner/configuration_spec.rb",
126
- "spec/spec-i18n/runner/runner_spec.rb",
134
+ "spec/spec-i18n/runner/rspec_i18n_language_spec.rb",
135
+ "spec/spec-i18n/runner/rspec_i18n_spec.rb",
127
136
  "spec/spec-i18n/spec_examples/pt/pessoa_spec.rb",
128
137
  "spec/spec-i18n/spec_language_spec.rb",
129
138
  "spec/spec_helper.rb",
130
- "examples/i18n/pt/person_spec.rb"
139
+ "examples/i18n/de/german_spec.rb",
140
+ "examples/i18n/pt/portuguese_spec.rb"
131
141
  ]
132
142
 
133
143
  if s.respond_to? :specification_version then
134
144
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
135
145
  s.specification_version = 3
136
146
 
137
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
147
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
138
148
  s.add_runtime_dependency(%q<rspec>, [">= 1.3.0"])
139
149
  s.add_runtime_dependency(%q<terminal-table>, [">= 1.4.2"])
140
- s.add_runtime_dependency(%q<term-ansicolor>, ["= 1.0.4"])
141
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
150
+ s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
151
+ s.add_development_dependency(%q<cucumber>, [">= 0.6.2"])
142
152
  s.add_development_dependency(%q<terminal-table>, [">= 1.4.2"])
143
- s.add_development_dependency(%q<term-ansicolor>, ["= 1.0.4"])
153
+ s.add_development_dependency(%q<aruba>, [">= 0.1.7"])
144
154
  else
145
155
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
146
156
  s.add_dependency(%q<terminal-table>, [">= 1.4.2"])
147
- s.add_dependency(%q<term-ansicolor>, ["= 1.0.4"])
148
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
157
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
158
+ s.add_dependency(%q<cucumber>, [">= 0.6.2"])
149
159
  s.add_dependency(%q<terminal-table>, [">= 1.4.2"])
150
- s.add_dependency(%q<term-ansicolor>, ["= 1.0.4"])
160
+ s.add_dependency(%q<aruba>, [">= 0.1.7"])
151
161
  end
152
162
  else
153
163
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
154
164
  s.add_dependency(%q<terminal-table>, [">= 1.4.2"])
155
- s.add_dependency(%q<term-ansicolor>, ["= 1.0.4"])
156
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
165
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
166
+ s.add_dependency(%q<cucumber>, [">= 0.6.2"])
157
167
  s.add_dependency(%q<terminal-table>, [">= 1.4.2"])
158
- s.add_dependency(%q<term-ansicolor>, ["= 1.0.4"])
168
+ s.add_dependency(%q<aruba>, [">= 0.1.7"])
159
169
  end
160
170
  end
161
171
 
@@ -1,86 +1,111 @@
1
+ # coding: UTF-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module SpecI18n
4
5
  module CommandLine
5
- describe LanguageHelpFormatter do
6
+ describe Language do
6
7
 
7
8
  before(:all) do
8
- @pt = SpecI18n::Parser::NaturalLanguage.get('pt')
9
- @languages = LanguageHelpFormatter.list_languages
10
- @portuguese = LanguageHelpFormatter.list_basic_keywords(@pt)
9
+ @es = SpecI18n::Parser::NaturalLanguage.new('es')
10
+ @pt = SpecI18n::Parser::NaturalLanguage.new('pt')
11
11
  @io_stream = StringIO.new
12
12
  end
13
13
 
14
14
  it "should list languages" do
15
- LanguageHelpFormatter.should_receive(:list_languages).and_return(@languages)
15
+ Language.should_receive(:list_languages).and_return([{'name' => 'pt'}])
16
16
  Kernel.should_receive(:exit)
17
- LanguageHelpFormatter.list_languages_and_exit(StringIO.new)
17
+ Language.list_languages_and_exit(StringIO.new)
18
18
  end
19
19
 
20
20
  it "should list keywords" do
21
- LanguageHelpFormatter.should_receive(:list_basic_keywords).and_return(@portuguese)
21
+ Language.should_receive(:keywords_table)
22
22
  Kernel.should_receive(:exit)
23
- LanguageHelpFormatter.list_keywords_and_exit(@io_stream, 'pt')
23
+ Language.list_keywords_and_exit(@io_stream, 'pt')
24
+ end
25
+
26
+ it "should list matchers keywords" do
27
+ Language.should_receive(:matchers_table)
28
+ Kernel.should_receive(:exit)
29
+ Language.list_keywords_and_exit(@io_stream, 'pt')
30
+ end
31
+
32
+ it "should list hooks keywords" do
33
+ Language.should_receive(:hooks_table)
34
+ Kernel.should_receive(:exit)
35
+ Language.list_keywords_and_exit(@io_stream, 'es')
36
+ end
37
+
38
+ it "should list all keywords and exit" do
39
+ Kernel.should_receive(:exit)
40
+ Language.list_keywords_and_exit(@io_stream, 'es')
41
+ end
42
+
43
+ context "list keywords" do
44
+
45
+ before(:each) do
46
+ @portuguese = NaturalLanguage.new('pt')
47
+ end
48
+
49
+ it "should return nil if not have matchers" do
50
+ stub_keywords!(@portuguese, {'matchers' => {}})
51
+ Language.matchers_table(@io_stream, @portuguese).should be_nil
52
+ end
53
+
54
+ it "return true when have matchers" do
55
+ stub_keywords!(@portuguese, {'matchers' => {'be' => 'ser'}})
56
+ Language.matchers_table(@io_stream, @portuguese).should equal true
57
+ end
58
+
59
+ it "should return nil if have no hooks" do
60
+ stub_keywords!(@portuguese, {'hooks' => {}})
61
+ Language.hooks_table(@io_stream, @portuguese).should be_nil
62
+ end
63
+
64
+ it "should return true when have hooks" do
65
+ stub_keywords!(@portuguese, {'hooks' => { 'each' => 'cada'}})
66
+ Language.hooks_table(@io_stream, @portuguese).should equal true
67
+ end
68
+
24
69
  end
25
70
 
26
71
  context "list languages" do
27
72
 
28
73
  before(:each) do
29
- @portuguese = ["pt", "Portuguese", "português"]
30
- @spanish = ["es", "Spanish", "español"]
74
+ @portuguese = { 'pt' => { 'name' => 'Portuguese', 'native' => 'Português'} }
75
+ @spanish = { 'es' => { 'name' => 'Spanish', 'native' => 'Español' } }
31
76
  end
32
77
 
33
78
  it "should return the three keywords language for portuguese" do
34
- SpecI18n::SPEC_LANGUAGES.should_receive(:keys).and_return("pt")
35
- LanguageHelpFormatter.list_languages.should == [@portuguese]
79
+ Language.should_receive(:all_languages).and_return(@portuguese)
80
+ Language.list_languages.should eql [['pt', 'Portuguese', 'Português']]
36
81
  end
37
82
 
38
83
  it "should return the three keywords for spanish" do
39
- SpecI18n::SPEC_LANGUAGES.should_receive(:keys).and_return("es")
40
- LanguageHelpFormatter.list_languages.should == [@spanish]
84
+ Language.should_receive(:all_languages).and_return(@spanish)
85
+ Language.list_languages.should eql [["es", "Spanish", "Español"]]
41
86
  end
42
87
 
43
88
  it "should return the three keywords for spanish and portuguese" do
44
- SpecI18n::SPEC_LANGUAGES.should_receive(:keys).and_return(["pt", "es"])
45
- LanguageHelpFormatter.list_languages.should == [@portuguese, @spanish].sort
89
+ Language.should_receive(:all_languages).and_return(@portuguese.merge(@spanish))
90
+ Language.list_languages.should eql [["es", "Spanish", "Español"], ['pt', 'Portuguese', 'Português']]
46
91
  end
47
92
  end
48
-
49
- context "list all keywords" do
50
-
51
- before(:each) do
52
- @language_keywords = LanguageHelpFormatter.list_basic_keywords(@pt)
53
- end
54
-
55
- it "should return all basic keywords for a language" do
56
- words = %w(name native describe before after it should should_not)
57
- words.each do |word|
58
- @language_keywords.flatten.should include(word)
59
- end
60
- end
61
-
62
- describe 'the advanced keywords' do
93
+
94
+ context 'require without rubygems' do
63
95
 
64
- before(:each) do
65
- @out = StringIO.new
66
- @keywords = LanguageHelpFormatter.list_advanced_keywords(@out, @pt)
67
- end
96
+ it "should require without rubygems" do
97
+ self.should_receive(:require).with('terminal-table/import').and_return(true)
98
+ self.should_not_receive(:require).with('rubygems')
99
+ require_terminal_table
100
+ end
68
101
 
69
- it "should return the matchers keywords for language" do
70
- @keywords.last.headings.should include('matchers')
71
- end
72
-
73
- it "should return the hooks keywords for language" do
74
- @keywords.first.headings.should include('hooks')
75
- end
76
-
77
- it "should return some keywords for a empty language" do
78
- @es = SpecI18n::Parser::NaturalLanguage.get('es')
79
- @keywords = LanguageHelpFormatter.list_advanced_keywords(@out, @es)
80
- @keywords.first.headings.should include('hooks')
81
- end
102
+ it "should rescue load_error" do
103
+ self.should_receive(:require).with('terminal-table/import').and_raise(LoadError)
104
+ self.should_receive(:require).with('rubygems').and_return(true)
105
+ self.should_receive(:require).with('terminal-table/import').and_return(true)
106
+ require_terminal_table
82
107
  end
83
-
108
+
84
109
  end
85
110
 
86
111
  end
@@ -25,14 +25,14 @@ module SpecI18n
25
25
  it "should list all know languages" do
26
26
  when_parsing "--language help" do
27
27
  require 'spec-i18n/command_line/language_help_formatter'
28
- LanguageHelpFormatter.should_receive(:list_languages_and_exit).with(@output_stream)
28
+ Language.should_receive(:list_languages_and_exit).with(@output_stream)
29
29
  end
30
30
  end
31
31
 
32
32
  it "should list all know keywords for the language" do
33
33
  when_parsing "--language pt" do
34
34
  require 'spec-i18n/command_line/language_help_formatter'
35
- LanguageHelpFormatter.should_receive(:list_keywords_and_exit).with(@output_stream, "pt")
35
+ Language.should_receive(:list_keywords_and_exit).with(@output_stream, "pt")
36
36
  end
37
37
  end
38
38
 
@@ -42,6 +42,15 @@ module SpecI18n
42
42
 
43
43
  end
44
44
  end
45
+
46
+ context '--help' do
47
+ it "should parse the option" do
48
+ when_parsing('--help') do
49
+ options.should_receive(:print_and_exit)
50
+ end
51
+ end
52
+ end
53
+
45
54
  end
46
55
 
47
56
  end