Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Tagging testing question #2388

Closed
gregory-m opened this Issue · 4 comments

2 participants

@gregory-m

Hi, I like to add option to sign git release tags with gpg. It's simple you just need add -s key to git tag command.

I want to Implement it this way: if you have gpg installed and have private key for email, used in git in you keyring, sign tag with gpg, if not don't sign. This is also easy to implement.

But I don't see any spec for git tags here: https://github.com/carlhuda/bundler/blob/master/spec/bundler/gem_helper_spec.rb#L156

The question is how I test it? Should I mock system call with something like this:

Kernel.should_receive(:system).with('git tag -s ......')

Or I should write integration test e.g. run actually programs? In this case how it should be tested if gpg not available on developer machine or on CI server? And how case then gpg not available should be tested on box with gpg installed?

Thanks.

@indirect
Owner

I'm not really sure... we can probably install gpg on the CI server if we need to. You can use RSpec's tags to tag the tests and exclude them if gpg isn't present.

Maybe you can write your own code to do it for now, and send a pull request once it satisfies the requirements you listed?

@gregory-m

Sure I will write code.

I understand correctly, what I should test it using integration tests?

@indirect
Owner

If you can figure out how to test it using an integration test, that would be awesome. It also needs to be enabled by a setting, rather than enabled automatically, to stick to SemVer. Probably something like:

it "should sign tags if configured" do
  bundle "config gem_helper.sign_tags true"
  @helper.release_gem
  expect(`git tag -n v1.0.0`).to include("signed gem")
end
@gregory-m

Ok. Thank you.

@gregory-m gregory-m closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.