Mildly incoherent, but here they are:
Culture of Testing
Jon Yurek, Thoughtbot, @jyurek
Testing & version control not taught in school, no reason not to. Java testing getters and setters – insane. Culture of Ruby is to test/TDD.
- Coming of age blog
- Then framework
Contrib factory_girl/shoulda. Out the box very limited. Then we found cucumber. Didn’t like at first, but then having a story. 2009 Rumble – pure cuke. Can’t test with just cuke. Fakes – sham-rack. Tiny apps that can run basic API hits. Outside-in the way forward.
Don’t write integration tests like unit tests – cuke stories are not supposed to be code.
Steps not just long-winded method calls.
Don’t have time to test – it will make us faster. Technical debt – won’t be able to refactor or add new features. But if you really need to, go ahead. Once done, and calmed down rewrite it the right way headaches down the line.
Working with the unknown – write stuff to find out what the approach is. Understand problem and then throw it away. Experiments, toss them out. Weren’t writing your best code in the first place.
Code is communication, tests even more so.
Tests are also tests – tests are first client for app. No-one will know how to change, cargo culting. Tests will tell you what the coder was thinking.
Look at tests first.
RSpec & Shoulda have very few watchers on github.
Everybody’s testing, just not very efficiently.
Use the scientific method hypothesis/test/control/results Profit!
Hypotheses – Greatest challeng to any thinker is stating the problem in a way that will allow a solution Bertrand Russel
Test explicitly exposes solvable problem and confirmation. Harder than writing a solution. More time,
All testing in some sense – switching over to TDD – make code better.
Black-box testing. Outside in, refactoring should make no difference.
We owe it to ourselves and our profession to prompte automated testing. Having this culture.
Crazy ideas would like to see –
- Javascript in Ruby (exists, but crazy).
- Automated tests for HTML/CSS
- CPAN tester network for gems
Good testing ==== public shame
Won’t run gems without tests.
Tests are professional – respectful enough of their code to document in code.
All work in topic branch – git pull requests. Code coverage done through review.
Git the stupid NOSQL database
Rick Olson
Github use it more like a database.
git hash-object
(what?)
Send some JSON into a file and get it out again – crazy.
Git also a graph database – Nodes to nodes
Tree – subdirectory of blobs
git update-index
git write-tree
commit-tree
refs (not an object, a tag/pointer)
tags
2 types – lightweight, branch pointer to sha, annotated tags object that points to a commit w custom tag message who/when
gem install grit
gem install gollum
Local wiki clone of the one in git
Hmmmm – git grep
Latest files updated atom feed
diff-tree —name-only master~10 master
Need to know how many commits or will errir
Gollum suited for small to medium projects.
Smoke is grit on the cloud – proxies out to Erlang services.
Rails Admin, The right way of doing data administration
Bogdan Gaza, @hurrycane
Rails Admin Ruby Summer of code 2010
Way you organise & control your data
Admin panels – PITA
Simple, secure & fast – custom error prone not fast or simple.
CMS? Simple but not always flexible. Rails – Plugin/engine, usually secure fast & simple
Choices:
- lipsiaAdmin (R2) ExJS
- Active Scaffold (R2)
- Hobo (R3) includes a lot of non-admin stuff
RailsAdmin sferik/rails_admin
Port Merb-Admin to R3. Merb slice/R3 engine, structure pretty much the same.
Engines similar to plugins, but work like Merb slice.
Namespaced controller/model/routes. Mountable app outside Rails structure
gem ‘devise’
gem ‘rails_admin’, :git => ‘git://github.com/sferik/rails_ad,in.git’
bundle update
rails g rails_admin:install_admin
Not using devise? Override or use another warden-based solution.
authenticate … and current_user
3.1 it will be mountable.
Automatically adds history and search
Will be the admin panel of choice in future.