File: encoding_spec.rb

package info (click to toggle)
ruby-thor 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 904 kB
  • sloc: ruby: 9,250; makefile: 8; sh: 1
file content (22 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require "helper"
require "thor/base"


describe "file's encoding" do
  def load_thorfile(filename)
    Thor::Util.load_thorfile(File.expand_path("./fixtures/#{filename}", __dir__))
  end

  it "respects explicit UTF-8" do
    load_thorfile("encoding_with_utf8.thor")
    expect(capture(:stdout) { Thor::Sandbox::EncodingWithUtf8.new.invoke(:encoding) }).to match(/ok/)
  end
  it "respects explicit non-UTF-8" do
    load_thorfile("encoding_other.thor")
    expect(capture(:stdout) { Thor::Sandbox::EncodingOther.new.invoke(:encoding) }).to match(/ok/)
  end
  it "has implicit UTF-8" do
    load_thorfile("encoding_implicit.thor")
    expect(capture(:stdout) { Thor::Sandbox::EncodingImplicit.new.invoke(:encoding) }).to match(/ok/)
  end
end