Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions spec/generate_empty_ruby_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
expect(result["spec/spec_helper.rb"]).to include('require_relative "../boot/finish"')
end

it "uses the current foobara version as the minimum dependency" do
expect(outcome).to be_success

current_version = Gem.loaded_specs["foobara"].version.to_s
gemspec_path = result.keys.find { |path| path.end_with?(".gemspec") }

expect(result.fetch(gemspec_path)).to include(">= #{current_version}")
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still a bit skeptical about this test but mostly harmless I think so I'll merge it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could submit another PR to improve it. Though I'm curious what the improvement could be. maybe an idea i have is that the test is currently testing for just this part ">= #{current_foobara_version}". Maybe it could be improved to test this entire line ">= #{current_foobara_version}", "<2.0.0". Though i wonder if that would make the test a bit more rigid because what it we go past the 2.0.0 version in the future?


it "uses the generated project library path in the README" do
expect(outcome).to be_success

Expand Down
4 changes: 4 additions & 0 deletions src/generators/gemspec_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def template_path
def target_path
"#{kebab_case_full_project_name}.gemspec"
end

def current_foobara_version
Gem.loaded_specs["foobara"].version
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion templates/gemspec.gemspec.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
"CHANGELOG.md"
]

spec.add_dependency "foobara", ">= 0.0.136", "< 2.0.0"
spec.add_dependency "foobara", ">= <%= current_foobara_version %>", "< 2.0.0"

spec.require_paths = ["lib"]
spec.metadata["rubygems_mfa_required"] = "true"
Expand Down
Loading