Sha256: 58bd73e9b5896204c3ca1df886380b689f72b656c22acb46a76a594ffe2e6b01

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Yuyi::Ui do
  describe '#present_options' do
    before do
      class UiTest; extend Yuyi::Ui; end

      @output = ''
      allow(UiTest).to receive :say do |o, p|
        @output << (o || '')
      end

      class PresentOptionsRoll; end
      allow(PresentOptionsRoll).to receive(:title).and_return 'Present Options Roll'
      allow(PresentOptionsRoll).to receive(:file_name).and_return :present_options_roll
      allow(PresentOptionsRoll).to receive(:options).and_return({ :option_foo => '3.0' })
      allow(PresentOptionsRoll).to receive(:option_defs).and_return({
        :option_foo => {
          :description => 'foo description',
          :example => '1.0',
          :default => '2.0'
        }
      })

      UiTest.send :present_options, PresentOptionsRoll
    end

    it 'should output the neccessary information' do
      expect(@output).to include 'Present Options Roll'
      expect(@output).to include 'present_options_roll'
      expect(@output).to include 'foo description'
      expect(@output).to include '1.0'
      expect(@output).to include '2.0'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yuyi-1.1.5 spec/lib/yuyi/ui_spec.rb
yuyi-1.1.4 spec/lib/yuyi/ui_spec.rb
yuyi-1.1.3 spec/lib/yuyi/ui_spec.rb