Two Frogs
Fade_green_to_white

2frogs.net Blog

Testing :dependent => :destroy with shoulda

0 Comments
Tags: web development

I was writing more unit tests, and trying to find a good way to test the :dependent => :destroy option on associations. You know, when you have this kind of situation:

class Post < ActiveRecord::Base
has_many :comments, :dependent => :destroy
end

class Comment < ActiveRecord::Base
belongs_to :post
end

I had been toying around with something really complicated, like instantiating a post, and some comments that belonged to the post, then deleting the post with an assert_difference wrapper around it, and just not getting anywhere fast. It seemed like a lot of work for something baked into Rails.

Enter Radar (aka Ryan Bigg) who introduced me to a new (to me) function: Read the whole post...

Disabling a link on click

0 Comments
Tags: web development

Things have been moving right along. My unit, functional, and even integration tests for the existing functionality was all written and passing (woot!), so I’ve now started writing in new functionality. Specifically, I have added the ability to register for a summer Day Camp to this app (which, by the way, is for a local Girl Scout group I’m involved with).

I’m a little embarrassed to admit that I haven’t really been keeping my test coverage up as I’ve added new elements to the site. I never was a huge believer in TDD (Test-Driven Development), but I do believe in TBD (Test-Backed Development). So I’ll back-fill the tests eventually, but right now I’m on a deadline (beta demo tomorrow night!) and need to get some bugs squashed.

One tiny part of this big new animal I’m building is the ability to print a registration once you have input the data and saved the r...
Read the whole post...

Functional Testing with Shoulda and FactoryGirl

0 Comments
Tags: web development

I got all my unit tests done (woot!) so now I’ve moved on to functional tests. I got bogged down a bit on the assigns_to matcher, so I thought I’d share my solution here for others to find in the future. For the record, I’m using Rails 3.2.11, Factory Girl 4.1.0, and Shoulda 3.3.2.

This works (note the variables are passed as an array within a block):


context “as a logged-in admin” do
setup do
admin_user = create(:admin_user) UserSession.create(admin_user)
end

context “on GET to :index” do
setup do
@new_user = create(:user)
@new_user2 = create(:user)
@new_user3 = create(:user)
get :index
end

should respond_with :success
should assign_to(:users).with { [@admin_user, @new_user, @new_user2, @new_u...
Read the whole post...

Updating a Rails 3 app - round 2

0 Comments
Tags: web development

I got the majority of the website updated – hallelujah! Next was to get tests functioning.

Before, I’d used a combination of Test::Unit and shoulda for testing, with object_daddy exemplars. They worked fine, 3 years ago. With the upgrade to Rails 3, I was getting shoulda errors. Turns out things like:

should_validate_presence_of


have now become:

should validate_presence_of


I made all of those changes, then got hung up on validating presence of multiple attributes for a single object, ie:

should_validate_presence_of :post_id, :user_id, :body


I tried various alternatives, including:

should validate_presence_of :post_id, :user_id, :body
should validate_presence_of(:post_id, :user_id, :body)


but was getting wrong number of arguments errors. After consultin...
Read the whole post...

Updating a Rails 3 app - round 1

0 Comments
Tags: web development

I’ve spent the last several days trying to get my development environment current and existing Rails apps updated. It’s been a chore, let me tell you!

I wish I had kept better notes about the whole process, but it was frustrating enough that I’m just glad to be making forward progress. I realized that I had been coding for over a year (back when I was coding regularly) without any updates of my tools. Rails, Ruby, rvm, capistrano – everything was 3 years or more out of date. So the first priority was to get a current set of all of the basics.

Then I could open and tinker a bit with an existing simple Rails 3 app – my “sandbox” app. OK, it’s not technically my app, but I have been allowed to play in it nevertheless. All I’ve done in it so far is add a conditional link to one view, which at least required me to add a controller method and a route, as well as write my first little bit of ha...
Read the whole post...

Can I still do this?

0 Comments
Tags: development

Any successful journey requires some essential things:

* Knowing where you’re starting from
* Knowing where you’re going
* Some tools to get you there

It’s helpful if you have some kind of roadmap or plan for getting from start to finish, or at least a guide to help you along the way, but it’s not as critical as you might think. My journey back to professional web development is no different.

My ending point is obvious: to become a developer who is skilled and current enough on active technologies that someone will pay me to work for them.

My starting point: I am a former professional developer who’s been out of the game for over a year (closer to 2 years, really). The lingo and the toolsets have changed enough in that time that I feel like a n00b all over again, but I do have good familiarity with the basic concepts of OOP and MVC.
...
Read the whole post...

Next Chapter

2 Comments
Tags: development

It’s kind of interesting that the last time I posted anything at all here, it was almost 2 years ago, and it was about me trying to figure out what I wanted to be when I grow up.

And guess what! Here we are again!

The craft business isn’t working out, as a business. I don’t know if it’s my product, packaging, price, or venue that’s wrong, but after a full year of giving it the old college try (and making under $1000 in total sales), it’s time to call it what it is: a failure. One that I can’t afford to invest any more significant time into. I have a growing, young, expensive family, and they need me earning income.

So guess what, Rails world… I’m back!!

Or at least, I’m working my way back. I haven’t done any significant coding in almost two years – I’ve just done some code maintenance and emergency debugging. And more importantly, I haven’t done ...
Read the whole post...

Next Phase

3 Comments
Tags: web development quilting scrapbooking cooking karate sewing

I’ve been doing a lot of thinking about what direction I want my life to take next. No answers, but here are the thoughts.

At the moment, I’m feeling a little “Jack of all trades, master of none.” For example,

* I’m fair at martial arts. I think I’m a pretty good teacher of it, and I do alright given the shape of my body and my age, but the time is past when I could be a superstar. The paths I can take in the arts are limited.

* I’ve dabbled in several arts and crafts, with varying degrees of skill. I’m decent at quilting, scrapbooking, cross-stitching, and clothing construction. I’m not an expert at any of them.

* My time in the business world was very limited. Lack of degree keeps me from applying to any of the jobs I think I’d truly enjoy, and to be honest, I don’t want to work for anyone else. I’ve been spoiled by a decade of self-employment.

*...
Read the whole post...

Year End Recap

0 Comments
Tags: adam kayla lindsey thomas boy scouts camping diet and exercise girl scouts karate quilting scrapbooking sewing texas vacation web development

2010 draws to a close, and a new decade is about to begin. A lot has happened this year, some good and some bad:

* I earned my black belt in ChunJiDo.
* I started my second year as a troop leader, and added a co-leader.
* My last grandparent – Marie Payne – passed away.
* I formed new friendships.
* Old friendships were strained, and some ended.
* I saw drama amongst grown people at scrapbooking, karate, and scouts, and realized that drama is an inevitable part of the human experience.
* I learned that I actually really love camping.
* I lost ground on my weight loss goals.
* I sewed lots and lots of clothes, and scrapbooked hardly at all.
* My mom taught me to crochet – the basics, at least.
* I visited Dallas and St. Louis.
* Thomas started Cub Scouts.
* Lindsey started karate.
* I started more volunteer work with scouts and a homeless shelter. Adam helped me serve a meal a...
Read the whole post...

Relocating Again

0 Comments
Tags: web development

Long blog absences is nothing new for me, but this might be a record. :) I’ve been posting regularly to Twitter and Facebook but both have lost some of their luster – Facebook even more so than Twitter. I’m extremely annoyed with Facebook’s recent disregard of its users’ privacy, as well as the frequent and seemingly arbitrary changes to notification settings. I’ve had enough.

I’m still in the process of gradually moving blog entries into this new blog system, as well as working out the kinks in the application and making things easier to find. Please bear with me!

I’ll post a fuller update on everyone when more time allows. Welcome back!

Family Camping Trip

0 Comments
Tags: camping boy scouts girl scouts vacation

We went on our first all-family camping trip this weekend, to New Harmonie State Park. Adam’s Cub Scout Pack was having a campout there, and so we all went along. I would call it a successful trip, though of course, camping is not an unmixed blessing.

Pros: No electronic distractions (Mike didn’t touch a phone to his ear all weekend); no laundry; no deadlines; no neighborhood drama; lots of time to relax; a good long swim at a pool; a fun hike through the woods; getting to know a couple of families; funny little-boy skits around the campfire; s’mores; Friday night’s dinner; hammock; realizing once again, by comparison, how freaking great my husband and kids are.

Cons: Pit toilets; lack of shade at the pool; the heat; the feeling when you haven’t showered for two days and are covered in bug spray, sunscreen, and sweat; air mattresses deflating; occasional bad behavior ...
Read the whole post...

Random Snippets and Updates

0 Comments
Tags: homeschooling housework books pets karate diet and exercise girl scouts

Only four months since my last post here? I could have sworn it was longer than that! Anyway, I got bit by the blogging bug again, so here I am. In no particular order:

The kids are getting ready to put on another play, with Mike’s help. This time it’s Gilgamesh. I made costumes for everyone, which took up the better part of May. That’s finally done, and I can get back to earning an income. About damn time, too; sewing was starting to be more work than fun, and I was missing code. I need variety!

I’m also starting to get caught back up on the housework, which has been getting away from me while I was playing Betsy Ross. Not going to do it all at once; incremental progress will be fine.

I took a break from doing “regular” homeschooling with the kids, and now we’re doing an extended unit on Egypt (modern and ancient). They’re really enjoying it and excited, and I’m not feeling bored by teachin...
Read the whole post...

A Room Per Day

1 Comments
Tags: housework

I really hate housework. It makes my fingers feel all sore and raw, my back hurt, and it makes me sweaty and gross. But I hate having a filthy house even more. So I have a new plan.

I made myself a “roombox” (catchy, right? Like “boombox”? No?). I cut little slips of paper and wrote the name of a room (or hallway, or entryway – whatever) on each one. I balled each one up and threw them all into this leftover truffles (yum!) tin box I had lying around (ahem). Each day, I’ll pick out one slip of paper, and SCOUR that room, top to bottom.

Some will be easy (upstairs hallway), and some will be a real pain in the ass (kitchen). Most will be somewhere in between. But this way I can work my ass off on ONE room, then ignore the whole rest of the house without feeling guilty.

Now, I am fortunate (?) to have a big house, so I won’t do a room more than once ever...

Poetry

0 Comments
Tags: adam kid quotes homeschooling

Adam had to write some poems as part of his schoolwork today. They were too funny not to share.

Prompt: Write a two-line free verse poem about a feeling. Compare it to some kind of food. For example, anger could be a tangle of spaghetti. Give your poem a title.

Happiness & Pastry

Happiness is like a cake,
Short, sweet and over too soon.

Prompt: Think of how someone you know is like a color, happy like yellow, for example. Write a two-line free verse poem on this topic without naming the person. Don’t forget a title.

Kayla

She is like pink,
Irritating to me but not many others.

Prompt: Write a four-line free verse poem, like “My Old Cat,” that creates a word picture of a day at school.

Homeschool

I am homeschooled,
It has its ups and downs,
I get ...

Papa's Passing and Trip to Texas

0 Comments
Tags: kid quotes food adam

If you keep up with Mike’s journal then you already know my grandfather died. It happened last Wednesday, November 30th. He was 82. It was either a heart attack or a stroke; they don’t know for sure, and because of his age no autopsy was ordered. Adam and I went back to Texas for the funeral. We left Thursday at 9:30AM. We flew from Spokane to Pasco to Salt Lake City to Dallas. The getting there was pretty uneventful. Adam cried some along the way, but for the most part he was content to play or sleep or nurse. I only changed planes once, in Salt Lake City where I also had a 2-hour layover. On the first plane, we were seated next to a nice woman named Judy who helped me with Adam. She held him and played with him and talked to me. We exchanged phone numbers, as she has an antique quilt her grandmother started that she’d like to have finished and I told her I’d talk to some people I know who do quilting and piecing by hand (it was all started by hand).
<...
Read the whole post...

Mike Is Sick

2 Comments
Tags: marriage mike thomas adam

Mike has a herniated disk. He’s discussed it here and here. He’s talked about what the injury has done to his body, but not the impact it’s had on the family.

There was a time when I would have dumped my every thought out on the Internet. It was freeing and cleansing. Like Mike, writing about things helps me to cope with them. But I’m not so reckless anymore. Once you put it on the Internet, it’s forever, and some of my thoughts are not really helpful right now.

Suffice to say, what we’re going through is in the top 2 most challenging times our family has ever had. I expect that, in time, we will recover and heal from this – our bodies, and our relationships – but it will take time.

In addition to Mike’s injury and all of the fallout from that, our children have been passing around various ...
Read the whole post...

Brownie Troop Leader

0 Comments
Tags: kayla girl scouts

The last two weeks have been all Girl Scouts, all the time. I signed up to be Kayla’s Brownies troop leader when I learned that her troop didn’t have a leader yet. As I do with everything else, I jumped in with both feet. We’ve already had our first parent meeting, and we’re having our first monthly meeting this coming Thursday.

It’s a big troop – 15 girls – which is a little bit intimidating. But I have a lot of volunteers to help and the parents are great, so I’m not really that worried. I have a lot of ideas for things we can do, so now I just need to make it happen.

Besides planning for meetings, there’s been all of the “business” of Girl Scouting to deal with – getting parents and girls registered, getting permission to establish our checking account, training, reviewing materials, getting our meeting location secured, etc. Everyone tells me that once you get past this initial burs...

My Food Diary

1 Comments
Tags: diet and exercise

So for about the last two months, I’ve been on a mission to reduce my weight. My goal was to lose 42 pounds, through changes in diet, and more exercise. If you’ve been reading here awhile, you know I’ve tried this several times before, with varying degrees of success.

This time I decided to keep a diary of what I eat, in hopes that it would help keep me from cheating. I didn’t want to report this all publicly, though, so I signed up for an account at My Food Diary. I must say, I have been thrilled with their service.

They already have a pretty extensive database of foods, but you can always manually add your own, or even create your own recipes and have the program calculate the nutritional information. You input your weight and your goal weight, and it will tell you how many calories you’re allowed to have in a given day if you want to either maintain your weight, or lose 2 pounds per week....
Read the whole post...

Dream Job

0 Comments

If I didn’t have to worry about money and I could have a job purely for fun, I would go around to big-box stores like Wal-Mart and Target and straighten up the shelves. Re-fold the stacks of shirts, return the misplaced packages to their rightful places.

I know, it sounds sort of stupid, but there’s something oddly satisfying about restoring order to chaos in such a simple, concrete way.

Drawing Skills Develop

0 Comments
Tags: kayla

About three and a half years ago I posted three drawings that Kayla (then almost four years old) had done. I showed her the post today as I was entering them into this new blog system, and encouraged her to make new drawings of the same subjects, to show her progress as an artist. Here they are, side by side:







Great Birthday

0 Comments
Tags: web development

Today I turned 35 years old. I love celebrating birthdays – I’m as bad as the kids. I took the whole weekend off from work and scrapbooked and relaxed. The kids, Mike, my in-laws, and a friend got me some really thoughtful gifts, and I was showered all day long with congratulatory messages on Facebook, Twitter, email, and text.

I am so blessed.

So, obviously, the blog is back on. I’ve been wanting to redesign this entire site (2frogs.net) for quite some time, so here it is. Things will probably change and grow quite a lot over time, so if you’re into it, check back often. Pulling over the old blog archives is going to take a looong time. Before 2006 I just had all of my blog entries in flat HTML pages. Getting them into a database is a long, tedious, boring process. I’ve been blogging over ten years now, and that’s a lot of entries to input. I’m in no great, tearing hurry, though; it’...
Read the whole post...

Click on Yes

0 Comments
Tags: thomas kid quotes

Thomas was busy playing with his computer at bedtime, when the following conversation ensued:

Dad: It’s time to go to bed, Thomas.
Thomas: OK, I click on Yes to go to bed.

Spines

0 Comments
Tags: kayla kid quotes

Kayla (after getting a big hug from her Mom): You squeeze my spines!

Sloppy Joes

0 Comments
Tags: adam kid quotes

Adam: “Not even an entire world made out of sloppy joes would be loved by me more than you are loved by me.”

Nana Fluffy

0 Comments
Tags: thomas kid quotes

Thomas: I want nudder ’nana fluffy! (banana muffin)

Cooking With What?

0 Comments
Tags: adam kid quotes

Adam: Mama, when I grow up, I’m gonna have a cooking show called “Cooking at Cafe Adam.” All you need is a few ingredients, and a TV!
Mom: That sounds great! And I have a few ingredients, and a TV.
Adam: Yes. But it’s sad that people who live in boxes won’t be able to watch it.
Mom: Yes, that is sad.
Adam: Are there any people who live in boxes that have radios?
Mom: Yes, I think so.
Adam: Well, there will be a radio version of “Cooking at Cafe Adam”, called “Cooking With Trash Food.” (We’ve been doing some talking lately about gratitude and consequences and how much worse life could be than having to do schoolwork and have a bedtime.)

MySpace

0 Comments
Tags: social networking

I may end up regretting this, but I think I’m going to move my blogging over to my site on MySpace. They just make it so easy, and I’m hoping I don’t get nailed with comment spam again. We shall see. Anyway, there are a couple of entries over there, so if you’re interested, go take a look. And if not, that’s ok – it won’t hurt my feelings. :)

Niagara

0 Comments
Tags: mike music love

It’s not new, but I’m really lovin’ this song right now.

It’s really amazing to be sharing my life with the person I most love and most respect in the whole world. What a blessing!

When Moms and Kids Get Silly

0 Comments
Tags: adam kid quotes

Mom: Run, run, run, as fast as a deer. You can’t catch me…
Adam:… cuz I’m drinking root beer!

Mom: Run, run, run, as swift as a cheetah. You can’t catch me…
Adam:… cuz I’m not good to eat-a!

Mom: Run, run, run, as fast as light. You can’t catch me…
Adam:… cuz I’ve got much might!

Mom: Run, run, run, like a pair of pantyhose. You can’t catch me…
Adam:… cuz I’m standing on my toes!

What Next?

0 Comments
Tags: politics

I’ve been chewing on this thought for awhile, and have decided it’s time to just put it out there.

I’m fed up with the Republican party.

I was pretty vocal about my support of George W. Bush back in 2004 (read the archives), but the actions of his administration and other prominent Republican leaders have left me cold.

I think it all started with the Medicare drug bill. Things seemed to go from bad to worse after that, and I never really fell back in love with the GOP after that. I mean, granted, I was happy about the tax cut, but a responsible government would have coupled that with spending cuts. Instead, spending is absolutely out of control. Iraq is (I’m just going to say it) an almost unmitigated disaster, with no endgame in sight.

The party allegedly of small government is involving itself in all manner of state’s rights issues from what constitutes marriage to outlawing...
Read the whole post...

Copyright 2009 - 2013, Dana Jones. All rights reserved.
Website designed by Sterling Rose Design
Frog photograph in the header of this site taken by 8UGS