spawn 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +4 -4
- data/lib/{clown.rb → spawn.rb} +1 -1
- data/test/active_record_test.rb +3 -3
- data/test/all_test.rb +8 -8
- data/test/sequel_test.rb +3 -3
- metadata +4 -4
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Spawn
|
2
2
|
=======
|
3
3
|
|
4
4
|
A ridiculously simple fixtures replacement for your web framework of
|
@@ -7,7 +7,7 @@ choice.
|
|
7
7
|
Description
|
8
8
|
-----------
|
9
9
|
|
10
|
-
|
10
|
+
Spawn is a very small library (just 14 lines of code) that can
|
11
11
|
effectively replace fixtures or any other huge library for the same task.
|
12
12
|
|
13
13
|
Usage
|
@@ -28,7 +28,7 @@ With ActiveRecord:
|
|
28
28
|
With Sequel:
|
29
29
|
|
30
30
|
class User < Sequel::Model
|
31
|
-
extend
|
31
|
+
extend Spawn
|
32
32
|
|
33
33
|
spawner do |user|
|
34
34
|
user.name = Faker::Name.name
|
@@ -55,7 +55,7 @@ Or, if you need something special:
|
|
55
55
|
Installation
|
56
56
|
------------
|
57
57
|
|
58
|
-
$ sudo gem install
|
58
|
+
$ sudo gem install spawn
|
59
59
|
|
60
60
|
### Thanks
|
61
61
|
|
data/lib/{clown.rb → spawn.rb}
RENAMED
data/test/active_record_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "active_record"
|
3
3
|
require "contest"
|
4
|
-
require File.dirname(__FILE__) + "/../lib/
|
4
|
+
require File.dirname(__FILE__) + "/../lib/spawn"
|
5
5
|
require "faker"
|
6
6
|
|
7
7
|
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
|
@@ -13,7 +13,7 @@ ActiveRecord::Schema.define do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class ActiveRecordUser < ActiveRecord::Base
|
16
|
-
extend
|
16
|
+
extend Spawn
|
17
17
|
|
18
18
|
validates_presence_of :name
|
19
19
|
|
@@ -23,7 +23,7 @@ class ActiveRecordUser < ActiveRecord::Base
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
class
|
26
|
+
class TestSpawnWithActiveRecord < Test::Unit::TestCase
|
27
27
|
setup do
|
28
28
|
@user = ActiveRecordUser.spawn :name => "John"
|
29
29
|
end
|
data/test/all_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'contest'
|
3
|
-
require File.dirname(__FILE__) + "/../lib/
|
3
|
+
require File.dirname(__FILE__) + "/../lib/spawn"
|
4
4
|
|
5
5
|
class Base
|
6
6
|
attr_accessor :attributes
|
@@ -17,7 +17,7 @@ class Base
|
|
17
17
|
def baz; attributes[:baz] end
|
18
18
|
def self.name; "Foo" end
|
19
19
|
|
20
|
-
extend
|
20
|
+
extend Spawn
|
21
21
|
|
22
22
|
spawner do |object|
|
23
23
|
object.bar = 7
|
@@ -59,9 +59,9 @@ class TestFoo < Test::Unit::TestCase
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
context "that implements
|
63
|
-
should "be kind of
|
64
|
-
assert Foo.kind_of?(
|
62
|
+
context "that implements Spawn" do
|
63
|
+
should "be kind of Spawn" do
|
64
|
+
assert Foo.kind_of?(Spawn)
|
65
65
|
end
|
66
66
|
|
67
67
|
context "when instantiated with spawn" do
|
@@ -82,9 +82,9 @@ class TestFoo < Test::Unit::TestCase
|
|
82
82
|
end
|
83
83
|
|
84
84
|
context "and a class Bar" do
|
85
|
-
context "that also implements
|
86
|
-
should "be kind of
|
87
|
-
assert Bar.kind_of?(
|
85
|
+
context "that also implements Spawn" do
|
86
|
+
should "be kind of Spawn" do
|
87
|
+
assert Bar.kind_of?(Spawn)
|
88
88
|
end
|
89
89
|
|
90
90
|
context "when sent :name" do
|
data/test/sequel_test.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "sequel"
|
3
3
|
require "contest"
|
4
|
-
require File.dirname(__FILE__) + "/../lib/
|
4
|
+
require File.dirname(__FILE__) + "/../lib/spawn"
|
5
5
|
require "faker"
|
6
6
|
|
7
7
|
DB = Sequel.sqlite
|
8
8
|
DB << "CREATE TABLE sequel_users (name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL)"
|
9
9
|
|
10
10
|
class SequelUser < Sequel::Model
|
11
|
-
extend
|
11
|
+
extend Spawn
|
12
12
|
|
13
13
|
validates do
|
14
14
|
presence_of :name
|
@@ -20,7 +20,7 @@ class SequelUser < Sequel::Model
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
class
|
23
|
+
class TestSpawnWithSequel < Test::Unit::TestCase
|
24
24
|
setup do
|
25
25
|
@user = SequelUser.spawn :name => "John"
|
26
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spawn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
@@ -22,7 +22,7 @@ extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
23
23
|
|
24
24
|
files:
|
25
|
-
- lib/
|
25
|
+
- lib/spawn.rb
|
26
26
|
- README.markdown
|
27
27
|
- LICENSE
|
28
28
|
- Rakefile
|
@@ -30,7 +30,7 @@ files:
|
|
30
30
|
- test/all_test.rb
|
31
31
|
- test/sequel_test.rb
|
32
32
|
has_rdoc: false
|
33
|
-
homepage: http://github.com/soveran/
|
33
|
+
homepage: http://github.com/soveran/spawn
|
34
34
|
post_install_message:
|
35
35
|
rdoc_options: []
|
36
36
|
|
@@ -54,6 +54,6 @@ rubyforge_project:
|
|
54
54
|
rubygems_version: 1.3.1
|
55
55
|
signing_key:
|
56
56
|
specification_version: 2
|
57
|
-
summary: Simple fixtures replacement for Sequel, ActiveRecord and probably many other ORMs
|
57
|
+
summary: Simple fixtures replacement for Sequel, ActiveRecord, Ohm and probably many other ORMs
|
58
58
|
test_files: []
|
59
59
|
|