Sha256: 6235e2ac4535c1c02d7755da8e1b19d4cde98feba6f06dcb7105523f6990a244

Contents?: true

Size: 772 Bytes

Versions: 9

Compression:

Stored size: 772 Bytes

Contents

module Pione
  module TestHelper
    module Location
      # Test location scheme.
      def self.test_scheme(path)
        dir = File.dirname(path)
        name = File.basename(path, ".rb").sub("spec_", "")
        yml_path = File.join(dir, 'data', '%s.yml' % name)

        describe "location scheme test" do
          YAML.load_file(yml_path).each do |testcase|
            if uri = testcase.keys.first
              testcase[uri].keys.each do |name|
                # expectation
                expectation = testcase[uri][name]
                expectation = nil if expectation == "nil"

                # test
                URI.parse(uri).__send__(name).should == expectation
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pione-0.5.0 lib/pione/test-helper/location-helper.rb
pione-0.5.0.alpha.2 lib/pione/test-helper/location-helper.rb
pione-0.5.0.alpha.1 lib/pione/test-helper/location-helper.rb
pione-0.4.2 lib/pione/test-helper/location-helper.rb
pione-0.4.1 lib/pione/test-helper/location-helper.rb
pione-0.4.0 lib/pione/test-helper/location-helper.rb
pione-0.3.2 lib/pione/test-helper/location-helper.rb
pione-0.3.1 lib/pione/test-helper/location-helper.rb
pione-0.3.0 lib/pione/test-helper/location-helper.rb