fixit 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/README.md +26 -6
- data/fixit.gemspec +1 -1
- data/lib/fixit/fixit.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eabf965490df944ffd5aed4c419c87d486e87a0c
|
|
4
|
+
data.tar.gz: 5a336c8185c2bcaf907d152e6640bee0b493ee42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 295a817c215f110cf1c675cdcc61a0d4fdb6ba371ac17ac3a19ae202c3f955881e8340f85532d711b84eabbf8b7dc8936d1241398c79da3a2cfb0aad5332b463
|
|
7
|
+
data.tar.gz: 8fd55c5a5f043853e9c0f3c8aac024c653a09e67c209dc52d1b33eb4e532861d0be03f79a2895aaf7399b971546d8675bf64ab2eee5facabf447cabf77a50acb
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Fixit, a simple fixture for rspec
|
|
1
|
+
# Fixit, a simple fixture for rspec and may be others
|
|
2
2
|
|
|
3
3
|
## What is it?
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
## How to use
|
|
16
16
|
####write fixture
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
#spec/fixits.rb
|
|
19
19
|
|
|
20
20
|
Fixit.manage User do
|
|
21
21
|
assign :user1 do
|
|
@@ -39,12 +39,32 @@ in \#spec/fixits.rb
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Of cource, you can add many records at once by like this.
|
|
43
|
+
|
|
44
|
+
Fixit.manage User do
|
|
45
|
+
1000.times do |i|
|
|
46
|
+
assign "user#{i+1}".to_sym do
|
|
47
|
+
name Faker::Name.name
|
|
48
|
+
email Faker::Internet.email
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
And you can put it as separate files in other directory.
|
|
54
|
+
|
|
55
|
+
Fixit automatically loads
|
|
56
|
+
|
|
57
|
+
* spec/fixits.rb
|
|
58
|
+
* spec/fixit/*.rb
|
|
59
|
+
* test/fixits.rb
|
|
60
|
+
* test/fixit/*.rb
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
43
64
|
|
|
44
65
|
####load fixture
|
|
45
66
|
|
|
46
|
-
|
|
47
|
-
|
|
67
|
+
#spec/spec_helper.rb
|
|
48
68
|
require 'fixit'
|
|
49
69
|
Fixit.load
|
|
50
70
|
|
|
@@ -69,5 +89,5 @@ instead of Fixit.load.
|
|
|
69
89
|
Fixit assumes that model classes
|
|
70
90
|
|
|
71
91
|
* have accessor methods to each attributes(i.e; columns of record)
|
|
72
|
-
* have save! method to insert new record
|
|
92
|
+
* have save! or save method to insert new record
|
|
73
93
|
|
data/fixit.gemspec
CHANGED
data/lib/fixit/fixit.rb
CHANGED
|
@@ -17,8 +17,8 @@ class Fixit
|
|
|
17
17
|
alias method_missing attribute
|
|
18
18
|
|
|
19
19
|
class << self
|
|
20
|
-
FIXIT_FILE = '
|
|
21
|
-
FIXIT_DIR = '
|
|
20
|
+
FIXIT_FILE = 'fixits.rb'
|
|
21
|
+
FIXIT_DIR = 'fixit'
|
|
22
22
|
|
|
23
23
|
@@prepared = false
|
|
24
24
|
|
|
@@ -57,8 +57,10 @@ class Fixit
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def prepare
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
%w(spec test).each do |dir|
|
|
61
|
+
require "#{dir}/#{FIXIT_FILE}" if File.exists? "#{dir}/#{FIXIT_FILE}"
|
|
62
|
+
Dir["#{dir}/#{FIXIT_DIR}/*.rb"].each {|f| require f }
|
|
63
|
+
end
|
|
62
64
|
@@prepared = true
|
|
63
65
|
end
|
|
64
66
|
|