Commit 32b5bce7 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

RSpec: request and store HGitaly version on configuration object

With this, the HGitaly version will be accessible as
`RSpec.configuration.hgitaly_version`, and mostly used
for conditional skipping, making hooking in Rails and
landing in HGitaly less interdependent, provided new
features in HGitaly come with an appropriate version
change (doesn't have to be pushed to PyPI because the
CI always run HGitaly from the head of the `default` or
`stable` branch).

The simplest syntax to skip RSpec tests is

```ruby

  if 'does something', skip: boolean_method

```

but `boolean_method` would have to be a class method, and
would turn out to be executed before `TestEnv`, hence before
HGitaly is started. Therefore the `skip` method will have to
be run from examples (and `before` hooks). The new
`RSpec.configuration` method is a good way to access the version
information. It's not lazy, but it's expected to be negligible
compared to the huge startup time.

--HG--
branch : heptapod
parent d1704dedec2a
......@@ -198,6 +198,11 @@
# Enable all features by default for testing
# Reset any changes in after hook.
stub_all_feature_flags
hg_storage = Gitlab::GitalyClient.vcs_qualified_storage('default', 'hg')
config.add_setting(:hgitaly_version)
config.hgitaly_version = Gem::Version.new(
Gitaly::Server.new(hg_storage).server_version)
end
config.after(:all) do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment