Skip to content

Instantly share code, notes, and snippets.

@jamesmartin
Created February 11, 2011 02:52
Show Gist options
  • Save jamesmartin/821844 to your computer and use it in GitHub Desktop.
Save jamesmartin/821844 to your computer and use it in GitHub Desktop.
Testing instance methods defined on a Sinatra application using the helpers module using RSpec
require 'rubygems'
require 'sinatra'
Sinatra::Base.show_exceptions = false
class App < Sinatra::Base
helpers do
def my_helper_method
"ZOMG HELLO!"
end
end
end
describe 'App' do
before(:each) do
@app = App.new
end
def app
@app ||= App.new
end
it "exposes its helper methods" do
@app.should respond_to :my_helper_method
@app.my_helper_method.should == "ZOMG HELLO!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment