active_mocker 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +7 -0
- data/active_mocker.gemspec +30 -0
- data/lib/active_mocker.rb +5 -0
- data/lib/active_mocker/active_record.rb +12 -0
- data/lib/active_mocker/active_record/relationships.rb +34 -0
- data/lib/active_mocker/active_record/schema.rb +81 -0
- data/lib/active_mocker/active_record/scope.rb +12 -0
- data/lib/active_mocker/base.rb +170 -0
- data/lib/active_mocker/field.rb +28 -0
- data/lib/active_mocker/model_reader.rb +63 -0
- data/lib/active_mocker/reparameterize.rb +21 -0
- data/lib/active_mocker/schema_reader.rb +46 -0
- data/lib/active_mocker/table.rb +22 -0
- data/lib/active_mocker/version.rb +3 -0
- data/lib/file_reader.rb +7 -0
- data/lib/string_reader.rb +9 -0
- data/spec/lib/active_mocker/active_record/schema_spec.rb +2721 -0
- data/spec/lib/active_mocker/base_spec.rb +220 -0
- data/spec/lib/active_mocker/model_reader_spec.rb +126 -0
- data/spec/lib/active_mocker/schema_reader_spec.rb +124 -0
- data/spec/lib/model.rb +28 -0
- data/spec/lib/person.rb +9 -0
- data/spec/lib/schema.rb +40 -0
- metadata +152 -0
data/spec/lib/model.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
class Model < ActiveRecord::Base
|
2
|
+
|
3
|
+
belongs_to :company
|
4
|
+
has_many :users
|
5
|
+
has_one :account
|
6
|
+
has_and_belongs_to_many :disclosure
|
7
|
+
|
8
|
+
def self.duper(value, *args)
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
scope :named, ->(name, value=nil, options={}) { }
|
13
|
+
|
14
|
+
def foo(foobar, value)
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def super
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def bar
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/spec/lib/person.rb
ADDED
data/spec/lib/schema.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
ActiveRecord::Schema.define(version: 20140327205359) do
|
2
|
+
|
3
|
+
create_table "people", force: true do |t|
|
4
|
+
t.integer "company_id"
|
5
|
+
t.string "first_name", limit: 128
|
6
|
+
t.string "middle_name", limit: 128
|
7
|
+
t.string "last_name", limit: 128
|
8
|
+
t.string "address_1", limit: 200
|
9
|
+
t.string "address_2", limit: 100
|
10
|
+
t.string "city", limit: 100
|
11
|
+
t.integer "state_id"
|
12
|
+
t.integer "zip_code_id"
|
13
|
+
t.string "title", limit: 150
|
14
|
+
t.string "department", limit: 150
|
15
|
+
t.string "person_email", limit: 150
|
16
|
+
t.string "work_phone", limit: 20
|
17
|
+
t.string "cell_phone", limit: 20
|
18
|
+
t.string "home_phone", limit: 20
|
19
|
+
t.string "fax", limit: 20
|
20
|
+
t.integer "user_id_assistant"
|
21
|
+
t.date "birth_date"
|
22
|
+
t.boolean "needs_review"
|
23
|
+
t.datetime "created_at"
|
24
|
+
t.datetime "updated_at"
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
create_table "zip_codes", force: true do |t|
|
29
|
+
t.string "zip_code", limit: 9
|
30
|
+
t.integer "state_id"
|
31
|
+
t.integer "cola_by_fip_id"
|
32
|
+
t.string "city_name", limit: 100
|
33
|
+
t.string "County_name", limit: 100
|
34
|
+
t.decimal "City_Latitude", precision: 8, scale: 4
|
35
|
+
t.decimal "City_Longitude", precision: 8, scale: 4
|
36
|
+
end
|
37
|
+
|
38
|
+
add_index "zip_codes", ["zip_code"], name: "index_zip_codes_on_zip_code", unique: true, using: :btree
|
39
|
+
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: active_mocker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dustin Zeisler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: i18n
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.0'
|
83
|
+
description: Create mocks from active record models without loading rails or running
|
84
|
+
a database. The Mocks methods have the same arguments as the AR model and if they
|
85
|
+
change you get a error in your test.
|
86
|
+
email:
|
87
|
+
- dustin@zive.me
|
88
|
+
executables: []
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- ".travis.yml"
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- active_mocker.gemspec
|
99
|
+
- lib/active_mocker.rb
|
100
|
+
- lib/active_mocker/active_record.rb
|
101
|
+
- lib/active_mocker/active_record/relationships.rb
|
102
|
+
- lib/active_mocker/active_record/schema.rb
|
103
|
+
- lib/active_mocker/active_record/scope.rb
|
104
|
+
- lib/active_mocker/base.rb
|
105
|
+
- lib/active_mocker/field.rb
|
106
|
+
- lib/active_mocker/model_reader.rb
|
107
|
+
- lib/active_mocker/reparameterize.rb
|
108
|
+
- lib/active_mocker/schema_reader.rb
|
109
|
+
- lib/active_mocker/table.rb
|
110
|
+
- lib/active_mocker/version.rb
|
111
|
+
- lib/file_reader.rb
|
112
|
+
- lib/string_reader.rb
|
113
|
+
- spec/lib/active_mocker/active_record/schema_spec.rb
|
114
|
+
- spec/lib/active_mocker/base_spec.rb
|
115
|
+
- spec/lib/active_mocker/model_reader_spec.rb
|
116
|
+
- spec/lib/active_mocker/schema_reader_spec.rb
|
117
|
+
- spec/lib/model.rb
|
118
|
+
- spec/lib/person.rb
|
119
|
+
- spec/lib/schema.rb
|
120
|
+
homepage: https://github.com/zeisler/active_mocker
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.2.2
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Create mocks from active record models without loading rails or running a
|
144
|
+
database
|
145
|
+
test_files:
|
146
|
+
- spec/lib/active_mocker/active_record/schema_spec.rb
|
147
|
+
- spec/lib/active_mocker/base_spec.rb
|
148
|
+
- spec/lib/active_mocker/model_reader_spec.rb
|
149
|
+
- spec/lib/active_mocker/schema_reader_spec.rb
|
150
|
+
- spec/lib/model.rb
|
151
|
+
- spec/lib/person.rb
|
152
|
+
- spec/lib/schema.rb
|