sham 0.0.3 → 0.0.4

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 CHANGED
@@ -17,11 +17,11 @@ Create a sham file for each of your models:
17
17
  end
18
18
  end
19
19
 
20
- Note: Sham is automatically enabled in test and cucumber environments. You can manually enable it or disable
21
- it by using the enable! and disable! commands in your environment.rb or test.rb files:
20
+ To enable Sham in a particular environment, add the following to your environment.rb or test.rb file:
22
21
 
23
- Sham::Config.enable!
24
- Sham::Config.disable!
22
+ config.after_initialize do
23
+ Sham.activate!
24
+ end
25
25
 
26
26
  You can now "sham" your models and pass additional attributes at creation:
27
27
 
data/lib/sham.rb CHANGED
@@ -5,26 +5,12 @@ module Sham
5
5
  end
6
6
  end
7
7
 
8
- class Config
9
- @@enabled = false
8
+ def self.activate!
9
+ Dir["#{RAILS_ROOT}/sham/*_sham.rb"].each{ |f| require f }
10
10
 
11
- def self.enable!
12
- @@enabled = true
13
- end
14
-
15
- def self.disable!
16
- @@enabled = false
17
- end
18
-
19
- def self.enabled?
20
- !!@@enabled
21
- end
22
-
23
- def self.activate!
24
- Sham.constants.each do |klass|
25
- matcher = klass.match(/(.*)Sham/)
26
- matcher[1].constantize.send(:include, Sham::Methods) unless matcher.blank?
27
- end
11
+ Sham.constants.each do |klass|
12
+ matcher = klass.match(/(.*)Sham/)
13
+ matcher[1].constantize.send(:include, Sham::Methods) unless matcher.blank?
28
14
  end
29
15
  end
30
16
 
@@ -84,11 +70,4 @@ module Sham
84
70
  end
85
71
  end
86
72
  end
87
- end
88
-
89
- Sham::Config.enable! if ["test", "cucumber"].member?(ENV['RAILS_ENV'])
90
-
91
- if Sham::Config.enabled?
92
- Dir["#{RAILS_ROOT}/sham/*_sham.rb"].each{ |f| require f }
93
- Sham::Config.activate!
94
73
  end
data/lib/sham/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sham
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
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.3
75
+ summary: sham-0.0.4
76
76
  test_files: []
77
77