RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

mfpiccolo — 5 posts

happy_place allows you to call js functions and pass in variables and partials. It has a simple interface which allows you to write object oriented javascript and use these objects in your controllers.

Here is an example posts controller setup that will respond to html and js. When format is js it will call the coffee script class with the index function passing in a partial with the html that you want to replace.

class PostsController
 def index
  @posts = Posts.all

  respond_to do |format|
    format.js { js partials: {posts: "posts"} }

You can put the following code anywhere but this is where I would put it

# app/assets/controllers/
class this.PostsController
  constructor: ->

  @index: (args) ->

No need for a js view!
self_systeem records a users interaction with your rails app and then can replay that interaction in an automatically built test to assert a similar response.

With version 0.1.0, you can require a tests start with the app in the state of a pervious test. This allows you to test your app in a modular fashion, going feature by feature. i.e(sign_in_test, create_post, create_comment)

You can also have multiple starting points for example "admin_signup_test" and "user_signup_test". Each could be the starting point for a separate tree of feature tests.

Now lets build some system tests!
1. a realistic respect for or favorable impression of one's system
2. confidence in one's system worth or abilities
3. system-respect

Do you have low self-systeem? I just cut a gem that might be able to help out.

self_systeem records a users interaction in development and automatically creates system tests based on that users interactions.

It is really simple but has the potential to be quite useful. This is all you need to do do:
1. Install and configure the gem.
2. Run SELF_SYTEEM=true rails s`
3. Walk through your app and cover as much as you feel necessary.
4. Run tests and watch them turn green.
I like how VCR jives with Rspec for recording and replaying HTTP requests in your test suite. Specifically how you can pass a :vcr symbol to a describe or it block and it will handle the cassette naming and file structure automatically. However, in most cases I use Minitest.

Cut a gem that gives Minitest with VCR that functionality here:
Rolling your own integration with an external service where the schema can change from moment to moment can be tough.

I was building an app that relied on salesforce data from multiple salesforce accounts. Not only did we know nothing about the data as we pull it in from the external service, salesforce data structure can be changed at any moment by the users! That scares the hell out of us Rails developers who are used to using structured databases.

I came up with a solution that creates pliable active record objects by using JSON data store in Postgresql.

I extracted this out into a gem called pliable