diff options
author | Benoit Daloze <eregontp@gmail.com> | 2018-08-11 23:28:25 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2018-08-11 23:28:25 +0200 |
commit | 07ca8e87324421de18bfcfee8348a47d99a6f62b (patch) | |
tree | 5f46d132e7ed8be65492bc8a80a167acf395bf67 /spec/install | |
parent | 4819ec27fbbabfd398ed97771c8ca2d2696db7f4 (diff) | |
download | bundler-07ca8e87324421de18bfcfee8348a47d99a6f62b.tar.gz |
Add specs for Gemfiles with non-US-ASCII characters
* The first spec fails on master, and passes with the changes in the
two previous commits.
Diffstat (limited to 'spec/install')
-rw-r--r-- | spec/install/gemfile_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/install/gemfile_spec.rb b/spec/install/gemfile_spec.rb index 45bc232901..fed738a9ca 100644 --- a/spec/install/gemfile_spec.rb +++ b/spec/install/gemfile_spec.rb @@ -112,4 +112,29 @@ RSpec.describe "bundle install" do end end end + + context "with a Gemfile containing non-US-ASCII characters" do + it "reads the Gemfile with the UTF-8 encoding by default" do + install_gemfile <<-G + str = "Il était une fois ..." + puts "The source encoding is: " + str.encoding.name + G + + expect(out).to include("The source encoding is: UTF-8") + expect(out).not_to include("The source encoding is: ASCII-8BIT") + expect(out).to include("Bundle complete!") + end + + it "respects the magic encoding comment" do + # NOTE: This works thanks to #eval interpreting the magic encoding comment + install_gemfile <<-G + # encoding: iso-8859-1 + str = "Il #{"\xE9".b}tait une fois ..." + puts "The source encoding is: " + str.encoding.name + G + + expect(out).to include("The source encoding is: ISO-8859-1") + expect(out).to include("Bundle complete!") + end + end end |