acts_as_stubbable 0.1.2 → 0.2.0
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.md +1 -6
- data/lib/acts_as_stubbable.rb +6 -2
- metadata +4 -4
data/README.md
CHANGED
@@ -12,18 +12,13 @@ For Rails 3, in your Gemfile:
|
|
12
12
|
|
13
13
|
##Usage
|
14
14
|
Let's pretend we have a column for our Thing class called name, which is a string.
|
15
|
-
First in your ActiveRecord model
|
16
|
-
|
17
|
-
include Stubbable
|
18
|
-
|
19
|
-
Then, tell Stubbable which column should be used to generate the stub, i.e.
|
15
|
+
First in your ActiveRecord model, tell Stubbable which column should be used to generate the stub, i.e.
|
20
16
|
|
21
17
|
acts_as_stubbable :column => :name
|
22
18
|
|
23
19
|
So that your model looks like:
|
24
20
|
|
25
21
|
class Thing < ActiveRecord::Base
|
26
|
-
include Stubbable
|
27
22
|
attr_accessible :name, :stub #for rails 3.2 onwards,
|
28
23
|
acts_as_stubbable :column => :name
|
29
24
|
end
|
data/lib/acts_as_stubbable.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
module Stubbable
|
2
3
|
extend ActiveSupport::Concern
|
3
4
|
|
@@ -33,7 +34,10 @@ module Stubbable
|
|
33
34
|
|
34
35
|
end
|
35
36
|
|
37
|
+
end
|
36
38
|
|
39
|
+
class ActiveRecord::Base
|
40
|
+
include Stubbable
|
41
|
+
end
|
37
42
|
|
38
|
-
|
39
|
-
end
|
43
|
+
#require File.join(File.dirname(__FILE__), 'stubbable', 'railtie.rb') if defined?(Rails::Railtie)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_stubbable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robbie Shepherd
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-04-20 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|