Sha256: 087b91dbcc3a9dd924a6ee14906208c704f3173c0a40b51a98c0c24948c5a0bf

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'
require 'ogr/internal_helpers'

RSpec.describe OGR::InternalHelpers do
  describe '._boolean_access_flag' do
    context "when 'w'" do
      subject { OGR._boolean_access_flag('w') }
      it { is_expected.to eq true }
    end

    context "when 'r'" do
      subject { OGR._boolean_access_flag('r') }
      it { is_expected.to eq false }
    end

    context 'when anything else' do
      it 'raises a RuntimeError' do
        expect { OGR._boolean_access_flag('a') }.to raise_exception RuntimeError
      end
    end
  end

  describe '._format_time_zone_for_ruby' do
    context 'time_zone is 0' do
      subject { OGR._format_time_zone_for_ruby(0) }
      it { is_expected.to be_nil }
    end

    context 'time_zone is 1' do
      subject { OGR._format_time_zone_for_ruby(1) }
      it { is_expected.to be_a String }
      it { is_expected.to_not be_empty }
    end

    context 'time_zone is 100' do
      subject { OGR._format_time_zone_for_ruby(100) }
      it { is_expected.to eq '+0' }
    end
  end

  describe '._format_time_zone_for_ogr' do
    context 'GMT' do
      subject { OGR._format_time_zone_for_ogr('asdf GMT') }
      it { is_expected.to eq 100 }
    end

    context 'not nil and not GMT' do
      subject { OGR._format_time_zone_for_ogr('asdf') }
      it { is_expected.to eq 1 }
    end

    context 'nil' do
      subject { OGR._format_time_zone_for_ogr(nil) }
      it { is_expected.to eq 0 }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta5 spec/unit/ogr/internal_helpers_spec.rb
ffi-gdal-1.0.0.beta4 spec/unit/ogr/internal_helpers_spec.rb