Tagged: rails

Shoulda used RSpec

I've been updating the muck gems to work with Rails 3. The change is significant and painful but in a good way. For the most part the change consists of deleting all the code you used to hack into the Rails framework and adding subclass of '::Rails::Engine'. I'll try to put together a detailed post explaining Rails 3 engines later.

The nice thing about having a test suite in place is that you can rely on those tests to ensure the upgrade is smooth. I've always written my tests in Shoulda. I like the syntax and I love the macros. However, I'm switching everything over to RSpec. Thoughtbot has declared they won't abandon the Shoulda community, but since they've made the switch to RSpec for new projects it's pretty clear that Shoulda as a stand alone project has a limited life.

Luckily I've used RSpec in a lot of other projects and it's an easy DSL to like. The conversion from shoulda to RSpec isn't a terribly difficult one. You basically ne...

Continue Reading →
t if you need to access your assets directly via file name it becomes a big problem. In my case I need to be able to access a javascript file for a bookmarklet. The proposed solution is that you put those kinds of files directly into the public directly. However, I needed to make use of the asset pipeline to take advantage of Rails JST capabilities. If you run into the same problem take a look at Non-stupid non-digest assets in Rails 4 by Alex Speller. It saved me a ton of time and fixed a major headache.

Just in case you want to be framed

It turns out that X-Frame-Options is set to 'SAMEORIGIN' by default in Rails 4. If you wa...

Continue Reading →