Sha256: 10c06f7c841c2f25b9ff4998be46c465f8fe1a522918ae1c6a17cfa083d6a04d

Contents?: true

Size: 612 Bytes

Versions: 4

Compression:

Stored size: 612 Bytes

Contents

require 'spec_helper'

describe Daigaku::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 = Daigaku::Terminal.text(:welcome)
      expect(text).to be_a String
    end

    it "returns an empty string if the file does not exist" do
      text = Daigaku::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(Daigaku::Terminal.text(:congratulations)).to eq ''
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daigaku-0.3.0 spec/daigaku/terminal_spec.rb
daigaku-0.2.0 spec/daigaku/terminal_spec.rb
daigaku-0.1.1 spec/daigaku/terminal_spec.rb
daigaku-0.1.0 spec/daigaku/terminal_spec.rb