specstar-models 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/specstar/models.rb +5 -4
  3. metadata +23 -13
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 96a33e2c36ebdbd57106cea074f14b112e46e98d
4
+ data.tar.gz: 0f8932e8a6e1395408ae480656ade4f567aeb8a1
5
+ SHA512:
6
+ metadata.gz: 6d236f58008e67e689320d076daa92cd0ae46cf7869cb8013f3c85bf11843ef4f69b13827cf65b7f4d19a3248a44c0b156580a38d2d4dd5a2c44148764ded529
7
+ data.tar.gz: 933cc90372c1e7ca6efc5c00bdea4ae00e033edc5ac2a65b382dff2618a9ad88d0824b040aa5858e309b562df7bc80c6e9f8dbb5411763925dad4ff25a0550cf
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core'
2
+ require 'remarkable/active_record'
2
3
 
3
4
  module Specstar
4
5
  module Models
@@ -45,7 +46,7 @@ module Specstar
45
46
  if result && @extras
46
47
  properties = target.class.columns_hash[attr]
47
48
  @extras.each_pair do |property, value|
48
- result = false && break unless properties.send(property) == value
49
+ result = false && break unless properties.send(property).to_s == value.to_s
49
50
  end
50
51
  end
51
52
 
@@ -69,7 +70,7 @@ module Specstar
69
70
  if result && extras.any?
70
71
  properties = model.class.columns_hash[attr]
71
72
  extras.each_pair do |property, value|
72
- result = false && break unless properties.send(property) == value
73
+ result = false && break unless properties.send(property).to_s == value.to_s
73
74
  end
74
75
  end
75
76
 
@@ -77,13 +78,13 @@ module Specstar
77
78
  end
78
79
 
79
80
  def has_association?(model, association)
80
- model.class.reflect_on_all_associations.map { |a| a.name }.include? association.to_sym
81
+ model.class.reflect_on_all_associations.map { |a| a.name.to_s }.include? association.to_s
81
82
  end
82
83
 
83
84
  RSpec::Matchers.define :validate_presence_of do |attr, options|
84
85
  match do |model|
85
86
  (has_attribute?(model, attr) || has_association?(model, attr)) &&
86
- model._validators[attr].select do |validator|
87
+ model._validators[attr.to_sym].select do |validator|
87
88
  validator.instance_of?(ActiveModel::Validations::PresenceValidator) && (options.nil? || validate_presence_of_methods_in_options(model, options) && (options.to_a - validator.options.to_a).empty?)
88
89
  end.size > 0
89
90
  end
metadata CHANGED
@@ -1,30 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specstar-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sujoy Gupta
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-07 00:00:00.000000000 Z
11
+ date: 2013-11-17 00:00:00.000000000 Z
13
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: specstar-remarkable
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.0
14
27
  - !ruby/object:Gem::Dependency
15
28
  name: rspec-core
16
29
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
30
  requirements:
19
- - - ! '>='
31
+ - - '>='
20
32
  - !ruby/object:Gem::Version
21
33
  version: '0'
22
34
  type: :development
23
35
  prerelease: false
24
36
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
37
  requirements:
27
- - - ! '>='
38
+ - - '>='
28
39
  - !ruby/object:Gem::Version
29
40
  version: '0'
30
41
  description:
@@ -36,26 +47,25 @@ files:
36
47
  - lib/specstar/models.rb
37
48
  homepage: http://github.com/sujoyg/specstar-models
38
49
  licenses: []
50
+ metadata: {}
39
51
  post_install_message:
40
52
  rdoc_options: []
41
53
  require_paths:
42
54
  - lib
43
55
  required_ruby_version: !ruby/object:Gem::Requirement
44
- none: false
45
56
  requirements:
46
- - - ! '>='
57
+ - - '>='
47
58
  - !ruby/object:Gem::Version
48
59
  version: '0'
49
60
  required_rubygems_version: !ruby/object:Gem::Requirement
50
- none: false
51
61
  requirements:
52
- - - ! '>='
62
+ - - '>='
53
63
  - !ruby/object:Gem::Version
54
64
  version: '0'
55
65
  requirements: []
56
66
  rubyforge_project:
57
- rubygems_version: 1.8.24
67
+ rubygems_version: 2.1.4
58
68
  signing_key:
59
- specification_version: 3
69
+ specification_version: 4
60
70
  summary: RSpec helpers for models.
61
71
  test_files: []