spec/ibtoolTranslation_spec.rb in ibtoolTranslation-0.0.4 vs spec/ibtoolTranslation_spec.rb in ibtoolTranslation-0.0.5

- old
+ new

@@ -1,7 +1,10 @@ require './lib/IbtoolTranslation' +require 'fileutils' +$debug = true + describe IbtoolTranslation::Core, "load" do baseDataArray = ["B", "hoge\\npiyo\\nfuga", "to D", "numberOfLines : 2", "D", "NumberOfLines", "Root View Controller", "C", "numberOfLines : 1", "Beyond Segue", "numberOfLines : 0"] baseDataText = '"B"; "hoge\npiyo\nfuga"; "to D"; @@ -12,27 +15,51 @@ "C"; "numberOfLines : 1"; "Beyond Segue"; "numberOfLines : 0"; ' - - context "func" do + context "reset and update ja" do before do @i = IbtoolTranslation::Core.new @i.deleteDir "./storyboards/ja.lproj/" - @i.update("./storyboards/", "en", ["ja"]) + @i.update("./storyboards/", "en", ["ja"], false) end it "ja transText is " do @i.transText("./storyboards/ja.lproj/Translation.strings").should == baseDataText end + it "Main.strings don't exist" do + FileTest.exist?("./storyboards/ja.lproj/Main.strings").should == false + end + it "storyboard same" do + @i.transText("./storyboards/en.lproj/Main.storyboard").should == @i.transText("./storyboards/ja.lproj/Main.storyboard") + end end - context "update" do + context "update dd" do before do @i = IbtoolTranslation::Core.new - @i.update("./storyboards/", "en", ["dd"]) + @i.update("./storyboards/", "en", ["dd"], false) end + it "Main.strings don't exist" do + FileTest.exist?("./storyboards/ja.lproj/Main.strings").should == false + end it "storyboard not same" do @i.transText("./storyboards/en.lproj/Main.storyboard").should_not == @i.transText("./storyboards/dd.lproj/Main.storyboard") + end + end + context "create" do + before do + @i = IbtoolTranslation::Core.new + @i.deleteDir "./storyboards/ja.lproj/" + @i.create("./storyboards/", "en", ["ja"], false) + end + it "ja transText is " do + @i.transText("./storyboards/ja.lproj/Translation.strings").should == baseDataText + end + it "Main.strings don't exist" do + FileTest.exist?("./storyboards/ja.lproj/Main.strings").should == false + end + it "Main.storyboard don't exist" do + FileTest.exist?("./storyboards/ja.lproj/Main.storyboard").should == false end end it "storyboards" do IbtoolTranslation::Core.new.storyboards("./storyboards/en.lproj/").should == ["Main"] end \ No newline at end of file