Giter VIP home page Giter VIP logo

Comments (11)

apotonick avatar apotonick commented on June 14, 2024

Hey Icowell,

what are you trying to do? Automatically test cells? Great! What doesn't work right now?

Did you already discover Cell::TestCase?

Cheers

from cells.

lcowell avatar lcowell commented on June 14, 2024

Hi, I'm trying to get autotest to automatically run tests against the cell files. I can write tests and run them manually using rake test:cells - however, autotest doesn't appear to know about the cell controllers, views or tests.

I'm running cells 3.3.5 w/ rails 2.3.x.

Thanks!

from cells.

apotonick avatar apotonick commented on June 14, 2024

Can you point me to the canonical repo of autotest? I can't find it! (Sorry!!!).
That sounds like a good idea and I marked it as "feature", so let's work on that!

from cells.

lcowell avatar lcowell commented on June 14, 2024

Hi there, I can't believe it! A widely used project not hosted on github! Haha.

This is the official zentest repo:
http://rubyforge.org/projects/zentest/

from cells.

apotonick avatar apotonick commented on June 14, 2024

Thanks dude, I was browsing that today at work when I was exploring Autotest. It looks kinda outdated, are you sure it's the "official"?

from cells.

lcowell avatar lcowell commented on June 14, 2024

Yeah, I'm pretty sure it's official. I think part of the problem is that everything on rubyforge looks out of date. The version on rubyforge matches the version of the gem I have on my computer and it was released on rubyforge Sep 1, 2010. Hope that helps.

I tried doing this myself, but wasn't able to get things working. Anyways, thanks for looking in to this for me.

from cells.

apotonick avatar apotonick commented on June 14, 2024

Luke-
the .autotest needs the following content to work:

Autotest.add_hook :initialize do |at| at.add_mapping %r%^app/cells/(.*).rb$% do |_, m| "test/cells/#{m[1]}_test.rb" end end

However, we need to fix a bit in autotest-rails: seattlerb/autotest-rails#2

Look what a nice person I am! I even started bugging the autotest guys for you ;-)

from cells.

lcowell avatar lcowell commented on June 14, 2024

Thanks man!

Here's what I put in the discover.rb file. It provides the reverse mapping to trigger autotest if the test file is edited instead of the cell definition (this might be useful to others).

Autotest.add_hook :initialize do |at|
  at.add_mapping %r%^app/cells/(.*)\.rb$% do |_, m|
    "test/cells/#{m[1]}_test.rb"
  end
  
  at.add_mapping %r%^test/cells/(.*)_test\.rb$% do |_, m|
    "app/cells/#{m[1]}.rb"
  end
end

Everything works perfectly, but if you trigger the tests based on modifying the test file, you'll get this error:
./app/cells/treatment_cell.rb:4: uninitialized constant Cell (NameError)

I tried requiring cell like this:
require 'cell'

However, I then get this error:
uninitialized constant Cell::ActiveSupport

Any ideas ?

Thanks again for your help with all this.

from cells.

lcowell avatar lcowell commented on June 14, 2024

I had a typo in my mapping definition which is what was throwing all the errors. Here's the updated definition:

Autotest.add_hook :initialize do |at|
  at.add_mapping %r%^app/cells/(.*)\.rb$% do |_, m|
    "test/cells/#{m[1]}_test.rb"
  end
  
  at.add_mapping %r%^test/cells/(.*)_test\.rb$% do |filename, _|
    filename
  end
end

from cells.

apotonick avatar apotonick commented on June 14, 2024

Where exactly do you put that config? Do you think it would make sense to add that to Cells itself? Or maybe to a separate gem? Or put instructions on its own wiki page?

Thanks for figuring out all that shit!!! :-)

from cells.

lcowell avatar lcowell commented on June 14, 2024

The config goes in Rails.root + "autotest/discover.rb". I've added some info to the wiki.

I haven't had a chance to test it yet, but I think the second group might need to be:

  at.add_mapping %r%^(test/cells/.*_test\.rb)$% do |filename, _|
    filename
  end

I think putting the information in its own page or in the readme is probably good for now. Are you thinking about making a gem that creates an autotest style called cells-rails or something like that ?

from cells.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.