[logaling-commit] logaling/logaling-command [fix-command-spec] fix spec

Back to archive index

null+****@clear***** null+****@clear*****
Mon Feb 6 18:03:11 JST 2012


SUZUKI Miho	2012-02-06 18:03:11 +0900 (Mon, 06 Feb 2012)

  New Revision: 82518af824f7a59086eb8ad3a30036fe81041609

  Log:
    fix spec

  Modified files:
    spec/logaling/command_spec.rb

  Modified: spec/logaling/command_spec.rb (+8 -11)
===================================================================
--- spec/logaling/command_spec.rb    2012-02-06 15:37:13 +0900 (9509466)
+++ spec/logaling/command_spec.rb    2012-02-06 18:03:11 +0900 (96be62c)
@@ -226,12 +226,9 @@ describe Logaling::Command::Application do
   end
 
   describe '#add' do
-    before do
-      command.new('spec', 'en', 'ja')
-    end
-
     context 'with arguments have only bilingual pair' do
       before do
+        command.new('spec', 'en', 'ja')
         command.add("spec", "テスト")
       end
 
@@ -248,6 +245,7 @@ describe Logaling::Command::Application do
 
     context 'with arguments have bilingual pair and note' do
       before do
+        command.new('spec', 'en', 'ja')
         command.add("spec", "テスト", "備考")
       end
 
@@ -264,23 +262,22 @@ describe Logaling::Command::Application do
 
     context 'project config does not have TARGET-LANGUAGE' do
       let(:global_config) { File.join(LOGALING_HOME, 'config') }
+      let(:base_options) { {"glossary"=>"spec", "source-language"=>"en"} }
       before do
         command.new('spec', 'en')
-        FileUtils.touch(global_config)
-        File.open(global_config, "w") do |f| 
-          f.puts "--target-language fr"
-        end
       end
 
       context 'but global config have it' do
         before do
-          command.add('config test', '設定ファイルのテスト')
+          command.options = base_options.merge("global" => true, "output" => "terminal")
+          command.config("target-language", "fr")
+          command.add('test-logaling', '設定ファイルのテスト')
           stop_pager
-          @stdout = capture(:stdout) {command.lookup("config test")}
+          @stdout = capture(:stdout) {command.lookup("test-logaling")}
         end
 
         it "should use global config's TARGET-LANGUAGE" do
-          @stdout.should include "config test"
+          @stdout.should include "test-logaling"
           @stdout.should include "設定ファイルのテスト"
         end
       end




More information about the logaling-commit mailing list
Back to archive index