Skip to content

Instantly share code, notes, and snippets.

View beckyconning's full-sized avatar

Becky Conning beckyconning

View GitHub Profile
# There is no message object in the first example, and there needs to be one
# for the code in the action to run.
def create
message = Message.new(params[:message])
message.save
redirect_to :action => "index"
end
# We can get the first example to pass without impacting the second example by
F..
Failures:
1) MessagesController POST create creates a new message
Failure/Error: post :create, :message => {
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.save
# ./app/controllers/messages_controller.rb:4:in `create'
# ./spec/controllers/messages_controller_spec.rb:9
Computor:messages becky$ rake spec:models
(in /Users/becky/Documents/RSpec Book/messages)
/Users/becky/.rvm/rubies/ruby-1.8.7-p358/bin/ruby -S bundle exec rspec "./spec/models/message_spec.rb" "./spec/models/subscription_spec.rb" "./spec/models/user_spec.rb"
/Users/becky/.rvm/gems/ruby-1.8.7-p358/gems/activesupport-3.0.0/lib/active_support/core_ext/module/remove_method.rb:3:in `remove_method': User(id: integer, login: string, created_at: datetime, updated_at: datetime, subscription_id: integer) is not a symbol (TypeError)
from /Users/becky/.rvm/gems/ruby-1.8.7-p358/gems/activesupport-3.0.0/lib/active_support/core_ext/module/remove_method.rb:3:in `remove_possible_method'
from /Users/becky/.rvm/gems/ruby-1.8.7-p358/gems/activesupport-3.0.0/lib/active_support/core_ext/module/remove_method.rb:8:in `redefine_method'
from /Users/becky/.rvm/gems/ruby-1.8.7-p358/gems/activerecord-3.0.0/lib/active_record/associations.rb:1445:in `association_accessor_methods'
from /Users/becky/.rvm/gems/ruby-1.8.7-p358/gems/activer
Feature: Create ballot box
In order to make a decision based on the opinion of a group whether or not
they can be in the same place at the same time without disclosing the
identities of the participants
As a member of a group who wants to start a secret ballot
I want to create a secret ballot that the group can access online
Scenario: Create ballot box with participants including myself
Given a blank ballot box
Feature: Create a ballot box for a new motion
In order to make a decision as a group
As a member of a group who wants to make a decision
I want to create a secret ballot for a motion that the group can access
Scenario Outline: Create a ballot box
Given a new motion
When I fill in my email address
And I fill in participants email addresses
@beckyconning
beckyconning / gist:3885998
Created October 13, 2012 20:20
Crafty viewport relative position component
Crafty.c("ViewportRelative", {
_viewportPreviousX: 0,
_viewportPreviousY: 0,
_viewportStartX: 0,
_viewportStartY: 0,
init: function() {
this.bind("EnterFrame", this._frame);
},
_frame: function() {
if(this._viewportPreviousX != Crafty.viewport._x) {
//else we search for an entity with Mouse component
if (!closest) {
q = Crafty.map.search({ _x: x, _y: y, _w: 1, _h: 1 }, false);
for (l = q.length; i < l; ++i) {
if (!q[i].__c.Mouse || !q[i]._visible) continue;
var current = q[i],
flag = false;
//else we search for an entity with Mouse component
if (!closest) {
q = Crafty.map.search({ _x: x, _y: y, _w: 1, _h: 1 }, false);
for (l = q.length; i < l; ++i) {
if (!q[i].__c.Mouse || !q[i]._visible) continue;
var current = q[i],
flag = false;
//else we search for an entity with Mouse component
if (!closest) {
q = Crafty.map.search({ _x: x, _y: y, _w: 1, _h: 1 }, false);
for (l = q.length; i < l; ++i) {
if (!q[i].__c.Mouse || !q[i]._visible) continue;
var current = q[i],
flag = false;
navigation mesh polygon edges should have sprite z axis translate values.
entity z axis translate values are calculated so that the following are true:
an entity placed at the center of a polygon has the z translate value of the average of all edges
an entity placed at the intersection of two edges has the z translate value of the average of those two edges