Sha256: e0704f9f838d00c4985de44176213ff99c63b978ba492d5699bb2f2f90bebd3e

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

module DdeTest
  describe Dde::DdeString do
    before(:each ){ @app = Dde::App.new {|*args|}}

    context ' with valid instance id of active DDE application' do
      it 'can be created from normal string' do
        dde_string = Dde::DdeString.new(@app.id, "My_String")
        dde_string == "My_String"
        dde_string.handle.should be_an Integer
        dde_string.handle.should_not == 0
      end

      it 'can be created from valid DDE string handle' do
        string_handle = dde_create_string_handle(@app.id, 'My String')
        dde_string = Dde::DdeString.new(@app.id, string_handle)
        dde_string == "My_String"
        dde_string.handle.should be_an Integer
        dde_string.handle.should_not == 0
      end
    end

    context ' without instance id of active DDE application' do
      it 'cannot be created from String' do
        lambda{Dde::DdeString.new(nil, "My_String")}.should raise_error Dde::Errors::StringError
        lambda{Dde::DdeString.new(12345, "My_String")}.should raise_error Dde::Errors::StringError
        lambda{Dde::DdeString.new(0, "My_String")}.should raise_error Dde::Errors::StringError
      end

      it 'cannot be created from valid string handle' do
        string_handle = dde_create_string_handle(@app.id, 'My String')
        lambda{Dde::DdeString.new(nil, string_handle)}.should raise_error Dde::Errors::StringError
        lambda{Dde::DdeString.new(12345, string_handle)}.should raise_error Dde::Errors::StringError
        lambda{Dde::DdeString.new(0, string_handle)}.should raise_error Dde::Errors::StringError
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dde-0.2.11 spec/dde/dde_string_spec.rb