Sha256: 0cc4fb0e4234d56fdfd02761dc0fd3ae3dec4582c0bf2b4ce02879cd7f0ca21c
Contents?: true
Size: 1.54 KB
Versions: 5
Compression:
Stored size: 1.54 KB
Contents
RSpec.describe TTY::Spinner::Multi, "#line_inset" do let(:output) { StringIO.new("", "w+") } it "doesn't create inset when no top level spinner" do spinners = TTY::Spinner::Multi.new(output: output) spinner = spinners.register "example" expect(spinners.line_inset(spinner)).to eq("") end it "defaults to the empty string for the top level spinner" do spinners = TTY::Spinner::Multi.new("Top level spinner", output: output) expect(spinners.line_inset(1)) .to eq(TTY::Spinner::Multi::DEFAULT_INSET[:top]) end it "returns four spaces when there is a top level spinner" do spinners = TTY::Spinner::Multi.new("Top level spinner", output: output) spinners.register "middle" spinners.register "bottom" expect(spinners.line_inset(2)) .to eq(TTY::Spinner::Multi::DEFAULT_INSET[:middle]) end it "decorates last spinner" do spinners = TTY::Spinner::Multi.new("Top spinner", output: output) spinners.register "middle" spinners.register "bottom" expect(spinners.line_inset(3)) .to eq(TTY::Spinner::Multi::DEFAULT_INSET[:bottom]) end it "allows customization" do opts = { output: output, indent: 4, style: { top: ". ", middle: "--", bottom: "---" } } spinners = TTY::Spinner::Multi.new("Top level spinner", opts) spinners.register "" spinners.register "" expect(spinners.line_inset(1)).to eq(". ") expect(spinners.line_inset(2)).to eq("--") expect(spinners.line_inset(3)).to eq("---") end end
Version data entries
5 entries across 5 versions & 1 rubygems