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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17ea758ca27dc137a61902c20f54977a6210635e
4
- data.tar.gz: eaf4e9d11079825f6e086475fdd60722a190264a
3
+ metadata.gz: 68e1a8af79ab2883a1bf658e91011099e30421c4
4
+ data.tar.gz: 93bca089760bc5ab015eb032b733c3d66692d2a5
5
5
  SHA512:
6
- metadata.gz: 34471978c024f9efd19a4a8bd302871f7f0dac2d167c7997b0b06c667ed4dfb258e2181bbf04839ad225a91c1f333c9d48e7f97539b84e1ea7b613b98afd1f10
7
- data.tar.gz: d24788dd0753955fb8676301fc1860347281ce7a1366be4a9c09ac8b5c51bd13b4bce0750a1cb83d3629cedb0fb8e1d1ff1bf3795c90ba5e29b56653ac72ab7d
6
+ metadata.gz: f1fde90c5a2c72a6067f2bde4811cd3b66ecf769c567fa47542147ed547ab1dcd0c5ac0da79eb866d72f21af6373dde9500f2fd5a046da23e19a00ec7f18fd0c
7
+ data.tar.gz: 86212e2a028c91646ac8ed9cb76d042e1b961b3227233f60685addbb34e847b49ee3bcb8c6e7dd610abab1440dacd04262e664f85bf35ae185cb051e103f9fbe
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.3"
4
3
  - "2.0.0"
5
4
  - "2.1.0"
6
5
  - "2.1.1"
data/Rakefile CHANGED
@@ -3,5 +3,17 @@ require "bundler/gem_tasks"
3
3
  task :default => 'specs'
4
4
 
5
5
  task :specs do
6
- system 'rspec'
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
@@ -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 Mocks methods have the same arguments as the AR model and if they change you get a error in your test.}
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(version: version, &block)
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(name: args.shift, type: type, options: args)
75
+ fields << Field.new(args.shift, type, args)
75
76
  end
76
77
 
77
78
  end
@@ -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
 
@@ -4,7 +4,7 @@ module ActiveMocker
4
4
 
5
5
  attr_reader :name, :type, :options
6
6
 
7
- def initialize(name: name, type: type, options: options)
7
+ def initialize(name, type, options)
8
8
  @name = name
9
9
  @type = type
10
10
  @options = options
@@ -1,3 +1,3 @@
1
1
  module ActiveMocker
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -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('Model') }
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('Model')
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('Person')}
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.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-02 00:00:00.000000000 Z
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 Mocks methods have the same arguments as the AR model and if they
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: '0'
149
+ version: 2.0.0
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - ">="