Sha256: d8b54a045bf84e43aeaa67bafa0a96e8a00a01a196d74410be6ee0c2583aa2db

Contents?: true

Size: 962 Bytes

Versions: 3

Compression:

Stored size: 962 Bytes

Contents

require 'spec_helper'

class ScreenPopulatorScreen
  include TE3270

  text_field(:editable, 1, 2, 10, true)
  text_field(:read_only, 2, 3, 12, false)
end

describe TE3270::ScreenPopulator do

  let(:platform) { double('platform') }
  let(:screen_object) { ScreenPopulatorScreen.new platform }

  it 'should set a value in a text field' do
    expect(platform).to receive(:put_string).with('the_value', 1, 2)
    screen_object.populate_screen_with editable: 'the_value'
  end

  it 'should not set a value when a text field is read only' do
    expect(platform).not_to receive(:put_string)
    screen_object.populate_screen_with read_only: 'the_value'
  end

  it 'should attempt to set all values from the provided Hash' do
    expect(platform).to receive(:put_string).with('the_value', 1, 2)
    expect(platform).not_to receive(:put_string).with('read_only', 2, 3)
    screen_object.populate_screen_with(editable: 'the_value', read_only: 'read_only')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
te3270-0.9.0 spec/lib/te3270/screen_populator_spec.rb
te3270-0.8.1 spec/lib/te3270/screen_populator_spec.rb
te3270-0.8.0 spec/lib/te3270/screen_populator_spec.rb