subelsky_power_tools 1.2.7 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rspec +0 -2
- data/.ruby-version +1 -0
- data/Gemfile +2 -7
- data/Rakefile +1 -1
- data/lib/subelsky_power_tools/sidekiq_assertions.rb +6 -3
- data/lib/subelsky_power_tools/version.rb +1 -1
- data/spec/lib/environment_spec.rb +4 -4
- data/spec/lib/ext/active_record_spec.rb +1 -1
- data/spec/lib/ext/exception_spec.rb +1 -1
- data/spec/lib/ext/hash_spec.rb +8 -8
- data/spec/lib/ext/kernel_spec.rb +3 -3
- data/spec/spec_helper.rb +5 -28
- data/subelsky_power_tools.gemspec +2 -2
- metadata +15 -20
- data/.rvmrc +0 -1
- data/Gemfile.lock +0 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 351af5ba832e2d4afca0cb5e19ad2649b6c178c4
|
4
|
+
data.tar.gz: 9553f91211a77544e09c3b34e5e83903e6af63ad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 218492f3ec1d1170d19afea5253584c48e4ca54e1567fd9c18e12f7024edfd677b5ccf57bfc52426281dd934ae7f57f3ff9fa726c7cbe010f9e678aed3d5d435
|
7
|
+
data.tar.gz: d1d4cde0238f66e3f36a9a5b4ecd8864a99cdcf734c697231984446bc7fdc393f71d3fdd98d5d611b14bd9581cd7a7f74d7842a212dd635b945b177f186b5245
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -17,5 +17,5 @@ task :release do
|
|
17
17
|
`git tag '#{SubelskyPowerTools::VERSION}'`
|
18
18
|
`git push origin '#{SubelskyPowerTools::VERSION}'`
|
19
19
|
`gem build subelsky_power_tools.gemspec`
|
20
|
-
`gem push subelsky_power_tools-#{SubelskyPowerTools::VERSION}`
|
20
|
+
`gem push subelsky_power_tools-#{SubelskyPowerTools::VERSION}.gem`
|
21
21
|
end
|
@@ -1,13 +1,16 @@
|
|
1
|
+
# MyWorker.should have_queued_job(2)
|
2
|
+
# Collector.should have_queued_job_at(Time.new(2012,1,23,14,00),2)
|
3
|
+
|
1
4
|
RSpec::Matchers.define :have_queued_job do |*expected|
|
2
5
|
match do |actual|
|
3
|
-
actual.jobs.any? { |job| job["args"]
|
6
|
+
actual.jobs.any? { |job| Array(expected) == job["args"] }
|
4
7
|
end
|
5
8
|
|
6
|
-
|
9
|
+
failure_message do |actual|
|
7
10
|
"expected that #{actual} would have a job queued with #{expected}"
|
8
11
|
end
|
9
12
|
|
10
|
-
|
13
|
+
failure_message_when_negated do |actual|
|
11
14
|
"expected that #{actual} would not a have a job queued with #{expected}"
|
12
15
|
end
|
13
16
|
|
@@ -27,8 +27,8 @@ describe SubelskyPowerTools::Environment do
|
|
27
27
|
|
28
28
|
it "returns the value of the extracted variables" do
|
29
29
|
val1, val2 = conduct_test("alpha","beta")
|
30
|
-
val1.
|
31
|
-
val2.
|
30
|
+
expect(val1).to eq("alpha")
|
31
|
+
expect(val2).to eq("beta")
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -53,8 +53,8 @@ describe SubelskyPowerTools::Environment do
|
|
53
53
|
|
54
54
|
it "returns the value of the extracted variables" do
|
55
55
|
val1, val2 = conduct_test(nil,"beta")
|
56
|
-
val1.
|
57
|
-
val2.
|
56
|
+
expect(val1).to eq(nil)
|
57
|
+
expect(val2).to eq("beta")
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
data/spec/lib/ext/hash_spec.rb
CHANGED
@@ -8,23 +8,23 @@ describe Hash do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should except given keys" do
|
11
|
-
h.except(:a).
|
12
|
-
h.except(:a,:c).
|
11
|
+
expect(h.except(:a)).to eq({ :b => 2, :c => 3 })
|
12
|
+
expect(h.except(:a,:c)).to eq({ :b => 2 })
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should perform destructive exceptions" do
|
16
|
-
h.except!(:c).
|
17
|
-
h.
|
16
|
+
expect(h.except!(:c)).to eq({ :c => 3 })
|
17
|
+
expect(h).to eq({ :a => 1, :b => 2 })
|
18
18
|
h.except!(:a,:b)
|
19
|
-
h.
|
19
|
+
expect(h).to be_empty
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should include given keys only" do
|
23
|
-
h.only(:a,:b).
|
23
|
+
expect(h.only(:a,:b)).to eq({ :a => 1, :b => 2 })
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should perform destructive inclusion" do
|
27
|
-
h.only!(:c).
|
28
|
-
h.
|
27
|
+
expect(h.only!(:c)).to eq({ :a => 1, :b => 2})
|
28
|
+
expect(h).to eq({ :c => 3 })
|
29
29
|
end
|
30
30
|
end
|
data/spec/lib/ext/kernel_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe "Kernel#retryable" do
|
|
13
13
|
rescue ArgumentError
|
14
14
|
end
|
15
15
|
|
16
|
-
count.
|
16
|
+
expect(count).to eq(3)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "reraises exceptions after exhausting all tries" do
|
@@ -24,7 +24,7 @@ describe "Kernel#retryable" do
|
|
24
24
|
|
25
25
|
it "waits specified number of seconds between tries" do
|
26
26
|
# this seems like a better way to measure sleep than using the clock
|
27
|
-
Kernel.
|
27
|
+
expect(Kernel).to receive(:sleep).with(0.2).exactly(2).times
|
28
28
|
|
29
29
|
begin
|
30
30
|
retryable(tries: 3,sleep: 0.2) { raise ArgumentError }
|
@@ -44,7 +44,7 @@ describe "Kernel#retryable" do
|
|
44
44
|
49
|
45
45
|
end
|
46
46
|
|
47
|
-
result.
|
47
|
+
expect(result).to eq(49)
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,32 +1,9 @@
|
|
1
|
-
require "spork"
|
2
1
|
$:.unshift(File.join(File.dirname(__FILE__),"..","lib"))
|
2
|
+
require "bundler/setup"
|
3
|
+
require "rspec"
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
RSpec.configure do |config|
|
8
|
-
config.mock_with :rspec
|
9
|
-
|
10
|
-
last_gc_run = Time.now
|
11
|
-
|
12
|
-
config.before(:each) do
|
13
|
-
GC.disable
|
14
|
-
end
|
15
|
-
|
16
|
-
config.after(:each) do
|
17
|
-
if Time.now - last_gc_run > 1.0
|
18
|
-
GC.enable
|
19
|
-
GC.start
|
20
|
-
last_gc_run = Time.now
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.mock_with :rspec do |c|
|
7
|
+
c.syntax = :expect
|
24
8
|
end
|
25
|
-
|
26
|
-
require 'rspec/expectations'
|
27
|
-
require 'rspec/core/expecting/with_rspec'
|
28
|
-
end
|
29
|
-
|
30
|
-
Spork.each_run do
|
31
|
-
#load "subelsky_power_tools/ext/kernel.rb"
|
32
9
|
end
|
@@ -14,10 +14,10 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.summary = %q{This is a collection of Ruby extensions and utilities I've been carting around from project to project.}
|
16
16
|
s.description = <<-DESC
|
17
|
-
This is a collection of Ruby extensions and utilities I've been carting around from project to project.
|
17
|
+
This is a collection of Ruby extensions and utilities I've been carting around from project to project.
|
18
18
|
Many are taken from the Facets project (I just don't want to include that whole gem in my codebases).
|
19
19
|
DESC
|
20
20
|
s.test_files = `git ls-files spec`.split("\n")
|
21
|
-
s.add_development_dependency 'rspec'
|
21
|
+
s.add_development_dependency 'rspec', "~> 3.0"
|
22
22
|
s.license = "MIT"
|
23
23
|
end
|
metadata
CHANGED
@@ -1,35 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subelsky_power_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mike Subelsky
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
19
|
+
version: '3.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
description:
|
31
|
-
|
32
|
-
don't want to include that whole gem in my codebases)
|
26
|
+
version: '3.0'
|
27
|
+
description: |
|
28
|
+
This is a collection of Ruby extensions and utilities I've been carting around from project to project.
|
29
|
+
Many are taken from the Facets project (I just don't want to include that whole gem in my codebases).
|
33
30
|
email: mike@subelsky.com
|
34
31
|
executables: []
|
35
32
|
extensions: []
|
@@ -38,10 +35,9 @@ extra_rdoc_files:
|
|
38
35
|
files:
|
39
36
|
- .gitignore
|
40
37
|
- .rspec
|
41
|
-
- .
|
38
|
+
- .ruby-version
|
42
39
|
- CHANGELOG
|
43
40
|
- Gemfile
|
44
|
-
- Gemfile.lock
|
45
41
|
- Guardfile
|
46
42
|
- MIT-LICENSE
|
47
43
|
- README.md
|
@@ -66,28 +62,27 @@ files:
|
|
66
62
|
homepage: http://github.com/subelsky/subelsky_power_tools
|
67
63
|
licenses:
|
68
64
|
- MIT
|
65
|
+
metadata: {}
|
69
66
|
post_install_message:
|
70
67
|
rdoc_options:
|
71
68
|
- --charset=UTF-8
|
72
69
|
require_paths:
|
73
70
|
- lib
|
74
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
72
|
requirements:
|
77
|
-
- -
|
73
|
+
- - '>='
|
78
74
|
- !ruby/object:Gem::Version
|
79
75
|
version: '0'
|
80
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
77
|
requirements:
|
83
|
-
- -
|
78
|
+
- - '>='
|
84
79
|
- !ruby/object:Gem::Version
|
85
80
|
version: '0'
|
86
81
|
requirements: []
|
87
82
|
rubyforge_project:
|
88
|
-
rubygems_version:
|
83
|
+
rubygems_version: 2.2.2
|
89
84
|
signing_key:
|
90
|
-
specification_version:
|
85
|
+
specification_version: 4
|
91
86
|
summary: This is a collection of Ruby extensions and utilities I've been carting around
|
92
87
|
from project to project.
|
93
88
|
test_files:
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.2-p180-patched --create
|
data/Gemfile.lock
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
subelsky_power_tools (1.2.7)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: http://rubygems.org/
|
8
|
-
specs:
|
9
|
-
diff-lcs (1.1.2)
|
10
|
-
growl (1.0.3)
|
11
|
-
guard (0.4.2)
|
12
|
-
thor (~> 0.14.6)
|
13
|
-
guard-rspec (0.4.0)
|
14
|
-
guard (>= 0.4.0)
|
15
|
-
guard-spork (0.2.0)
|
16
|
-
guard (>= 0.2.2)
|
17
|
-
spork (>= 0.8.4)
|
18
|
-
rspec (2.6.0)
|
19
|
-
rspec-core (~> 2.6.0)
|
20
|
-
rspec-expectations (~> 2.6.0)
|
21
|
-
rspec-mocks (~> 2.6.0)
|
22
|
-
rspec-core (2.6.4)
|
23
|
-
rspec-expectations (2.6.0)
|
24
|
-
diff-lcs (~> 1.1.2)
|
25
|
-
rspec-mocks (2.6.0)
|
26
|
-
spork (0.8.5)
|
27
|
-
thor (0.14.6)
|
28
|
-
|
29
|
-
PLATFORMS
|
30
|
-
ruby
|
31
|
-
|
32
|
-
DEPENDENCIES
|
33
|
-
growl
|
34
|
-
guard-rspec
|
35
|
-
guard-spork
|
36
|
-
rspec
|
37
|
-
subelsky_power_tools!
|