sham 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/lib/sham.rb +11 -9
- data/lib/sham/version.rb +1 -1
- metadata +4 -4
data/README.markdown
CHANGED
@@ -20,7 +20,7 @@ Create a sham file for each of your models:
|
|
20
20
|
To enable Sham in a particular environment, add the following to your environment.rb or test.rb file:
|
21
21
|
|
22
22
|
config.after_initialize do
|
23
|
-
Sham.activate!
|
23
|
+
Sham::Config.activate!
|
24
24
|
end
|
25
25
|
|
26
26
|
You can now "sham" your models and pass additional attributes at creation:
|
data/lib/sham.rb
CHANGED
@@ -4,16 +4,7 @@ module Sham
|
|
4
4
|
{}
|
5
5
|
end
|
6
6
|
end
|
7
|
-
|
8
|
-
def self.activate!
|
9
|
-
Dir["#{RAILS_ROOT}/sham/*_sham.rb"].each{ |f| require f }
|
10
7
|
|
11
|
-
Sham.constants.each do |klass|
|
12
|
-
matcher = klass.match(/(.*)Sham/)
|
13
|
-
matcher[1].constantize.send(:include, Sham::Methods) unless matcher.blank?
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
8
|
class Base
|
18
9
|
attr_accessor :klass, :options
|
19
10
|
|
@@ -26,6 +17,17 @@ module Sham
|
|
26
17
|
@klass.sham! @options
|
27
18
|
end
|
28
19
|
end
|
20
|
+
|
21
|
+
class Config
|
22
|
+
def self.activate!
|
23
|
+
Dir["#{RAILS_ROOT}/sham/*_sham.rb"].each{ |f| require f }
|
24
|
+
|
25
|
+
Sham.constants.each do |klass|
|
26
|
+
matcher = klass.match(/(.*)Sham/)
|
27
|
+
matcher[1].constantize.send(:include, Sham::Methods) unless matcher.blank?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
29
31
|
|
30
32
|
def self.string!
|
31
33
|
ActiveSupport::SecureRandom.hex(5)
|
data/lib/sham/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sham
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.4
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pan Thomakos
|
@@ -72,6 +72,6 @@ rubyforge_project: sham
|
|
72
72
|
rubygems_version: 1.3.7
|
73
73
|
signing_key:
|
74
74
|
specification_version: 3
|
75
|
-
summary: sham-0.0
|
75
|
+
summary: sham-0.1.0
|
76
76
|
test_files: []
|
77
77
|
|