Sha256: 831511c640196bbde91a8e6dacc4d7a353ee496142972f084ad02f54e4f03a4b
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' require 'wordlist/format' describe Wordlist::Format do describe ".infer" do context "when given a path ending in '.txt'" do it "must return :txt" do expect(subject.infer("path/to/file.txt")).to eq(:txt) end end context "when given a path ending in '.gz'" do it "must return :gzip" do expect(subject.infer("path/to/file.gz")).to eq(:gzip) end end context "when given a path ending in '.bz2'" do it "must return :bzip2" do expect(subject.infer("path/to/file.bz2")).to eq(:bzip2) end end context "when given a path ending in '.xz'" do it "must return :xz" do expect(subject.infer("path/to/file.xz")).to eq(:xz) end end context "when given a path ending in '.zip'" do it "must return :zip" do expect(subject.infer("path/to/file.zip")).to eq(:zip) end end context "when given a path ending in '.7z'" do it "must return :7zip" do expect(subject.infer("path/to/file.7z")).to eq(:"7zip") end end context "when given a path ending in another file extension" do let(:path) { "path/to/file.foo" } it do expect { subject.infer(path) }.to raise_error(Wordlist::UnknownFormat,"could not infer the format of file: #{path.inspect}") end end context "when given a path has no file extension" do let(:path) { "path/to/file" } it do expect { subject.infer(path) }.to raise_error(Wordlist::UnknownFormat,"could not infer the format of file: #{path.inspect}") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wordlist-1.1.1 | spec/format_spec.rb |
wordlist-1.1.0 | spec/format_spec.rb |