[rspec-users] does the rspec_scaffold generator know about :references ?

David Chelimsky dchelimsky at gmail.com
Wed Feb 20 07:28:23 EST 2008


On Feb 20, 2008 12:35 AM, Peter Recore <lists at ruby-forum.com> wrote:
> I checked out the CURRENT release of rspec and rails_spec as outlined on
> the rubyforge page.  I am having trouble with models that use the
> :references column type.   I get tests with syntax errors after
> generating a new class from scratch using ruby script/generate
> rspec_scaffold.  The problem seems to be that no default values are
> generated for these types in the templates used by the generator.  I
> feel that there is a 2/3 chance I am wrong here, and 1/3 that rspec just
> doesn't handle this part of rails 2 yet.
>
> 1.  I am supposed to edit the spec scaffolding for all models with
> associations.
> 2.  I am doing something else wrong.
> 3.  Rspec just doesn't support :references yet, and I should maybe
> figure out how and write a patch, assuming I continue to use rspec and
> fall in love with it like everyone seems to have.

#3 - patch away: http://rspec.lighthouseapp.com.

Cheers,
David

>
> Can anyone tell me which of the above is correct, if any?
>
> Thanks!  (PS:  spec_server is going to save my sanity on my ever so cute
> but ever so slow ultraportable)
>
>
>
> Here is the line i use to generate the class:
>
> ruby script/generate rspec_scaffold MyBar foo:references
>
> Here is the specific syntax error. You can see where the value should be
> is blank.
>
> C:/instantrails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
> `load': C:/instantrails/rails_apps/silver/spec/vi
> ews/my_bars/index.html.erb_spec.rb:17: syntax error, unexpected ','
> (SyntaxError)
>     response.should have_tag("tr>td", , 2)
>                                        ^         from
> C:/instantrails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489
> :in `load'
>         from
> C:/instantrails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
> `new_constants_in'
>         from
> C:/instantrails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
> `load'
>         from
> C:/instantrails/rails_apps/silver/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:14:in
> `load_files'
>         from
> C:/instantrails/rails_apps/silver/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:13:in
> `each'
>         from
> C:/instantrails/rails_apps/silver/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:13:in
> `load_files'
>         from
> C:/instantrails/rails_apps/silver/vendor/plugins/rspec/lib/spec/runner/options.rb:85:in
> `run_examples'
>         from
> C:/instantrails/rails_apps/silver/vendor/plugins/rspec/lib/spec/runner/command_line.rb:19:in
> `run'
>         from script/spec:4
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list