to_activerecord 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/to_activerecord/version.rb +1 -1
- data/lib/to_activerecord.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/test_to_activerecord.rb +25 -2
- data/website/index.html +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/lib/to_activerecord.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,11 +1,34 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
2
|
|
3
|
+
class PostError < StandardError
|
4
|
+
end
|
5
|
+
|
6
|
+
class Post
|
7
|
+
def self.find(*args)
|
8
|
+
raise PostError, "Cannot find #{args.inspect}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
3
12
|
class TestToActiverecord < Test::Unit::TestCase
|
4
13
|
|
5
14
|
def setup
|
6
15
|
end
|
7
16
|
|
8
|
-
def
|
9
|
-
|
17
|
+
def test_to_known_post_id
|
18
|
+
post = Post.new
|
19
|
+
Post.expects(:find).with(60).returns(post)
|
20
|
+
assert_equal(post, Post.find(60), "mock not working")
|
21
|
+
|
22
|
+
Post.expects(:find).with(60).returns(post)
|
23
|
+
assert_equal(post, 60.to_post, "to_activerecord not working")
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def test_to_unknown_post_id
|
28
|
+
assert_raise(PostError) { 999.to_post }
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_to_unknown_class
|
32
|
+
assert_raise(NoMethodError) { 30.to_foobar }
|
10
33
|
end
|
11
34
|
end
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>to_activerecord</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/to_activerecord"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/to_activerecord" class="numbers">0.1.
|
36
|
+
<a href="http://rubyforge.org/projects/to_activerecord" class="numbers">0.1.1</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ 7.to_car == Car.find(7)</h1>
|
39
39
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: to_activerecord
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-06-
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2007-06-17 00:00:00 +02:00
|
8
8
|
summary: "Find ActiveRecord instances via their ID value. Now you can use 37.to_post instead of Post.find(37). Used in conjunction with the map_by_method gem: [37,103].map_by_to_post"
|
9
9
|
require_paths:
|
10
10
|
- lib
|