test/representation_test.rb in loquor-0.1.1 vs test/representation_test.rb in loquor-0.1.2
- old
+ new
@@ -1,43 +1,15 @@
require File.expand_path('../test_helper', __FILE__)
module Loquor
- class RepresentationTest < Minitest::Test
- class FoobarRepresentation
- extend Representation::ClassMethods
- include Representation::InstanceMethods
-
- def build_path
- "/foobar"
- end
-
- def self.path
- "/foobar"
- end
+ class RepresenationTest < Minitest::Test
+ def test_is_accessible_as_a_hash
+ representation = Representation.new({foo: "bar"})
+ assert_equal "bar", representation[:foo]
end
- def test_find_should_get_correct_path_with_simple_path
- id = 8
- Loquor.expects(:get).with("/foobar/#{id}")
- FoobarRepresentation.find(id)
- end
-
- def test_find_each_should_get_correct_path
- Loquor.expects(:get).with("/foobar?&page=1&per=200").returns([])
- FoobarRepresentation.find_each
- end
-
- def test_find_each_should_yield_block
- Loquor.expects(:get).returns([{id: 1}])
- ids = []
- FoobarRepresentation.find_each do |json|
- ids << json['id']
- end
- end
-
- def test_where_should_get_correct_path_with_simple_path
- email = "foobar"
- Loquor.expects(:get).with("/foobar?email=#{email}")
- FoobarRepresentation.where(email: email).to_a
+ def test_hash_keys_are_accessible_via_methods
+ representation = Representation.new({foo: "bar"})
+ assert_equal "bar", representation.foo
end
end
end