Sha256: 343e7e3bdaebf103edb1c07d1278171e1eeb65919c54a871eda033e149b68c69

Contents?: true

Size: 1.55 KB

Versions: 11

Compression:

Stored size: 1.55 KB

Contents

require 'test_rest_helper'

class TestResourceCommon < Minitest::Test

  # all
  resources.each do |resource|
    test_name = "test_#{resource}_all"
    define_method(test_name) do
      # puts test_name
      response = resource_instance(resource).all
      # puts response
      assert_equal response.code, 200
      assert_instance_of HTTP::Response, response
    end
  end

  # all_complex
  resources.each do |resource|
    test_name = "test_#{resource}_all_complex"
    define_method(test_name) do
      # puts test_name
      response = resource_instance(resource).all_complex
      # puts response
      assert_equal response.code, 200
      assert_instance_of HTTP::Response, response
    end
  end

  # find
  resources.each do |resource|
    uuid = random_singleton_uuid resource
    next unless uuid
    test_name = "test_#{resource}_#{uuid}_find"
    define_method(test_name) do
      # puts test_name
      resource_instance = resource_instance(resource)
      response = resource_instance.find id: uuid
      # puts response
      assert_equal response.code, 200
      assert_instance_of HTTP::Response, response
    end
  end

  # meta
  resources.each do |resource|
    meta_methods.each do |meta_type|
      test_name = "test_#{resource}_meta_#{meta_type}"
      define_method(test_name) do
        # puts test_name
        resource_instance = resource_instance(resource)
        response = resource_instance.send meta_type
        # puts response
        assert_equal response.code, 200
        assert_instance_of HTTP::Response, response
      end
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
puree-2.9.2 test/rest/common_test.rb
puree-2.9.1 test/rest/common_test.rb
puree-2.9.0 test/rest/common_test.rb
puree-2.8.1 test/rest/common_test.rb
puree-2.8.0 test/rest/common_test.rb
puree-2.7.0 test/rest/common_test.rb
puree-2.6.0 test/rest/common_test.rb
puree-2.5.1 test/rest/common_test.rb
puree-2.5.0 test/rest/common_test.rb
puree-2.4.0 test/rest/common_test.rb
puree-2.3.0 test/rest/common_test.rb