Comments (11)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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)
- Cells + Airbrake issue - double exceptions raised HOT 2
- Using Cells with Rails engine that has html.erb partials not being picked up HOT 5
- Confusing file structure - views or view? HOT 7
- Template Missing ... again! HOT 21
- how to render erb templates when haml/hamlit and erb extensions installed HOT 3
- Render an array inside view cell HOT 1
- Escaping implementation seems to be a glaring LAYER VIOLATION, methinks.
- Is there some way to do html escaping default with options?
- Publish latest version on Rubygems HOT 10
- should default to file_name.html.erb or .haml HOT 1
- Can't get form_with to work from a cell in Rails 6 HOT 3
- License HOT 1
- Form Input renders as raw text in cell HOT 1
- Feature Request: Support Recyclable Cache Key
- Still maintained? Documentation URLs broken. HOT 9
- Default cache key produces clashes HOT 4
- Options hash is same instance passed to each cell when using collections HOT 1
- Slim v5 breaks cells HOT 9
- Ruby 3.0 ArgumentError: wrong number of arguments error with keyword args for Cell::Testing
- Ruby 3.0 ArgumentError: wrong number of arguments error with Caching
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cells.