mcfly 0.0.22 → 0.1.0

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
- SHA1:
3
- metadata.gz: dfa7eb3d096d073c612a420541d783871fe89f70
4
- data.tar.gz: 3a381cf3c1b1ccda0d5bc2816bd39931c10b8fbc
2
+ SHA256:
3
+ metadata.gz: 02aac542796dfd1f61656f5d67ab560e2ae25072aee47a0ea51b2dbc40346f6f
4
+ data.tar.gz: 91cc393fe3e61a3273efb3af5dcda3e2da944f4c7ac21b9d53f2597a46a8ed73
5
5
  SHA512:
6
- metadata.gz: b1ecd0687829555c088eb4454268ce63185000faa97294c3b728b0c1d8dba65afb24f60163ef9e1fb89f5bdd9f55511f508873e69bd70641a270332f6dd8931b
7
- data.tar.gz: f92d603a79cf315554f69d26b591932f62e831a8e01ae3ce8605ad63afffaaf0e2d8745e86c5aaba02b67f0c29c8f333015f68730e6f445575b4aad09acf9d38
6
+ metadata.gz: f8380a467c4732615ac410e3f71861ad4a47d4dc8d831c6c030b7c8169d44437c9eb4b003464ea2ce904a1cfd41872254dac10bbfa9f3853fa5b9ebf26054fbd
7
+ data.tar.gz: ac15503f7d8d6f023df03fe0072c6ae149c3f0c774cee7e64eca0829f91acb8a66d07d4b539756a466e6daa58d4a01aab3a9015c079e62cdeedd6d1c50a234fb
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ Gemfile.lock
6
7
  InstalledFiles
7
8
  _yardoc
8
9
  coverage
data/Gemfile CHANGED
@@ -4,5 +4,9 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development, :test do
7
+ # gem 'delorean_lang', path: File.expand_path('../../delorean', __FILE__)
7
8
  gem 'rspec-instafail', require: false
9
+ gem 'rubocop', require: false
10
+ gem 'pry-byebug'
11
+ gem 'pry-rails'
8
12
  end
@@ -1,3 +1,3 @@
1
1
  module Mcfly
2
- VERSION = "0.0.22"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_dependency "pg", "~> 0.17"
19
+ s.add_dependency "pg"
20
20
 
21
21
  s.add_dependency "delorean_lang"
22
22
 
@@ -69,28 +69,28 @@ describe "Mcfly" do
69
69
  mp.save!
70
70
 
71
71
  l = MarketPrice.where("group_id = ?", mp.id).order("obsoleted_dt").all
72
- l.length.should == 2
72
+ expect(l.length).to eq(2)
73
73
 
74
- l[1].obsoleted_dt.should == Float::INFINITY
75
- l[0].obsoleted_dt.should == mp.created_dt
74
+ expect(l[1].obsoleted_dt).to eq(Float::INFINITY)
75
+ expect(l[0].obsoleted_dt).to eq(mp.created_dt)
76
76
 
77
77
  # Make sure that setting an old created_dt fails.
78
78
  mp.price = mp.price + 123
79
79
  mp.created_dt = mp.created_dt - 1.day
80
- lambda {
80
+ expect {
81
81
  mp.save!
82
- }.should raise_error(ActiveRecord::StatementInvalid)
82
+ }.to raise_error(ActiveRecord::StatementInvalid)
83
83
  end
84
84
 
85
85
  it "should make sure that append-only does not allow changes" do
86
86
  si = SecurityInstrument.lookup('infinity', "FN Fix-30 MBS")
87
- si.settlement_class.should == "A"
87
+ expect(si.settlement_class).to eq("A")
88
88
 
89
89
  si.name = "xyz"
90
90
 
91
- lambda {
91
+ expect {
92
92
  si.save!
93
- }.should raise_error(ActiveRecord::StatementInvalid)
93
+ }.to raise_error(ActiveRecord::StatementInvalid)
94
94
 
95
95
  end
96
96
 
@@ -100,11 +100,11 @@ describe "Mcfly" do
100
100
 
101
101
  osi = SecurityInstrument.find_by_name("FN Fix-30 MBS")
102
102
 
103
- (osi.obsoleted_dt - DateTime.now).to_f.abs.should < 100
103
+ expect((osi.obsoleted_dt - DateTime.now).to_f.abs).to be < 100
104
104
 
105
- lambda {
105
+ expect {
106
106
  osi.delete
107
- }.should raise_error(ActiveRecord::StatementInvalid)
107
+ }.to raise_error(ActiveRecord::StatementInvalid)
108
108
  end
109
109
 
110
110
  it "should be able to delete append-only items and create a new clone" do
@@ -118,20 +118,21 @@ describe "Mcfly" do
118
118
  end
119
119
 
120
120
  it "should check basic versioning" do
121
- SecurityInstrument.lookup_all('infinity').count.should == @sis.count
121
+ expect(SecurityInstrument.lookup_all('infinity').count).to eq(@sis.count)
122
122
 
123
123
  @dts.each_with_index { |pt, i|
124
- SecurityInstrument.lookup_all(pt + " 12:00 PST8PDT").count.should ==
125
- (i+1) * @sis.count/@dts.length
124
+ expect(SecurityInstrument.lookup_all(pt + " 12:00 PST8PDT").count).to eq(
125
+ (i + 1) * @sis.count/@dts.length
126
+ )
126
127
  }
127
128
 
128
- SecurityInstrument.lookup_all(@old).count.should == 0
129
- SecurityInstrument.lookup(@old, "FN Fix-30 MBS").should == nil
129
+ expect(SecurityInstrument.lookup_all(@old).count).to eq(0)
130
+ expect(SecurityInstrument.lookup(@old, "FN Fix-30 MBS")).to eq(nil)
130
131
 
131
132
  # all versions
132
133
  MarketPrice.count == @sis.length * (@vers+1)
133
134
 
134
- MarketPrice.lookup_all('infinity').count.should == @sis.count
135
+ expect(MarketPrice.lookup_all('infinity').count).to eq(@sis.count)
135
136
 
136
137
  si = SecurityInstrument.first
137
138
 
@@ -142,7 +143,7 @@ describe "Mcfly" do
142
143
  # previous version of mp
143
144
  omp = MarketPrice.lookup_si(odate, si)
144
145
 
145
- mp.price.should == omp.price + 1
146
+ expect(mp.price).to eq(omp.price + 1)
146
147
  end
147
148
 
148
149
  it "should test mcfly uniqueness validations" do
@@ -166,9 +167,9 @@ describe "Mcfly" do
166
167
  mp2 = new_mp(mp.price + 100)
167
168
 
168
169
  mp2.created_dt = si.created_dt + 1.day
169
- lambda {
170
+ expect {
170
171
  mp2.save!
171
- }.should raise_error(ActiveRecord::RecordInvalid)
172
+ }.to raise_error(ActiveRecord::RecordInvalid)
172
173
 
173
174
  # now change mp's settlement_mm
174
175
  mp.settlement_mm += 1
@@ -185,22 +186,22 @@ describe "Mcfly" do
185
186
  dt = '2010-01-01 08:00 PST8PDT'
186
187
 
187
188
  mp = MarketPrice.lookup_si(dt, si)
188
- mp.obsoleted_dt.should == Float::INFINITY
189
+ expect(mp.obsoleted_dt).to eq(Float::INFINITY)
189
190
 
190
191
  sleep 1.seconds
191
192
 
192
193
  mp.delete
193
194
 
194
- MarketPrice.lookup_si('infinity', si).should == nil
195
+ expect(MarketPrice.lookup_si('infinity', si)).to eq(nil)
195
196
 
196
197
  omp = MarketPrice.lookup_si(dt, si)
197
- omp.should_not == nil
198
- omp.obsoleted_dt.should_not == Float::INFINITY
198
+ expect(omp).not_to eq(nil)
199
+ expect(omp.obsoleted_dt).not_to eq(Float::INFINITY)
199
200
 
200
201
  omp.price = 1010
201
- lambda {
202
+ expect {
202
203
  omp.save!
203
- }.should raise_error(ActiveRecord::StatementInvalid)
204
+ }.to raise_error(ActiveRecord::StatementInvalid)
204
205
  end
205
206
 
206
207
  it "whodunnit should set user/o_user on CRUD" do
@@ -212,32 +213,32 @@ describe "Mcfly" do
212
213
  sleep 1.seconds
213
214
 
214
215
  mp = MarketPrice.lookup_si(dt, si)
215
- mp.user_id.should == 10
216
+ expect(mp.user_id).to eq(10)
216
217
 
217
218
  mp.price = 123
218
219
  mp.save!
219
220
 
220
221
  # old version should still have original creator user
221
222
  mp = MarketPrice.lookup_si(dt, si)
222
- mp.user_id.should == 10
223
- mp.o_user_id.should == 20
223
+ expect(mp.user_id).to eq(10)
224
+ expect(mp.o_user_id).to eq(20)
224
225
 
225
226
  # new version should have new creator
226
227
  mp = MarketPrice.lookup_si('infinity', si)
227
- mp.user_id.should == 20
228
- mp.o_user_id.should == nil
228
+ expect(mp.user_id).to eq(20)
229
+ expect(mp.o_user_id).to eq(nil)
229
230
  end
230
231
 
231
232
  it "should set o_user on delete" do
232
233
  si = SecurityInstrument.find_by_name("FN Fix-15 HB MBS")
233
234
  mp = MarketPrice.lookup_si('infinity', si)
234
- mp.obsoleted_dt.should == Float::INFINITY
235
- mp.o_user_id.should == nil
235
+ expect(mp.obsoleted_dt).to eq(Float::INFINITY)
236
+ expect(mp.o_user_id).to eq(nil)
236
237
 
237
238
  rid = mp.id
238
239
  Mcfly.whodunnit = {id: 30}
239
240
  mp.delete
240
241
  mp = MarketPrice.find(rid)
241
- mp.o_user_id.should == 30
242
+ expect(mp.o_user_id).to eq(30)
242
243
  end
243
244
  end
@@ -39,7 +39,7 @@ describe "Mcfly" do
39
39
  (t - SecurityInstrument.find_by_name(name).obsoleted_dt).round
40
40
  }
41
41
 
42
- deltas.should == [8, 6, 4, 2]
42
+ expect(deltas).to eq([8, 6, 4, 2])
43
43
  end
44
44
 
45
45
  end
@@ -3,12 +3,12 @@ ENV["RAILS_ENV"] ||= 'test'
3
3
  require File.expand_path("../dummy/config/environment", __FILE__)
4
4
 
5
5
  require 'rspec/rails'
6
- require 'rspec/autorun'
6
+ require 'pry'
7
7
 
8
8
  Rails.backtrace_cleaner.remove_silencers!
9
9
 
10
10
  # Run any available migration
11
- ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
11
+ ActiveRecord::Migration.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
12
12
 
13
13
  # Requires supporting ruby files with custom matchers and macros, etc,
14
14
  # in spec/support/ and its subdirectories.
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-12 00:00:00.000000000 Z
11
+ date: 2019-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.17'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.17'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: delorean_lang
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -62,7 +62,6 @@ files:
62
62
  - ".gitignore"
63
63
  - ".rspec"
64
64
  - Gemfile
65
- - Gemfile.lock
66
65
  - MIT-LICENSE
67
66
  - README.md
68
67
  - Rakefile
@@ -140,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
139
  version: '0'
141
140
  requirements: []
142
141
  rubyforge_project:
143
- rubygems_version: 2.6.14
142
+ rubygems_version: 2.7.8
144
143
  signing_key:
145
144
  specification_version: 4
146
145
  summary: A database table versioning system.
@@ -1,110 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- mcfly (0.0.21)
5
- delorean_lang
6
- pg (~> 0.17)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actionpack (5.1.4)
12
- actionview (= 5.1.4)
13
- activesupport (= 5.1.4)
14
- rack (~> 2.0)
15
- rack-test (>= 0.6.3)
16
- rails-dom-testing (~> 2.0)
17
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
- actionview (5.1.4)
19
- activesupport (= 5.1.4)
20
- builder (~> 3.1)
21
- erubi (~> 1.4)
22
- rails-dom-testing (~> 2.0)
23
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
- activemodel (5.1.4)
25
- activesupport (= 5.1.4)
26
- activerecord (5.1.4)
27
- activemodel (= 5.1.4)
28
- activesupport (= 5.1.4)
29
- arel (~> 8.0)
30
- activesupport (5.1.4)
31
- concurrent-ruby (~> 1.0, >= 1.0.2)
32
- i18n (~> 0.7)
33
- minitest (~> 5.1)
34
- tzinfo (~> 1.1)
35
- arel (8.0.0)
36
- builder (3.2.3)
37
- concurrent-ruby (1.1.4)
38
- crass (1.0.3)
39
- delorean_lang (0.5.1)
40
- activerecord (>= 3.2)
41
- treetop (~> 1.5)
42
- diff-lcs (1.3)
43
- erubi (1.7.0)
44
- i18n (0.9.5)
45
- concurrent-ruby (~> 1.0)
46
- loofah (2.1.1)
47
- crass (~> 1.0.2)
48
- nokogiri (>= 1.5.9)
49
- method_source (0.9.0)
50
- mini_portile2 (2.3.0)
51
- minitest (5.11.3)
52
- nokogiri (1.8.1)
53
- mini_portile2 (~> 2.3.0)
54
- pg (0.21.0)
55
- polyglot (0.3.5)
56
- rack (2.0.3)
57
- rack-test (0.8.2)
58
- rack (>= 1.0, < 3)
59
- rails-dom-testing (2.0.3)
60
- activesupport (>= 4.2.0)
61
- nokogiri (>= 1.6)
62
- rails-html-sanitizer (1.0.3)
63
- loofah (~> 2.0)
64
- railties (5.1.4)
65
- actionpack (= 5.1.4)
66
- activesupport (= 5.1.4)
67
- method_source
68
- rake (>= 0.8.7)
69
- thor (>= 0.18.1, < 2.0)
70
- rake (12.3.0)
71
- rspec (3.7.0)
72
- rspec-core (~> 3.7.0)
73
- rspec-expectations (~> 3.7.0)
74
- rspec-mocks (~> 3.7.0)
75
- rspec-core (3.7.1)
76
- rspec-support (~> 3.7.0)
77
- rspec-expectations (3.7.0)
78
- diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.7.0)
80
- rspec-instafail (1.0.0)
81
- rspec
82
- rspec-mocks (3.7.0)
83
- diff-lcs (>= 1.2.0, < 2.0)
84
- rspec-support (~> 3.7.0)
85
- rspec-rails (3.7.2)
86
- actionpack (>= 3.0)
87
- activesupport (>= 3.0)
88
- railties (>= 3.0)
89
- rspec-core (~> 3.7.0)
90
- rspec-expectations (~> 3.7.0)
91
- rspec-mocks (~> 3.7.0)
92
- rspec-support (~> 3.7.0)
93
- rspec-support (3.7.0)
94
- thor (0.20.0)
95
- thread_safe (0.3.6)
96
- treetop (1.6.10)
97
- polyglot (~> 0.3)
98
- tzinfo (1.2.5)
99
- thread_safe (~> 0.1)
100
-
101
- PLATFORMS
102
- ruby
103
-
104
- DEPENDENCIES
105
- mcfly!
106
- rspec-instafail
107
- rspec-rails (~> 3.0)
108
-
109
- BUNDLED WITH
110
- 2.0.1