-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
159 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rspec" | ||
|
||
RSpec.describe GemBench::GemfileLineTokenizer do | ||
subject(:instance) { described_class.new(*args) } | ||
|
||
let(:args) { | ||
[ | ||
all_lines, | ||
line, | ||
index, | ||
] | ||
} | ||
let(:all_lines) { %w(hello darkness) } | ||
let(:line) { "hello" } | ||
let(:index) { 0 } | ||
|
||
describe "::new" do | ||
it "succeeds" do | ||
block_is_expected.to not_raise_error | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe GemBench::StrictVersionGem do | ||
subject(:instance) { described_class.new(*args) } | ||
|
||
let(:args) { | ||
[ | ||
name, | ||
version, | ||
version_type, | ||
valid, | ||
relevant_lines, | ||
index, | ||
tokenized_line, | ||
] | ||
} | ||
let(:name) { "oh_hi" } | ||
let(:version) { "5.7.4" } | ||
let(:version_type) { :constraint } | ||
let(:valid) { true } | ||
let(:relevant_lines) { %w(hello darkness) } | ||
let(:index) { 1 } | ||
let(:tokenized_line) { "oh_hi" } | ||
|
||
describe "::new" do | ||
it "succeeds" do | ||
block_is_expected.to not_raise_error | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rspec" | ||
|
||
RSpec.describe GemBench::StrictVersionRequirement do | ||
subject(:instance) { described_class.new(options) } | ||
|
||
let(:options) { {} } | ||
|
||
describe "::new" do | ||
it "succeeds" do | ||
block_is_expected.to not_raise_error | ||
end | ||
end | ||
|
||
describe "#versions_present?" do | ||
subject(:versions_present) { instance.versions_present? } | ||
|
||
it "succeeds" do | ||
block_is_expected.to not_raise_error | ||
end | ||
end | ||
|
||
describe "#list_missing_version_constraints" do | ||
subject(:list_missing_version_constraints) { instance.list_missing_version_constraints } | ||
|
||
it "succeeds" do | ||
block_is_expected.to not_raise_error | ||
end | ||
end | ||
|
||
describe "#find" do | ||
subject(:find) { instance.find(name) } | ||
|
||
let(:name) { "hello" } | ||
|
||
it "succeeds" do | ||
block_is_expected.to not_raise_error | ||
end | ||
|
||
context "when not found" do | ||
it "returns nil" do | ||
expect(find).to be_nil | ||
end | ||
end | ||
end | ||
|
||
describe "#gem_at" do | ||
subject(:gem_at) { instance.gem_at(index) } | ||
|
||
let(:index) { 1 } | ||
|
||
it "succeeds" do | ||
block_is_expected.to not_raise_error | ||
end | ||
|
||
context "when not found" do | ||
it "returns nil" do | ||
expect(gem_at).to be_nil | ||
end | ||
end | ||
end | ||
|
||
describe "#print" do | ||
subject(:print) { instance.print } | ||
|
||
it "succeeds" do | ||
block_is_expected.to not_raise_error | ||
end | ||
|
||
it "has output" do | ||
expect { print }.to output(/The gems that need to be improved are:/).to_stdout | ||
end | ||
end | ||
end |