Parisian Roundabout

A garden roundabout near the Champs Élysées in Paris – October 2010

Posted in Photos | Tagged | Comments closed

The powers of Mocha and Shoulda combined

I’ve recently started using Mocha. It was pretty easy to integrate into my unit tests and sped them up somewhat.

I added one line to my test_helper.rb:
require 'mocha'

I separated my should blocks into contexts by the mocks I needed to use and created mocks in my setup blocks:
@plugin_value_mock = mock('PluginName::ClassValue')
@plugin_value_mock.stubs(:value => 5.00)

Then, in each of my should blocks, I set the necessary expects:

PluginName.expects(:get_ClassValue).returns([@plugin_value_mock]).once

It wasn’t nearly as simple for my functional tests. Before the expects, they looked like this:
context "GET on :index" do
  setup do
    get_as @user, :index
  end

  should_respond_with :success
  should_assign_to :objects, :title
  should_render_template 'index.html.erb'
end # index

I couldn’t just put the expects statements inside the should blocks like I did in the unit tests! Some quick research found the before_should method, which is a beautiful solution to my problem:

context "GET on :index" do
  setup do
    get_as @user, :index
  end

  before_should "get all values" do
    PluginName.expects(:get_values).returns(@standard_value_mock).once
    PluginName.expects(:get_ClassValue).returns([@plugin_value_mock]).at_least_once
  end

  should_respond_with :success
  should_assign_to :objects, :title,
  should_render_template 'index.html.erb'
end # index

Posted in Ruby on Rails | Tagged , , , , | Comments closed

Vocabulary reflecting culture

English, French, Spanish, and many others are fairly widespread languages that are used in a variety of countries throughout the world. As such, the combined words in these languages reflect how all of the various countries use the language.

But what about other languages that are used by small communities? For example, a language that has no word for “murder” would indicate that that’s never something that their community has seen.

When you look at English or French, look at the variations in vocabulary between countries or regions. You may say that they are the same language (which they are), but they still have regional differences in vocabulary AND pronunciation. Vocabulary is thus also representative of their regional culture.

For example, in university in Canada, I learned that the French word for email is “courriel”*, but my French co-workers looked at me confused when I used that word, so I’ve adapted to using their word “mél”, even though I think it looks like the abbreviated form of the girls’ name Mélanie. Or in elementary school, we would sing “Bonne fête!” when it was someone’s birthday, but when I told a French co-worker that it was someone’s fête, he thought that I was saying that it was her saint’s day!

Those are just the first two examples that I can think of off the top of my head, but there are many, many others. Thankfully, my French co-workers seem to understand what I say most of the time and I’ve been trying to adapt to their words to make it easier to understand me. Although I must maintain that “courriel” and “pourriel” (spam email) are pretty cool words.

* “courriel” in Québec versus “mél” in France is, in my opinion, indicative of the difference in their fears of assimilation of English when used in English. I’ll discuss this further at another point.

P.S. For anyone who is interested, I’m still reading “Le développement du langage observé chez un enfant bilingue”. The Kindle version that I found is horribly formatted, so it’s taking some time to read since I essentially have to skip over all of the phonetic transcriptions (!) of stuff that his kid says. I’m mostly in it for his conclusions anyway, so I’ll sum my highlights up (and translate them to English – the book was written in French) after I’m done, whenever that is.

Posted in Linguistics | Tagged , , , , | Comments closed

Late summer beach

Looking west from a local beach – August 2010

Posted in Photos | Tagged | Comments closed