Skip to content

Commit 6e98bd2

Browse files
flash-gordonmcmire
authored andcommitted
Remove activerecord from runtime dependencies (fixes #58)
This removes activerecord from runtime dependencies and runs tests in an AR-free environment to make sure activesupport doesn't interfere with the gem (I removed one `.blank?` usage along the way). Side note: ruby 2.7 changed the meaning of `.object_id`, it's not related to memory address anymore. Since I locally tested on 2.7, I added a hacky helper to get an object address on the newest ruby version.
1 parent 8c664d9 commit 6e98bd2

18 files changed

+178
-27
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ gemfile:
1111
- gemfiles/rails_5_1.gemfile
1212
- gemfiles/rails_5_2.gemfile
1313
- gemfiles/rails_6_0.gemfile
14+
- gemfiles/no_rails.gemfile
1415
matrix:
1516
exclude:
1617
- rvm: ruby-2.4.6

Appraisals

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ appraise "rails_5_2" do
2424
gem "sqlite3", "~> 1.3.6", platform: [:ruby, :mswin, :mingw]
2525
end
2626

27+
appraise "no_rails" do
28+
end
29+
2730
if Gem::Requirement.new(">= 2.5.0").satisfied_by?(Gem::Version.new(RUBY_VERSION))
2831
appraise "rails_6_0" do
2932
instance_eval(&common_dependencies)

gemfiles/no_rails.gemfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "appraisal"
6+
gem "childprocess"
7+
gem "pry-byebug", platform: :mri
8+
gem "pry-nav", platform: :jruby
9+
gem "rake"
10+
gem "rspec-core", git: "https://github.com/rspec/rspec-core"
11+
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations"
12+
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks"
13+
gem "rspec-support", git: "https://github.com/rspec/rspec-support"
14+
gem "rubocop"
15+
16+
gemspec path: "../"

gemfiles/no_rails.gemfile.lock

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
GIT
2+
remote: https://github.com/rspec/rspec-core
3+
revision: 1174cc5e58ae72fb8cdc689a785089889bfdb740
4+
specs:
5+
rspec-core (3.10.0.pre)
6+
rspec-support (= 3.10.0.pre)
7+
8+
GIT
9+
remote: https://github.com/rspec/rspec-expectations
10+
revision: c085c5a6f0678ae7f88a489996e391e6b661d8a9
11+
specs:
12+
rspec-expectations (3.10.0.pre)
13+
diff-lcs (>= 1.2.0, < 2.0)
14+
rspec-support (= 3.10.0.pre)
15+
16+
GIT
17+
remote: https://github.com/rspec/rspec-mocks
18+
revision: e6057a61d8a15c4638dec116f68579d83fdd5ad5
19+
specs:
20+
rspec-mocks (3.10.0.pre)
21+
diff-lcs (>= 1.2.0, < 2.0)
22+
rspec-support (= 3.10.0.pre)
23+
24+
GIT
25+
remote: https://github.com/rspec/rspec-support
26+
revision: b83b4cecb3bb56300addae89cb0c437f1af906fb
27+
specs:
28+
rspec-support (3.10.0.pre)
29+
30+
PATH
31+
remote: ..
32+
specs:
33+
super_diff (0.3.0)
34+
attr_extras
35+
diff-lcs
36+
patience_diff
37+
38+
GEM
39+
remote: https://rubygems.org/
40+
specs:
41+
appraisal (2.2.0)
42+
bundler
43+
rake
44+
thor (>= 0.14.0)
45+
ast (2.4.0)
46+
attr_extras (6.2.2)
47+
byebug (11.0.1)
48+
childprocess (3.0.0)
49+
coderay (1.1.2)
50+
diff-lcs (1.3)
51+
jaro_winkler (1.5.4)
52+
method_source (0.9.2)
53+
parallel (1.19.1)
54+
parser (2.7.0.2)
55+
ast (~> 2.4.0)
56+
patience_diff (1.1.0)
57+
trollop (~> 1.16)
58+
pry (0.12.2)
59+
coderay (~> 1.1.0)
60+
method_source (~> 0.9.0)
61+
pry-byebug (3.7.0)
62+
byebug (~> 11.0)
63+
pry (~> 0.10)
64+
rainbow (3.0.0)
65+
rake (13.0.1)
66+
rubocop (0.79.0)
67+
jaro_winkler (~> 1.5.1)
68+
parallel (~> 1.10)
69+
parser (>= 2.7.0.1)
70+
rainbow (>= 2.2.2, < 4.0)
71+
ruby-progressbar (~> 1.7)
72+
unicode-display_width (>= 1.4.0, < 1.7)
73+
ruby-progressbar (1.10.1)
74+
thor (1.0.1)
75+
trollop (1.16.2)
76+
unicode-display_width (1.6.0)
77+
78+
PLATFORMS
79+
ruby
80+
81+
DEPENDENCIES
82+
appraisal
83+
childprocess
84+
pry-byebug
85+
pry-nav
86+
rake
87+
rspec-core!
88+
rspec-expectations!
89+
rspec-mocks!
90+
rspec-support!
91+
rubocop
92+
super_diff!
93+
94+
BUNDLED WITH
95+
2.0.2

gemfiles/rails_5_0.gemfile.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PATH
3131
remote: ..
3232
specs:
3333
super_diff (0.3.0)
34-
activerecord (> 4.2, < 7.0)
3534
attr_extras
3635
diff-lcs
3736
patience_diff

gemfiles/rails_5_1.gemfile.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PATH
3131
remote: ..
3232
specs:
3333
super_diff (0.3.0)
34-
activerecord (> 4.2, < 7.0)
3534
attr_extras
3635
diff-lcs
3736
patience_diff

gemfiles/rails_5_2.gemfile.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PATH
3131
remote: ..
3232
specs:
3333
super_diff (0.3.0)
34-
activerecord (> 4.2, < 7.0)
3534
attr_extras
3635
diff-lcs
3736
patience_diff

gemfiles/rails_6_0.gemfile.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PATH
3131
remote: ..
3232
specs:
3333
super_diff (0.3.0)
34-
activerecord (> 4.2, < 7.0)
3534
attr_extras
3635
diff-lcs
3736
patience_diff

lib/super_diff/equality_matchers/default.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def actual_line
3434
end
3535

3636
def diff_section
37-
if diff.blank?
37+
if diff.empty?
3838
""
3939
else
4040
<<~SECTION

spec/integration/rails/active_record_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "spec_helper"
22

3-
RSpec.describe "Integration with Rails's ActiveRecord class", type: :integration do
3+
RSpec.describe "Integration with Rails's ActiveRecord class", type: :integration, active_record: true do
44
context "when using 'super_diff/rspec-rails'" do
55
include_context "integration with ActiveRecord"
66

0 commit comments

Comments
 (0)