Wordrobe - tiny app for memorizing words

Today I deployed my tiny application for memorizing english words for Japanese.



This is my weekend hobby work, I had built it during without daily working hours. I want to implove application as long as time allows. If you want to see codes, I already pushed to Github publicly. Source code is here. I must confess that I didn’t write any test codes.

Request Spec + Capybara-webkit + Rails3-jquery-autocomplete

This is a tips for not only related with autocomplete but more comprehensive with JavaScipt keydown event. Codes use keydown event, it’s not enough only fill_in, it needs executing keydown event.

it "should enable click tag", js => true do
  fill_in "entry[tag_list]", :with => "ta"
  page.execute_script %Q{ $('#entry_tag_list').trigger("focus") }
  page.execute_script %Q{ $('#entry_tag_list').trigger("keydown") }
  selector = '.ui-menu-item a:contains(\"tag name\")'
  page.execute_script " $('#{selector}').trigger(\"mouseenter\").click();"

How to use seeds during test

I want to use seed data with feature test like Request Spec and I find a good answer.

# {Rails.root}/spec/spec_helper.rb

Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

Rspec.configure do |config|

In support file, just require seeds.rb.

# {Rails.root}/spec/support/ext/seeds.rb

require Rails.root.join("db", "seeds")