Skip to content

Commit

Permalink
Merge pull request #31 from teeparham/update
Browse files Browse the repository at this point in the history
Require ruby 3.0+
* Update tested ruby versions
* Update minitest, mocha gems
* Update tests to work with new minitest
  • Loading branch information
teeparham committed Feb 2, 2024
2 parents 1bebc48 + 9555a42 commit f4bcd84
Show file tree
Hide file tree
Showing 7 changed files with 562 additions and 565 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.flaky }}
strategy:
matrix:
ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1", "jruby-9.2", "jruby-9.3", "truffleruby-21" ,"truffleruby-22"]
ruby-version:
["3.0", "3.1", "3.2", "3.3", "jruby-9.4", "truffleruby-23"]
flaky: [false]
include:
- ruby-version: "ruby-head"
Expand All @@ -16,7 +17,7 @@ jobs:
- ruby-version: "truffleruby-head"
flaky: true
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
Expand Down
8 changes: 4 additions & 4 deletions gemdiff.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
spec.name = "gemdiff"
spec.version = Gemdiff::VERSION
spec.authors = ["Tee Parham"]
spec.email = ["tee@neighborland.com"]
spec.email = ["parhameter@gmail.com"]
spec.summary = "Find source repositories for ruby gems. Open, compare, and update outdated gem versions"
spec.description = "Command-line utility to find source repositories for ruby gems, open common GitHub pages, "\
"compare gem versions, and simplify gem update workflow in git."
Expand All @@ -17,13 +17,13 @@ Gem::Specification.new do |spec|
spec.executables = %w[gemdiff]
spec.require_paths = %w[lib]

spec.required_ruby_version = ">= 2.5.0"
spec.required_ruby_version = ">= 3.0.0"

spec.add_dependency "launchy", "~> 2.4"
spec.add_dependency "octokit", "~> 4.0"
spec.add_dependency "thor", "~> 1.0"

spec.add_development_dependency "minitest", "~> 5.4"
spec.add_development_dependency "mocha", "~> 1.1"
spec.add_development_dependency "minitest", "~> 5.21"
spec.add_development_dependency "mocha", "~> 2.0"
spec.add_development_dependency "rake", "~> 13.0"
end
92 changes: 46 additions & 46 deletions test/bundle_inspector_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,61 @@

require "test_helper"

class BundleInspectorTest < MiniTest::Spec
let(:inspector) { Gemdiff::BundleInspector.new }

describe "#list" do
it "returns outdated gems" do
inspector.stubs bundle_outdated_strict: fake_outdated_parseable
inspector.list.tap do |list|
assert_equal 3, list.size
assert_equal "paperclip", list[0].name
assert_equal "4.2.2", list[0].old_version
assert_equal "4.3.0", list[0].new_version
assert_equal "rails", list[1].name
assert_equal "4.2.1", list[1].old_version
assert_equal "4.2.2", list[1].new_version
assert_equal "web-console", list[2].name
assert_equal "2.1.2", list[2].old_version
assert_equal "2.1.3", list[2].new_version
end
end
def inspector
@inspector ||= Gemdiff::BundleInspector.new
end

it "returns empty list when bundle is up to date" do
inspector.stubs bundle_outdated_strict: fake_up_to_date
assert_empty inspector.list
describe "#list" do
it "returns outdated gems" do
inspector.stubs bundle_outdated_strict: fake_outdated_parseable
inspector.list.tap do |list|
assert_equal 3, list.size
assert_equal "paperclip", list[0].name
assert_equal "4.2.2", list[0].old_version
assert_equal "4.3.0", list[0].new_version
assert_equal "rails", list[1].name
assert_equal "4.2.1", list[1].old_version
assert_equal "4.2.2", list[1].new_version
assert_equal "web-console", list[2].name
assert_equal "2.1.2", list[2].old_version
assert_equal "2.1.3", list[2].new_version
end
end

describe "#get" do
it "returns single outdated gem" do
inspector.stubs bundle_outdated_strict: fake_outdated_parseable
inspector.get("rails").tap do |gem|
assert_equal "rails", gem.name
assert_equal "4.2.1", gem.old_version
assert_equal "4.2.2", gem.new_version
end
end
it "returns empty list when bundle is up to date" do
inspector.stubs bundle_outdated_strict: fake_up_to_date
assert_empty inspector.list
end
end

it "returns nil when gem is not outdated" do
inspector.stubs bundle_outdated_strict: fake_up_to_date
assert_nil inspector.get("notfound")
describe "#get" do
it "returns single outdated gem" do
inspector.stubs bundle_outdated_strict: fake_outdated_parseable
inspector.get("rails").tap do |gem|
assert_equal "rails", gem.name
assert_equal "4.2.1", gem.old_version
assert_equal "4.2.2", gem.new_version
end
end

private

def fake_outdated_parseable
<<~OUT
paperclip (newest 4.3.0, installed 4.2.2)
rails (newest 4.2.2, installed 4.2.1, requested ~> 4.2.1)
web-console (newest 2.1.3, installed 2.1.2)
OUT
it "returns nil when gem is not outdated" do
inspector.stubs bundle_outdated_strict: fake_up_to_date
assert_nil inspector.get("notfound")
end
end

def fake_up_to_date
<<~OUT
private

OUT
end
def fake_outdated_parseable
<<~OUT
paperclip (newest 4.3.0, installed 4.2.2)
rails (newest 4.2.2, installed 4.2.1, requested ~> 4.2.1)
web-console (newest 2.1.3, installed 2.1.2)
OUT
end

def fake_up_to_date
<<~OUT
OUT
end
Loading

0 comments on commit f4bcd84

Please sign in to comment.