Skip to content

Commit

Permalink
Merge pull request #662 from jmkim/isolate-encoding-test
Browse files Browse the repository at this point in the history
Isolate the test from system charset environment
  • Loading branch information
rafaelfranca authored Jul 24, 2019
2 parents 418fbe6 + f744777 commit 43076f1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spec/actions/inject_into_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,15 @@ def file
end

it "can insert chinese" do
invoke! "doc/README.zh", "\n中文", :after => "__start__"
expect(File.read(File.join(destination_root, "doc/README.zh"))).to eq("__start__\n中文\n说明\n__end__\n")
encoding_original = Encoding.default_external

begin
Encoding.default_external = Encoding.find("UTF-8")
invoke! "doc/README.zh", "\n中文", :after => "__start__"
expect(File.read(File.join(destination_root, "doc/README.zh"))).to eq("__start__\n中文\n说明\n__end__\n")
ensure
Encoding.default_external = encoding_original
end
end
end

Expand Down

0 comments on commit 43076f1

Please sign in to comment.