Sha256: ad3448e76058b3fc12257163faf9b9112ee84ab2537f983601e96080fe958d06
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'test/unit' require 'regurgitator' class TestServerSettings < Test::Unit::TestCase include Regurgitator::ServerSettings attr_accessor :db def setup @db = Sequel.connect 'sqlite:///' @db.create_table(:server_settings) do String :field, :size => 50, :null => false, :primary_key => true String :value, :size => 255 end end def test_zones ds = @db[:server_settings] [ %w(network_zones west,east,central), %w(zone_west 10.1.0.0/16), %w(zone_central 10.2.0.0/16), %w(zone_east 10.3.0.0/16) ].each { |(field,value)| ds.insert(:field => field, :value => value) } assert_equal 'west', zone_for('10.1.0.8') assert_equal 'central', zone_for('10.2.1.8') assert_equal 'east', zone_for('10.3.1.8') assert_nil zone_for('127.0.0.1') end def test_no_zones_defined ds = @db[:server_settings] assert_nil zone_for('10.1.0.8') assert_nil zone_for('10.2.1.8') assert_nil zone_for('10.3.1.8') assert_nil zone_for('127.0.0.1') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
regurgitator-0.0.0 | test/test_server_settings.rb |