Admin::Tests
Been struggling a little with testing Admin::Controllers, mainly because I don't fully understand the scaffold functional test code. Anyhow just generated Admin::Poop!! so we can see how the nesting affects the tests
class Admin::PoopsControllerTest < ActionController::TestCase
def test_should_get_index
get :index
assert_response :success
assert_not_nil assigns(:admin_poops)
end
def test_should_get_new
get :new
assert_response :success
end
def test_should_create_poop
assert_difference('Admin::Poop.count') do
post :create, :poop => { }
end
assert_redirected_to poop_path(assigns(:poop))
end
def test_should_show_poop
get :show, :id => admin_poops(:one).id
assert_response :success
end
def test_should_get_edit
get :edit, :id => admin_poops(:one).id
assert_response :success
end
def test_should_update_poop
put :update, :id => admin_poops(:one).id, :poop => { }
assert_redirected_to poop_path(assigns(:poop))
end
def test_should_destroy_poop
assert_difference('Admin::Poop.count', -1) do
delete :destroy, :id => admin_poops(:one).id
end
assert_redirected_to admin_poops_path
end
end
db:fixtures:load
rake db:fixtures:load loads fixtures data into the current environment.
This is an alternative to having data migrations, although whether its a better alternative is something I have to think about.
Git, Svn, Rails, Edge and Plugins
Setting up a Rails Project that is kept under svn and uses svn:externals for plugins for use locally with Git
Cygwin Rails and MySQL
Many others have done this, so thanks to those who provided the info used here.
Gem Installation
When setting up gems unset the environment variable RUBYOPT
RUBYOPT=""
Rails Installation
Don't need --include-dependencies switch any more, they're installed by default.
MySQL
In Cygwin you'll want to install the MySQL gem. This needs the MySql libraries/source in order to build, so you need to download the source. Then run
./configure
make install
This failed at first, trying to resolve by
- installing g++ using cygwin setup
Now you have what you need to install the MySql gem. gem install mysql
E and TextMate
Differences between the two editors are quite apparent, with textmate being way ahead at the moment. Some of this is down to environment, some of this down to the usability of OSX (hate to say it as a veteran XP user) and some down to the immaturity of E.
No Templates in E
This was a bit annoying as I wanted to create this post in E, but couldn't get the blogging bundle to work correctly. However as Typo's web interface in Firefox is super speedy, I may well not need E for this functionality
I did get the blogging bundle working with E, and then was deeply disappointed by it. E does not recognise that posts are in Markdown format and so does not syntax highlight them. So your workflow has to be
- retrieve post with e
- save as a markdown file somewhere
- post
Just not enough benefits to be useful enough. So that means that E has to be killer for doing Rails development, otherwise I'll probably not be buying it.
Blogging with Textmate on Typo
Amazing seems like I’ve finally got my own typo blog and the ability to blog to it from textmate. This really is something else.
Now all I need is something worth saying
So it seems you can quickly post the blog (need to learn that shortcut pronto), and then textmate will submit it and open the post up (currently in Safari). Really quite spiffy. And of course you can preview locally.
Some Things to work out
- why is the markdown formatting not working anymore
- how to do tags and categories.
- convention for naming locally saved posts
- doing same thing from windows using e
- how to have Textmate remember username and password
- how to have shortcut for posting not clash with Cog’s shortcut for play
- how to get headers in an article (to) be smaller than the actual header of the article (which is
<h2>) - some CSS trickery needed.
Safari Killing My Typo!
Could it really be that Safari is killing my installation of Typo?
- preview seems to be working correctly on firefox
- laptop committed immediately when I did a post on it
What will happen here?
Well I’ll be … - a really quick post from Firefox, looks like I’m ready to start blogging!!
First post from laptop.
Really need a backlit keyboard for my laptop. I can’t see a bloody thing at the moment. Will this post. My other post from the Mac still hasn’t submitted!
Using TCP/IP for MySql
This failed miserably, will have to stick with localhost and the socket for now.
Blogging With Typo
Using MySql
Most important thing was to have correct database.yml configuration. I was missing the socket option - this would cause typo to just hang, with no indication of what was going wrong - no writes to log files, nothing
My database.yml now is
login: &login
adapter: mysql
host: localhost
user: typo
password: xxxxxxx
socket: /var/run/mysqld/mysqld.sock
development:
database: typo_dev
<<: *login
production:
database: typo
<<: *login
test:
database: typo_test
<<: *login
The location of mysqld.sock is specific to Debian based systems, yours may vary. Its really really annoying that the typo guys don't put this is database.example.yml. Its also pretty annoying how poorly documented typo is.
Super Long Commit
When committing this post typo seemed to hang once again, the post did finally go through but it took ages. Wonder if it could be a DNS thing?
Preview
The simple editor is supposed to have a life preview, using Ajax that updates your post with its view of it. Currently this works for about 4 words then blows!!