spec/lib/bisu/one_sky_spec.rb in bisu-1.4.2 vs spec/lib/bisu/one_sky_spec.rb in bisu-1.4.3
- old
+ new
@@ -20,17 +20,32 @@
expect(to_i18).to eq({
"en" => { "kConnectFacebook" => "Connect with Facebook", "kNoNoNoMr" => "No, no, no. Mr %{name} not here" },
"ja" => { "kConnectFacebook" => "フェイスブックへ接続" },
"fr" => { "kConnectFacebook" => "Connexion par Facebook" },
"de" => { "kConnectFacebook" => "Mit Facebook verbinden" },
- "ko" => { "kConnectFacebook" => "페이스북으로 접속", "kTwitterServer" => "트위터 서버연결 실패. \n잠시 후 재시도." }
+ "ko" => { "kConnectFacebook" => "페이스북으로 접속", "kTwitterServer" => "트위터 서버연결 실패. \\n잠시 후 재시도." }
})
end
context "when OneSky raises an error" do
before { allow_any_instance_of(Onesky::Client).to receive(:project).and_raise("ups... not allowed!") }
it "raises that same error" do
expect { to_i18 }.to raise_error /not allowed/
+ end
+ end
+
+ context "when OneSky returns the newline bug" do
+ let(:os_response) { File.read("spec/fixtures/sample_one_sky_response_with_bug.txt") }
+
+ it { expect { to_i18 }.not_to raise_error }
+
+ it "returns an hash in i18 format with the newline bug fixed" do
+ expect(to_i18).to eq({
+ "en" => {
+ "kRegularNewLine" => "This is the first line\\nthis is the second line",
+ "kErrorNewLine" => "This is the first line\\nthis is the second line"
+ }
+ })
end
end
end