Skip to content

Instantly share code, notes, and snippets.

@rlivsey
Created November 26, 2009 10:43
Show Gist options
  • Save rlivsey/243386 to your computer and use it in GitHub Desktop.
Save rlivsey/243386 to your computer and use it in GitHub Desktop.
class ThingsController < ApplicationController
def index
puts defined?(@something)
puts @something
@something = "test"
render :text => 'done'
end
end
# expected output for each spec
# -----------------------------
# nil
# nil
# nil
# nil
describe ThingsController do
describe "test" do
# actual output
# -------------
# nil
# nil
# "instance-variable"
# "already set"
it "two requests" do
get :index
get :index
end
# actual output
# -------------
# nil
# nil
# "instance-variable"
# "already set"
it "another two requests" do
get :index
get :index
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment