Skip to content

Instantly share code, notes, and snippets.

@alsor
Created April 7, 2016 09:23
Show Gist options
  • Save alsor/8f9ec152f504ca0c52591cbd4249bfa2 to your computer and use it in GitHub Desktop.
Save alsor/8f9ec152f504ca0c52591cbd4249bfa2 to your computer and use it in GitHub Desktop.
Stand by me
require 'rails_helper'
class Tear
end
class Me
attr_accessor :you
def afraid?
!you.present?
end
def shed_a_tear
Tear.new unless you.present?
end
end
class You
def stand_by(me)
me.you = self
end
end
RSpec.describe "Stand By Me" do
let(:me) { Me.new }
let(:you) { You.new }
before { you.stand_by me }
context "When the night has come and the land is dark" do
context "And the moon is the only light we'll see" do
specify { expect(me).not_to be_afraid }
end
end
context "If the sky that we look upon should tumble and fall" do
context "Or the mountain should crumble to the sea" do
specify { expect(me.shed_a_tear).to be_nil }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment