Skip to content

Instantly share code, notes, and snippets.

View oliverbarnes's full-sized avatar

Oliver Azevedo Barnes oliverbarnes

View GitHub Profile
@oliverbarnes
oliverbarnes / load_libraries_spec.rb
Created May 8, 2014 01:57
trying to test loading of libs
ENV["RAILS_ENV"] ||= 'production'
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
# Ensure Builder is loaded
require 'active_support/builder' unless defined?(Builder)
@oliverbarnes
oliverbarnes / load_libraries_spec.rb
Created May 8, 2014 01:59
Trying to test loading of libs
ENV["RAILS_ENV"] ||= 'development'
require 'rubygems'
# Set up gems listed in the Gemfile.
require 'bundler/setup' if File.exists?(File.expand_path('../Gemfile', __FILE__))
# Ensure Builder is loaded
require 'active_support/builder' unless defined?(Builder)
E:\RG\projects\participate>bundle exec rackup
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
For a better pry experience, please use ansicon: http://adoxa.3eeweb.com/ansicon
/
C:/Ruby200/lib/ruby/gems/2.0.0/gems/representable-1.7.5/lib/representable/hash/c
ollection.rb:1:in `<top (required)>': uninitialized constant Representable (Name
Error)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/representable-1.7.5/lib/represe
ntable/json/collection.rb:1:in `require'
@oliverbarnes
oliverbarnes / ember-cli-bdd-tute.md
Last active August 29, 2015 14:04
Draft for tutorial on bdd-ing an ember-cli feature

Participate is being worked on by a great team in Helsinki as part of this year's Rails Girls Summer of Code!

The front-end application is being built with Emberjs and the brand-spanking-new Ember CLI, and we're all getting a crash course on both.

This tutorial walks through building a simplistic feature in Ember following Behavior-Driven Development as much as possible.

It's meant as a sample workflow for the RGSOC team, new to BDD itself, and as a possibly useful example to others grokking bdd-ing with Ember, like myself. It comes from my attempts to port my usual workflow in Ruby.

In this first installment, I'll create a very simple Initiative with just a title and a description.

@oliverbarnes
oliverbarnes / ember-cli-bdd-tutorial-part-I
Last active August 29, 2015 14:04
Learning Behavior-Driven Development with Ember CLI - part I
This tutorial walks through [BDD](http://en.wikipedia.org/wiki/Behavior-driven_development)'ing a feature with [Ember CLI](http://iamstef.net/ember-cli/), [Mocha](http://visionmedia.github.io/mocha/) and [Chai](http://chaijs.com).
I'm writing it as I learn [Emberjs](http://emberjs.com), its way of doing things and its toolset, and try to adapt my usual workflow coming from Ruby. It's meant as an initial guide for the [RGSoC](http://railsgirlssummerofcode.org) [team](http://rghelsinki2014.tumblr.com) working on [Participate](https://github.com/oliverbarnes/participate-frontend). Hopefully this post will be helpful to others learning Ember as well, and even better, invite people to show how they're doing things themselves in the comments.
The feature I'll build here in baby-steps will be *Posting a New Initiative*. In Participate, a user can post proposals for civic initiatives, to which other users can then suggest changes, and then vote on.
This first installment will involve nothing but filling out a si
@oliverbarnes
oliverbarnes / .travis-for-ember-cli.yml
Last active August 29, 2015 14:04
travis.yml for ember cli app
language: node_js
node_js:
- "0.11"
before_script:
- npm install bower
- bower install
@oliverbarnes
oliverbarnes / failure output
Created November 18, 2014 23:49
Timeout failure on ember-cli-mocha test
not ok 6 PhantomJS 1.9 - Posting an initiative before posting "before each" hook
---
message: >
timeout of 2000ms exceeded
Log: >
...
not ok 7 PhantomJS 1.9 - Posting an initiative when the initiative is valid "before each" hook
---
message: >
timeout of 2000ms exceeded
@oliverbarnes
oliverbarnes / errors-test.js
Last active August 29, 2015 14:17
test not loading
var get = Ember.get, set = Ember.set;
var models, env;
var responses, fakeServer;
module('integration/specs/errors', {
setup: function() {
fakeServer = stubServer();
responses = {
post_errors: {
@oliverbarnes
oliverbarnes / undefined-cache-subject.js
Last active August 29, 2015 14:26
ember model unit test error
//tests/unit/models/proposal.js
/* jshint expr:true */
import {
describe,
describeModule,
it,
beforeEach,
afterEach
} from 'ember-mocha';
@oliverbarnes
oliverbarnes / model-handling-models.js
Created August 7, 2015 16:10
Ember - example of models handling models
// app/templates/components/support-button.hbs
<button {{action 'toggleSupport' proposal session.me}}>
// app/components/support-button.js
export default Ember.Component.extend({
actions: {
toggleSupport: function(proposal, participant){
return proposal.toggleSupportBy(participant);
}
}