Sha256: 2e9b438ae983ebcae781db879d0222a1f5c545387d6167ac56e06c98d0e46d5f

Contents?: true

Size: 1.54 KB

Versions: 44

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe Emot::CLI do
  before do
    $stdout, $stderr = StringIO.new, StringIO.new
  end

  after() do
    $stdout, $stderr = STDOUT, STDERR
  end

  describe "#show" do
    context "with emoji name" do
      it "outputs icon with its unicode" do
        Emot::CLI.start(['show', 'sunflower'])
        expect($stdout.string).to eq "\u{1F33B}  \e[32msunflower\e[0m (U+1F33B)\n"
      end

      it "outputs no emoji message" do
        Emot::CLI.start(['show', 'hello'])
        expect($stdout.string).to eq "No emoji for 'hello'\n"
      end
    end

    context "without emoji name" do
      it "outputs all emoji with name and unicode" do
        Emot::CLI.start(['show'])
        expect($stdout.string).to match /hash.*sunflower.*1F618.*bathtub/m
      end

      it "outputs all emoji with name" do
        Emot::CLI.start(['show', '--only', 'name'])
        expect($stdout.string).to match /hash.*sunflower.*bathtub/m
        expect($stdout.string).not_to match /1F618/
      end
    end
  end

  describe "#icons" do
    it "outputs all emoji icons" do
      Emot::CLI.start(['icons'])
      expect($stdout.string).to match /\u{1F33B}/
      expect($stdout.string).not_to match /sunflower/
      expect($stdout.string).not_to match /1F33B/
    end
  end

  describe "#names" do
    it "outputs all available names for emojis" do
      Emot::CLI.start(['names'])
      expect($stdout.string).to match /hash.*sunflower.*bathtub/m
      expect($stdout.string).not_to match /\u{1F33B}/
      expect($stdout.string).not_to match /1F33B/
    end
  end
end

Version data entries

44 entries across 29 versions & 2 rubygems

Version Path
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/spec/cli_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/emot-0.0.4/spec/cli_spec.rb