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

dry_scaffold not working (Can't convert nil to String) #17

Open
Merovex opened this issue Jan 5, 2010 · 6 comments
Open

dry_scaffold not working (Can't convert nil to String) #17

Merovex opened this issue Jan 5, 2010 · 6 comments
Labels

Comments

@Merovex
Copy link

Merovex commented Jan 5, 2010

The command I'm running is the line below. The line immediately following is the only response I get from the attempt. This is on an established project that has no other (apparent) issues.

generate dry_scaffold User name:string email:string
can't convert nil into String

I'm running Rails 2.3.5.

@grimen
Copy link
Owner

grimen commented Jan 20, 2010

Too little info I'm afraid.

@Merovex
Copy link
Author

Merovex commented Jan 21, 2010

That's nice. How about you tell me what you need?

@Merovex
Copy link
Author

Merovex commented Jan 23, 2010

Okay, so instead of having the rather expected --trace, there's a --backtrace.

It appears there's a :test_unit default that does not actually set anything; which leads me to assume you have a default in your environment that I don't have in mine (Ubuntu 10.9)

Here's the offending line (inside the 'skip tests' option block):
controller_tests_path = File.join(TEST_PATHS[test_framework], FUNCTIONAL_TESTS_PATH[test_framework])

Specifically, "FUNCTIONAL_TESTS_PATH[test_framework]" is nil.

FUNCTIONAL_TESTS_PATH has the following values:

{:shoulda=>"functional", :rspec=>"controllers", :test=>"functional"}

test_framework had the following value
:test_unit

This is because:

./lib/dry_generator.rb:68:  DEFAULT_TEST_FRAMEWORK =      :test_unit
./lib/dry_generator.rb:92:    @test_framework = options[:test_framework] ||  DEFAULT_TEST_FRAMEWORK

And doing a grep on your entire library for :test_unit I find:

./lib/dry_generator.rb:51:      :test_unit        => CONFIG_OPTIONS['test_unit']    || CONFIG_OPTIONS['tunit'] || true,
./lib/dry_generator.rb:57:      :test_unit        => 'test',
./lib/dry_generator.rb:63:      :test_unit        => 'test',
./lib/dry_generator.rb:68:  DEFAULT_TEST_FRAMEWORK =      :test_unit
./lib/dry_generator.rb:122:        options[:test_unit] = v
./lib/dry_generator.rb:123:        options[:test_framework] = :test_unit

All caused by this:

[bwilson@bwilson-laptop]~/RailsProjects/collaborate$ generate dry_scaffold fred test:string --backtrace
can't convert nil into String
/usr/lib/ruby/gems/1.8/gems/akitaonrails-dry_scaffold-0.3.3/generators/dry_scaffold/dry_scaffold_generator.rb:145:in join' /usr/lib/ruby/gems/1.8/gems/akitaonrails-dry_scaffold-0.3.3/generators /dry_scaffold/dry_scaffold_generator.rb:145:inmanifest'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails_generator/base.rb:163:in record' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails_generator/manifest.rb:21:ininitialize'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails_generator/base.rb:163:in new' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails_generator/base.rb:163:inrecord'
/usr/lib/ruby/gems/1.8/gems/akitaonrails-dry_scaffold-0.3.3/generators/dry_scaffold/dry_scaffold_generator.rb:132:in manifest' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails_generator/commands.rb:42:ininvoke!'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails_generator/scripts/../scripts.rb:31:in run' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:6 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
./script//generate:3

So, is that enough for you?

@Merovex
Copy link
Author

Merovex commented Jan 23, 2010

When I add the --rspec to the command, it works fine. However, the examples you provide suggest explicitly calling out a test framework is optional; with the default being the broken test_unit.

Also, I tried setting the test framework in the scaffold.yml; with no love.

@grimen
Copy link
Owner

grimen commented Jan 23, 2010

Good info and ellaboration, thanks. Yea that's not good. I noticed I broke something while fixing something other, and so far had no spare-time to look at it. These issue reportings is bulking up though, so something must happen soon. If you got time it would be great if you could come up with a fast patch that I can pull in - otherwise this will have to wait until I'm done with my current achievements (current project with a upcoming deadline - and related open-source work). Sorry for being a bad maintainer lately. =|

@Merovex
Copy link
Author

Merovex commented Jan 25, 2010

Sorry, I don't use Git; so it would take me longer to figure out how to use it than for you to set FUNCTIONAL_TESTS_PATH[:test_unit] when you set the other values. I mean, it is a constant, its a default setting, and it isn't set.

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

2 participants