scripterator 1.3.2 → 1.4.0.beta1

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
  SHA256:
3
- metadata.gz: e002c7c2f8a23025616e716feecee5eb91e63f18f2259330cd1de05741e02194
4
- data.tar.gz: b2a352a7a63ef7b034268de7145937b0bf0846cb7f2aebe9450843591eb31de8
3
+ metadata.gz: f3a9bebcb93c93fd3590111a9de9c3b897b91fa72c8d92367324f20421c9a22a
4
+ data.tar.gz: e33762149d3e8755f922f3b42b2325bcdba9051468e8ecc02c7bb936ecd36e9b
5
5
  SHA512:
6
- metadata.gz: 88743c467241d13ff38e788a794d70aa0db9c75396e7784e162e9fec35a015e3fd0497623be5d46703419f013bed0db000b0f124973269082d2fb0168db0536f
7
- data.tar.gz: 6a21f51c881e51d33385cecb6056b1b1e6d9105e50043e7265b3e71d68650a98446cfc860542e639b90ff3ff372730cf2392b2bd8183ffa022c6be4c442e8e6f
6
+ metadata.gz: 24c110bdc5b6641575155b7a97a73104bdab2b6a509518fbd4546377c5604f90044ecb52a6b5491274770801a7f4321655d5a1649c841c2a9fbe0245ba0f6a82
7
+ data.tar.gz: 569ad38184a922e01604b177fcc08b66c518864cbe0d78f3b5b29d043cb1b5eec0db4bd7c491367bafe16b3db4bfb1f2616b710b4296aaa33a69040ba8ac1dd9
data/.gitignore CHANGED
@@ -3,7 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
6
+ Gemfile*.lock
7
7
  InstalledFiles
8
8
  _yardoc
9
9
  coverage
data/.travis.yml CHANGED
@@ -1,9 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.5.0
3
+ - 2.5.8
4
4
  script: bundle exec rspec
5
+ gemfile:
6
+ - Gemfile-rails-4.2.x
7
+ - Gemfile-rails-5.0.x
8
+ - Gemfile-rails-5.1.x
9
+ - Gemfile-rails-5.2.x
5
10
 
6
- env:
7
- - 'RAILS_VERSION=4.2'
8
- - 'RAILS_VERSION=5.0'
9
- - 'RAILS_VERSION=5.1'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 1.4.0
2
+ - Update redis to 4+
3
+ - Update rspec
4
+ - Update fakeredis
5
+
1
6
  # 1.3.2
2
7
  - Rails 5 support
3
8
 
data/Gemfile CHANGED
@@ -1,6 +1,2 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in scripterator.gemspec
4
- gemspec
5
-
6
- gem 'activerecord', ENV['RAILS_VERSION'] || '~> 3.2'
1
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile-rails-5.0.x', __FILE__)
2
+ Bundler.load
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '< 5.0'
6
+ gem 'sqlite3', '~> 1.3.0'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '< 5.1'
6
+ gem 'sqlite3', '~> 1.3.0'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '< 5.2'
6
+ gem 'sqlite3', '~> 1.4.0'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'activerecord', '< 6.0'
6
+ gem 'sqlite3', '~> 1.4.0'
@@ -1,3 +1,3 @@
1
1
  module Scripterator
2
- VERSION = '1.3.2'
2
+ VERSION = '1.4.0.beta1'
3
3
  end
data/scripterator.gemspec CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Scripterator::VERSION
17
17
 
18
18
  gem.add_dependency 'activerecord', '< 6'
19
- gem.add_dependency 'redis', '~> 3.0'
19
+ gem.add_dependency 'redis', '~> 4.0'
20
20
 
21
- gem.add_development_dependency 'fakeredis', '~> 0.4'
22
- gem.add_development_dependency 'rspec', '~> 2.13'
23
- gem.add_development_dependency 'sqlite3', '~> 1.3.8'
21
+ gem.add_development_dependency 'fakeredis', '~> 0.8.0'
22
+ gem.add_development_dependency 'rspec', '~> 3.0'
23
+ gem.add_development_dependency 'sqlite3'
24
24
  end
data/spec/runner_spec.rb CHANGED
@@ -18,12 +18,12 @@ describe Scripterator::Runner do
18
18
 
19
19
  shared_examples_for 'raises an error' do
20
20
  specify do
21
- expect { subject }.to raise_error
21
+ expect { subject }.to raise_error(StandardError)
22
22
  end
23
23
  end
24
24
 
25
25
  it 'infers the model from the for_each block' do
26
- runner.send(:model_finder).should == Widget
26
+ expect(runner.send(:model_finder)).to eq Widget
27
27
  end
28
28
 
29
29
  context 'when a model block is defined' do
@@ -39,8 +39,8 @@ describe Scripterator::Runner do
39
39
  let!(:widget2) { Widget.create(name: 'bla') }
40
40
 
41
41
  it 'uses the given model finder code' do
42
- Widget.should_receive(:transform_a_widget).once.with(widget2)
43
- Widget.should_not_receive(:transform_a_widget).with(widget1)
42
+ expect(Widget).to receive(:transform_a_widget).once.with(widget2)
43
+ expect(Widget).not_to receive(:transform_a_widget).with(widget1)
44
44
  subject
45
45
  end
46
46
  end
@@ -59,8 +59,8 @@ describe Scripterator::Runner do
59
59
 
60
60
  it 'transforms each widget in the list' do
61
61
  options[:id_list].each do |id|
62
- runner.should_receive(:transform_one_record) do |arg1|
63
- arg1.id.should == id
62
+ expect(runner).to receive(:transform_one_record) do |arg1|
63
+ expect(arg1.id).to eq id
64
64
  end
65
65
  end
66
66
  subject
@@ -78,14 +78,14 @@ describe Scripterator::Runner do
78
78
  it_behaves_like 'raises an error'
79
79
 
80
80
  it 'does not run any other given blocks' do
81
- Widget.should_not_receive :before_stuff
81
+ expect(Widget).to_not receive(:before_stuff)
82
82
  subject rescue nil
83
83
  end
84
84
  end
85
85
 
86
86
  context 'when there are no records for the specified model' do
87
87
  it 'does not run the per-record block' do
88
- Widget.should_not_receive :transform_a_widget
88
+ expect(Widget).to_not receive(:transform_a_widget)
89
89
  subject
90
90
  end
91
91
  end
@@ -96,9 +96,9 @@ describe Scripterator::Runner do
96
96
  before { num_widgets.times { Widget.create! } }
97
97
 
98
98
  it 'runs the given script blocks' do
99
- Widget.should_receive :before_stuff
100
- Widget.should_receive(:transform_a_widget).exactly(num_widgets).times
101
- Widget.should_receive :after_batch_stuff
99
+ expect(Widget).to receive(:before_stuff)
100
+ expect(Widget).to receive(:transform_a_widget).exactly(num_widgets).times
101
+ expect(Widget).to receive(:after_batch_stuff)
102
102
  subject
103
103
  end
104
104
 
@@ -107,10 +107,10 @@ describe Scripterator::Runner do
107
107
 
108
108
  it 'marks only the checked IDs as checked' do
109
109
  subject
110
- Scripterator.already_run_for?(description, Widget.first.id).should be_false
111
- Scripterator.checked_ids(description).should_not include Widget.first.id
112
- Scripterator.already_run_for?(description, Widget.last.id).should be_true
113
- Scripterator.checked_ids(description).should include Widget.last.id
110
+ expect(Scripterator.already_run_for?(description, Widget.first.id)).to be_falsey
111
+ expect(Scripterator.checked_ids(description)).to_not include Widget.first.id
112
+ expect(Scripterator.already_run_for?(description, Widget.last.id)).to be_truthy
113
+ expect(Scripterator.checked_ids(description)).to include Widget.last.id
114
114
  end
115
115
  end
116
116
 
@@ -118,20 +118,20 @@ describe Scripterator::Runner do
118
118
  let(:checked_ids) { [Widget.first.id] }
119
119
 
120
120
  before do
121
- Scripterator.stub(checked_ids: checked_ids)
122
- Scripterator::ScriptRedis.any_instance.stub(already_run_for?: false)
123
- Scripterator::ScriptRedis.any_instance.stub(:already_run_for?).with(Widget.first.id).and_return(true)
121
+ allow(Scripterator).to receive(:checked_ids).and_return(checked_ids)
122
+ allow_any_instance_of(Scripterator::ScriptRedis).to receive(:already_run_for?).and_return(false)
123
+ allow_any_instance_of(Scripterator::ScriptRedis).to receive(:already_run_for?).with(Widget.first.id).and_return(true)
124
124
  end
125
125
 
126
126
  it 'only runs the per-record code for unchecked records' do
127
- Widget.should_receive(:transform_a_widget).exactly(num_widgets - 1).times
127
+ expect(Widget).to receive(:transform_a_widget).exactly(num_widgets - 1).times
128
128
  subject
129
129
  end
130
130
  end
131
131
 
132
132
  context 'when the code for some records fails' do
133
133
  before do
134
- Widget.stub :transform_a_widget do |widget|
134
+ allow(Widget).to receive(:transform_a_widget) do |widget|
135
135
  raise 'Last widget expl0de' if widget.id == Widget.last.id
136
136
  true
137
137
  end
@@ -139,8 +139,8 @@ describe Scripterator::Runner do
139
139
 
140
140
  it 'marks only the failed IDs as failed' do
141
141
  subject
142
- Scripterator.failed_ids(description).should_not include Widget.first.id
143
- Scripterator.failed_ids(description).should include Widget.last.id
142
+ expect(Scripterator.failed_ids(description)).to_not include Widget.first.id
143
+ expect(Scripterator.failed_ids(description)).to include Widget.last.id
144
144
  end
145
145
  end
146
146
 
@@ -150,7 +150,7 @@ describe Scripterator::Runner do
150
150
 
151
151
  it 'runs without Redis' do
152
152
  expect { subject }.not_to raise_error
153
- Scripterator.checked_ids(description).should be_empty
153
+ expect(Scripterator.checked_ids(description)).to be_empty
154
154
  end
155
155
  end
156
156
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scripterator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ted Dumitrescu
8
8
  - Carl Furrow
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-23 00:00:00.000000000 Z
12
+ date: 2021-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -31,56 +31,56 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '3.0'
34
+ version: '4.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '3.0'
41
+ version: '4.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: fakeredis
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0.4'
48
+ version: 0.8.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0.4'
55
+ version: 0.8.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rspec
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '2.13'
62
+ version: '3.0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '2.13'
69
+ version: '3.0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: sqlite3
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 1.3.8
76
+ version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 1.3.8
83
+ version: '0'
84
84
  description: Script iterator for ActiveRecord models
85
85
  email:
86
86
  - ted@lumoslabs.com
@@ -94,6 +94,10 @@ files:
94
94
  - ".travis.yml"
95
95
  - CHANGELOG.md
96
96
  - Gemfile
97
+ - Gemfile-rails-4.2.x
98
+ - Gemfile-rails-5.0.x
99
+ - Gemfile-rails-5.1.x
100
+ - Gemfile-rails-5.2.x
97
101
  - LICENSE
98
102
  - README.md
99
103
  - lib/scripterator.rb
@@ -108,7 +112,7 @@ files:
108
112
  homepage: http://lumosity.com
109
113
  licenses: []
110
114
  metadata: {}
111
- post_install_message:
115
+ post_install_message:
112
116
  rdoc_options: []
113
117
  require_paths:
114
118
  - lib
@@ -119,13 +123,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
123
  version: '0'
120
124
  required_rubygems_version: !ruby/object:Gem::Requirement
121
125
  requirements:
122
- - - ">="
126
+ - - ">"
123
127
  - !ruby/object:Gem::Version
124
- version: '0'
128
+ version: 1.3.1
125
129
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.7.6
128
- signing_key:
130
+ rubygems_version: 3.1.2
131
+ signing_key:
129
132
  specification_version: 4
130
133
  summary: DSL for running operations on each of a set of models
131
134
  test_files: