active_mocker 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Rakefile +13 -1
- data/active_mocker.gemspec +3 -1
- data/lib/active_mocker/active_record/schema.rb +3 -2
- data/lib/active_mocker/base.rb +1 -1
- data/lib/active_mocker/field.rb +1 -1
- data/lib/active_mocker/version.rb +1 -1
- data/spec/lib/active_mocker/model_reader_spec.rb +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68e1a8af79ab2883a1bf658e91011099e30421c4
|
4
|
+
data.tar.gz: 93bca089760bc5ab015eb032b733c3d66692d2a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1fde90c5a2c72a6067f2bde4811cd3b66ecf769c567fa47542147ed547ab1dcd0c5ac0da79eb866d72f21af6373dde9500f2fd5a046da23e19a00ec7f18fd0c
|
7
|
+
data.tar.gz: 86212e2a028c91646ac8ed9cb76d042e1b961b3227233f60685addbb34e847b49ee3bcb8c6e7dd610abab1440dacd04262e664f85bf35ae185cb051e103f9fbe
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
@@ -3,5 +3,17 @@ require "bundler/gem_tasks"
|
|
3
3
|
task :default => 'specs'
|
4
4
|
|
5
5
|
task :specs do
|
6
|
-
|
6
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" && RUBY_VERSION >= "1.9"
|
7
|
+
module Kernel
|
8
|
+
alias :__at_exit :at_exit
|
9
|
+
def at_exit(&block)
|
10
|
+
__at_exit do
|
11
|
+
exit_status = $!.status if $!.is_a?(SystemExit)
|
12
|
+
block.call
|
13
|
+
exit exit_status if exit_status
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
raise "Tests Failed" unless system 'rspec'
|
7
19
|
end
|
data/active_mocker.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Dustin Zeisler"]
|
10
10
|
spec.email = ["dustin@zive.me"]
|
11
11
|
spec.summary = %q{Create mocks from active record models without loading rails or running a database}
|
12
|
-
spec.description = %q{Create mocks from active record models without loading rails or running a database. The
|
12
|
+
spec.description = %q{Create mocks from active record models without loading rails or running a database. The Mock's methods have the same arguments as the AR model and if they change you get a error in your test.}
|
13
13
|
spec.homepage = "https://github.com/zeisler/active_mocker"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = '>= 2.0.0'
|
22
|
+
|
21
23
|
spec.add_runtime_dependency "activesupport", "~>4.0"
|
22
24
|
|
23
25
|
spec.add_development_dependency "bundler", "~> 1.5"
|
@@ -3,7 +3,8 @@ module ActiveMocker
|
|
3
3
|
|
4
4
|
class Schema
|
5
5
|
|
6
|
-
def self.define(
|
6
|
+
def self.define(options, &block)
|
7
|
+
version = options[:version]
|
7
8
|
search_result = search_cache(@table_search)
|
8
9
|
search_result unless search_result.nil?
|
9
10
|
schema = parse
|
@@ -71,7 +72,7 @@ module ActiveMocker
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def base_field(type, args)
|
74
|
-
fields << Field.new(
|
75
|
+
fields << Field.new(args.shift, type, args)
|
75
76
|
end
|
76
77
|
|
77
78
|
end
|
data/lib/active_mocker/base.rb
CHANGED
@@ -165,7 +165,7 @@ module ActiveMocker
|
|
165
165
|
klass = Object.const_set(mock_class_name ,Class.new(ActiveHash::Base)) if active_hash_as_base
|
166
166
|
klass = Object.const_set(mock_class_name ,Class.new()) unless active_hash_as_base
|
167
167
|
klass.extend ModelClassMethods
|
168
|
-
klass.include ModelInstanceMethods
|
168
|
+
klass.send(:include, ModelInstanceMethods) # is a private method for ruby 2.0.0
|
169
169
|
klass
|
170
170
|
end
|
171
171
|
|
data/lib/active_mocker/field.rb
CHANGED
@@ -11,14 +11,14 @@ require 'active_mocker/reparameterize'
|
|
11
11
|
|
12
12
|
describe ActiveMocker::ModelReader do
|
13
13
|
|
14
|
-
let(:subject){ described_class.new({model_dir: File.expand_path('../../', __FILE__)}).parse('
|
14
|
+
let(:subject){ described_class.new({model_dir: File.expand_path('../../', __FILE__)}).parse('model') }
|
15
15
|
|
16
16
|
describe '#parse' do
|
17
17
|
|
18
18
|
let(:subject){ described_class.new({model_dir: File.expand_path('../../', __FILE__)}) }
|
19
19
|
|
20
20
|
it 'takes a model name to the active_record model class' do
|
21
|
-
subject.parse('
|
21
|
+
subject.parse('model')
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
@@ -114,7 +114,7 @@ describe ActiveMocker::ModelReader do
|
|
114
114
|
|
115
115
|
let(:subject){described_class.new({model_dir: File.expand_path('../../', __FILE__), file_reader: example_model})}
|
116
116
|
|
117
|
-
let(:search){subject.parse('
|
117
|
+
let(:search){subject.parse('person')}
|
118
118
|
|
119
119
|
it 'let not read a file but return a string instead to be evaluated' do
|
120
120
|
expect(search.relationships_types.belongs_to).to eq [[:zip_code]]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_mocker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.3'
|
97
97
|
description: Create mocks from active record models without loading rails or running
|
98
|
-
a database. The
|
98
|
+
a database. The Mock's methods have the same arguments as the AR model and if they
|
99
99
|
change you get a error in your test.
|
100
100
|
email:
|
101
101
|
- dustin@zive.me
|
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
146
|
requirements:
|
147
147
|
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
149
|
+
version: 2.0.0
|
150
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
152
|
- - ">="
|