Sha256: 026f24b3c224bd9d450408c5424556c048790d13f98b134f80fdb3ed5130d2e0

Contents?: true

Size: 850 Bytes

Versions: 26

Compression:

Stored size: 850 Bytes

Contents

require_relative 'test_helper'
module MeducationSDK
  class ResourceTest < Minitest::Test
    def self.test_resource(klass, url)
      define_method :klass do klass end
      define_method :url do url end

      class_eval do
        def test_path
          assert_equal url, klass.path
        end

        def test_generates_find_url
          id = 7
          Loquor::HttpAction::Get.expects(:get).with("#{url}/#{id}", anything())
          klass.find(id)
        end
      end
    end
    define_method "test_helpers_included" do
      assert Resource.new({}).respond_to?(:sdk_class_for)
    end

    def test_created_at_is_a_datetime
      resource = Resource.new(created_at: "2014-02-23T23:34:49Z")
      assert resource.created_at.is_a?(DateTime)
      assert_equal DateTime.new(2014, 2, 23, 23, 34, 49), resource.created_at
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
meducation_sdk-2.2.0 test/resource_test.rb
meducation_sdk-2.1.4 test/resource_test.rb
meducation_sdk-2.1.3 test/resource_test.rb
meducation_sdk-2.1.2 test/resource_test.rb
meducation_sdk-2.1.1 test/resource_test.rb
meducation_sdk-2.1.0 test/resource_test.rb
meducation_sdk-2.0.5 test/resource_test.rb
meducation_sdk-2.0.4 test/resource_test.rb
meducation_sdk-2.0.3 test/resource_test.rb
meducation_sdk-2.0.2 test/resource_test.rb
meducation_sdk-2.0.1 test/resource_test.rb
meducation_sdk-2.0.0 test/resource_test.rb
meducation_sdk-1.6.16 test/resource_test.rb
meducation_sdk-1.6.15 test/resource_test.rb
meducation_sdk-1.6.14 test/resource_test.rb
meducation_sdk-1.6.13 test/resource_test.rb
meducation_sdk-1.6.12 test/resource_test.rb
meducation_sdk-1.6.11 test/resource_test.rb
meducation_sdk-1.6.10 test/resource_test.rb
meducation_sdk-1.6.6 test/resource_test.rb