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

integration tests don't work ootb #58

Open
matti opened this issue Dec 16, 2019 · 2 comments
Open

integration tests don't work ootb #58

matti opened this issue Dec 16, 2019 · 2 comments
Labels

Comments

@matti
Copy link

matti commented Dec 16, 2019

$ teletype new test-cmd
# remove todos from gemspec
$ teletype add config
$ rake
  1) `test-cmd config` command executes `test-cmd help config` command successfully
     Failure/Error: output = `test-cmd help config`

     Errno::ENOENT:
       No such file or directory - test-cmd

"fix" by prefixing runner to use exe/test-cmd :

RSpec.describe "`test-cmd config` command", type: :cli do
  it "executes `test-cmd help config` command successfully" do
    output = `exe/test-cmd help config`
@piotrmurach
Copy link
Owner

Hi Matti,

Thanks for using tty and reporting this.

In my experience, you get this behaviour due to git not tracking the files in newly generated project. Adding exe directory to staged files makes git aware of the folder, meaning, gemspec can locate the executable and your specs should run fine. In near future, I will improve this experience by stoping to rely on git for loading files. Trust me I want to provide a very good experience out of the gate. For now I'm creating a roadmap of how tty v1.0 may look like.

@slowbro
Copy link
Contributor

slowbro commented Sep 23, 2020

For me, even having git added and even committed, I get the same error:

  1) `test-app test` command executes `test-app help test` command successfully
     Failure/Error: output = `test-app help test`
     
     Errno::ENOENT:
       No such file or directory - test-app
     # ./spec/integration/test_spec.rb:3:in ``'
     # ./spec/integration/test_spec.rb:3:in `block (2 levels) in <top (required)>'

To me, it seems like a PATH issue. If I were to install the gem, it would probably work - but that means it could possibly be testing against a different version of my app, and not the code itself.

However, while looking more into this, I realized that I probably missed a step somewhere. When trying to execute the app with bundle exec test-app, I got:

[katelyn@h test-app]$ bundler exec test-app
Traceback (most recent call last):
	2: from /home/katelyn/.rvm/rubies/ruby-2.6.5/bin/bundler:23:in `<main>'
	1: from /home/katelyn/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
/home/katelyn/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': Could not find 'bundler' (1.17.3) required by your /home/katelyn/code/test-app/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.17.3`

Then:

[katelyn@h test-app]$ bundler exec test-app
bundler: command not found: test-app
Install missing gem executables with `bundle install`

Once I did a bundle-install, the integration test passed, since test-app was now found by bundler. As someone who has not used bundler before, I wasn't aware of the pre-requisites so likely that is how I ended up with this. Is there some way to have bundler look around in the base project dir even if bundler install has not been ran, or is that an anti-pattern for bundler?

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

No branches or pull requests

3 participants