Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failed during Debian packaging #33

Closed
balasankarc opened this issue Nov 22, 2014 · 3 comments · Fixed by #49
Closed

Tests failed during Debian packaging #33

balasankarc opened this issue Nov 22, 2014 · 3 comments · Fixed by #49

Comments

@balasankarc
Copy link

Hi,
I am packaging generator_spec for debian and have hit a problem. As a part of packaging, the tests are automatically run. But, I got one failure while running the tests

Failures:

  1. GeneratorSpec::Matcher::File#matches? with no contains throws :failure if it doesnt exist
    Failure/Error: expect {
    expected :failure to be thrown, got nothing

    ./spec/generator_spec/matcher_spec.rb:71:in `block (4 levels) in module:Matcher'

Finished in 0.11725 seconds
31 examples, 1 failure

As I am a novice in Ruby programming, I don't know what to do. Can you help me fix this?

@simi
Copy link
Contributor

simi commented Nov 25, 2014

Hello @balasankarc.

Can you add some steps how to reproduce this?

Can you confirm this for latest git master revision also?

@simi
Copy link
Contributor

simi commented Dec 28, 2014

@balasankarc any news on this?

@prahal
Copy link
Contributor

prahal commented Apr 14, 2022

I can reproduce it with the Debian gem2deb tool.

gem2deb generator_spec

gem2deb extract the gem. Running rake spec from inside the gem sources I can also reproduce.
Nowadays I get 6 errors.

rspec ./spec/generator_spec/matcher_spec.rb:83 # GeneratorSpec::Matcher::File#matches? with no contains throws :failure if it doesnt exist
rspec ./spec/generator_spec/matcher_spec.rb:129 # GeneratorSpec::Matcher::Migration#matches? with no contains throws :failure if it doesnt exist
rspec ./spec/generator_spec/matcher_spec.rb:226 # GeneratorSpec::Matcher::Directory#matches? with a directory name throws :failure if it doesnt exist
rspec ./spec/generator_spec/matcher_spec.rb:254 # GeneratorSpec::Matcher::Directory#matches? with a directory object throws :failure if it doesnt exist
rspec ./spec/generator_spec/matcher_spec.rb:272 # GeneratorSpec::Matcher::Directory#matches? #no_file doesnt throw if the file exist
rspec ./spec/generator_spec/matcher_spec.rb:306 # GeneratorSpec::Matcher::Root#matches? returns false on failures

From a debug session ./spec/generator_spec/matcher_spec.rb uses as testdir TMP_ROO, ie Dir.tmpdir which here ends up as /tmp.
Obviously the before(:each) examples fail to delete this directory as it misses the permissions (luckily).
I believe the tests fail here as I do not run them as root (ie /tmp is not deleted before each test).

A short test case is in an irb session:

require 'tmpdir'
puts Dir.tmpdir

here it outputs /tmp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants