Skip to content

Instantly share code, notes, and snippets.

View ekhall's full-sized avatar

EK Hall ekhall

  • Personal
  • New York, USA
View GitHub Profile
@ekhall
ekhall / gist:8566682
Last active January 4, 2016 04:09
Complex code smell?
describe 'Created Node Class' do
before(:all) do
@name = 'Patient'
@token = {model_name: @name, properties: [:first, :second]}
@klass = NodeFactory.get_node_class(@token)
end
it 'queries the graph and instantiates itself the correct number of times' do
➜ MgDB git:(abs-neo4j) ✗ pry
[1] pry(main)> require 'yaml'
=> true
[2] pry(main)> require './model/abstract_node'
=> true
[3] pry(main)> myhash = YAML.load(File.open('yaml-model/patient.yaml'))
=> {:model_name=>"Patient",
:properties=>[:mrn, :firstname, :surname, :dob, :gender]}
[4] pry(main)> Patient = Mgdb::NodeFactory.get_node_class(myhash)
=> Kernel::Patient
describe "PUT update" do
describe "with valid params" do
it "updates the requested article" do
article = Article.create! valid_attributes
Article.any_instance.should_receive(:update).with({ "these" => "params" })
put :update, {:id => article.to_param, :article => { "these" => "params" }}, valid_session
end
it "assigns the requested article as @article" do
article = Article.create! valid_attributes
@ekhall
ekhall / gist:6996849
Created October 15, 2013 18:58
This is sick...
--- ~ » irb
2.0.0p247 :001 > class MyClass
2.0.0p247 :002?> def initialize(val)
2.0.0p247 :003?> @x = val
2.0.0p247 :004?> end
2.0.0p247 :005?> def my_method
2.0.0p247 :006?> @x
2.0.0p247 :007?> end
2.0.0p247 :008?> end
=> nil