structural 0.0.1 → 0.0.2

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: ea9e0a40c502402274176c463486b3ad8f40dbbd
4
- data.tar.gz: da085f4a8a31ccbd7a031f198accfdcf7aa20351
3
+ metadata.gz: 42ac80a5771a583931812763ee42e0d39fd8f9f0
4
+ data.tar.gz: 9cb8858170f25c56324ebc9fe11b286ba06780b3
5
5
  SHA512:
6
- metadata.gz: 15710f21370fcfb50d32b7f90b756534a41ab215c021083876d6ed8fb0698ba879a42cfd47549c0500091389efa4fd2850a956863a6f88db121ce52a205af40b
7
- data.tar.gz: 2b386c4d70892fe5f6b699c32e9752c18a1b23b5ec2caaf6ed156cae29cc346269d0e309691982c9596715be1c4a4d2d26620b0e877401cb23bd51ea77645157
6
+ metadata.gz: b729b62062df2b8851711c5cf4ec5bf21b99c4a5e7e07da9e2f9d190fd8cea839ade128dd28481fcb6fedb8651f2ddab8df1e679483558049139d85e2d1d0b9d
7
+ data.tar.gz: 6f4b356480d4734ca322a2e9a019e88ffdae0c82b3911620d0a2b6beb2b3c7c6d30e3742a558e86b0a7c1f624a4a9c1ae9a089751f63114c0127af519f5c22d4
@@ -49,6 +49,18 @@ module Structural
49
49
  end
50
50
  end
51
51
 
52
+ class Integer < Cast
53
+ def self.type
54
+ ::Integer
55
+ end
56
+
57
+ def conversion
58
+ value.to_i
59
+ end
60
+
61
+ TypeCasts.register(self)
62
+ end
63
+
52
64
  class Date < Cast
53
65
  def self.type
54
66
  ::Date
@@ -1,3 +1,3 @@
1
1
  module Structural
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -14,6 +14,14 @@ module Structural
14
14
 
15
15
  end
16
16
 
17
+ describe Integer do
18
+ subject { Integer.new("2").cast }
19
+
20
+ it 'casts strings to integers' do
21
+ expect(subject).to eql(2)
22
+ end
23
+ end
24
+
17
25
  describe Date do
18
26
  it 'casts strings to dates' do
19
27
  Date.new("06-06-1983").cast.should eq ::Date.new(1983, 6, 6)
@@ -59,7 +59,7 @@ describe Structural::Model do
59
59
  end
60
60
 
61
61
  it 'allows default values' do
62
- model.quux.should be_false
62
+ model.quux.should eql(false)
63
63
  end
64
64
 
65
65
  describe "typecast option" do
@@ -116,8 +116,8 @@ describe Structural::Model do
116
116
  describe "#fields are present methods" do
117
117
  it 'allows you to check if fields are present' do
118
118
  model = TestModel.new(:foo => 1)
119
- model.foo?.should be_true
120
- model.bar?.should be_false
119
+ model.foo?.should eql(true)
120
+ model.bar?.should eql(false)
121
121
  end
122
122
  end
123
123
 
@@ -153,7 +153,7 @@ describe Structural::Model do
153
153
 
154
154
  describe "#to_proc" do
155
155
  it 'eta expands the model class into its constructor' do
156
- [{},{}].map(&TestModel).all? { |m| m.is_a? TestModel }.should be_true
156
+ [{},{}].map(&TestModel).all? { |m| m.is_a? TestModel }.should eql(true)
157
157
  end
158
158
  end
159
159
  end
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,5 @@
1
1
  require 'rspec'
2
- require 'lib/structural'
3
- require 'simplecov'
4
-
5
- SimpleCov.start if ENV['COVERAGE']
6
-
7
- I18n.enforce_available_locales = false
2
+ require 'structural'
8
3
 
9
4
  RSpec.configure do |config|
10
- config.order = :rand
11
- config.color_enabled = true
12
5
  end
data/structural.gemspec CHANGED
@@ -21,8 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'money'
22
22
  spec.add_dependency 'activesupport'
23
23
 
24
- spec.add_development_dependency 'rspec'
25
- spec.add_development_dependency 'simplecov'
24
+ spec.add_development_dependency 'rspec', "~> 3.0"
26
25
  spec.add_development_dependency 'yard'
27
26
  spec.add_development_dependency 'redcarpet'
28
27
  spec.add_development_dependency 'bundler', '~> 1.6'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structural
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Dunphy
@@ -10,118 +10,104 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-05-12 00:00:00.000000000 Z
13
+ date: 2014-08-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: money
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: activesupport
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0'
49
+ version: '3.0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0'
57
- - !ruby/object:Gem::Dependency
58
- name: simplecov
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - '>='
62
- - !ruby/object:Gem::Version
63
- version: '0'
64
- type: :development
65
- prerelease: false
66
- version_requirements: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - '>='
69
- - !ruby/object:Gem::Version
70
- version: '0'
56
+ version: '3.0'
71
57
  - !ruby/object:Gem::Dependency
72
58
  name: yard
73
59
  requirement: !ruby/object:Gem::Requirement
74
60
  requirements:
75
- - - '>='
61
+ - - ">="
76
62
  - !ruby/object:Gem::Version
77
63
  version: '0'
78
64
  type: :development
79
65
  prerelease: false
80
66
  version_requirements: !ruby/object:Gem::Requirement
81
67
  requirements:
82
- - - '>='
68
+ - - ">="
83
69
  - !ruby/object:Gem::Version
84
70
  version: '0'
85
71
  - !ruby/object:Gem::Dependency
86
72
  name: redcarpet
87
73
  requirement: !ruby/object:Gem::Requirement
88
74
  requirements:
89
- - - '>='
75
+ - - ">="
90
76
  - !ruby/object:Gem::Version
91
77
  version: '0'
92
78
  type: :development
93
79
  prerelease: false
94
80
  version_requirements: !ruby/object:Gem::Requirement
95
81
  requirements:
96
- - - '>='
82
+ - - ">="
97
83
  - !ruby/object:Gem::Version
98
84
  version: '0'
99
85
  - !ruby/object:Gem::Dependency
100
86
  name: bundler
101
87
  requirement: !ruby/object:Gem::Requirement
102
88
  requirements:
103
- - - ~>
89
+ - - "~>"
104
90
  - !ruby/object:Gem::Version
105
91
  version: '1.6'
106
92
  type: :development
107
93
  prerelease: false
108
94
  version_requirements: !ruby/object:Gem::Requirement
109
95
  requirements:
110
- - - ~>
96
+ - - "~>"
111
97
  - !ruby/object:Gem::Version
112
98
  version: '1.6'
113
99
  - !ruby/object:Gem::Dependency
114
100
  name: rake
115
101
  requirement: !ruby/object:Gem::Requirement
116
102
  requirements:
117
- - - '>='
103
+ - - ">="
118
104
  - !ruby/object:Gem::Version
119
105
  version: '0'
120
106
  type: :development
121
107
  prerelease: false
122
108
  version_requirements: !ruby/object:Gem::Requirement
123
109
  requirements:
124
- - - '>='
110
+ - - ">="
125
111
  - !ruby/object:Gem::Version
126
112
  version: '0'
127
113
  description: A cut down fork of the Id gem developed at On The Beach Ltd.
@@ -131,9 +117,9 @@ executables: []
131
117
  extensions: []
132
118
  extra_rdoc_files: []
133
119
  files:
134
- - .gitignore
135
- - .ruby-version
136
- - .travis.yml
120
+ - ".gitignore"
121
+ - ".ruby-version"
122
+ - ".travis.yml"
137
123
  - CONTRIBUTING.md
138
124
  - Gemfile
139
125
  - LICENSE.md
@@ -169,12 +155,12 @@ require_paths:
169
155
  - lib
170
156
  required_ruby_version: !ruby/object:Gem::Requirement
171
157
  requirements:
172
- - - '>='
158
+ - - ">="
173
159
  - !ruby/object:Gem::Version
174
160
  version: '0'
175
161
  required_rubygems_version: !ruby/object:Gem::Requirement
176
162
  requirements:
177
- - - '>='
163
+ - - ">="
178
164
  - !ruby/object:Gem::Version
179
165
  version: '0'
180
166
  requirements: []