Sha256: f07f0628f368a7e48f6448914a2d1f29dbc04fe35a94a23c3a3441dd674bbd6a

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

require 'spec_helper'

describe Belajar::Terminal do

  it { is_expected.to respond_to :text }

  describe "::text" do
    it "loads a text from a file in the terminal/texts" do
      text = Belajar::Terminal.text(:welcome)
      expect(text).to be_a String
    end

    it "returns an empty string if the file does not exist" do
      text = Belajar::Terminal.text(:non_existent_text)
      expect(text).to eq ''
    end

    it "returns an empty string if the file has no content" do
      allow(File).to receive(:read) { '' }
      expect(Belajar::Terminal.text(:congratulations)).to eq ''
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
belajar-0.1.1 spec/belajar/terminal_spec.rb