Skip to content

Commit

Permalink
Add spec file
Browse files Browse the repository at this point in the history
  • Loading branch information
eee-c committed Mar 26, 2009
1 parent 3ad0032 commit ee0e193
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions spec/eee_spec.rb
@@ -0,0 +1,40 @@
ENV['RACK_ENV'] = 'test'

require 'eee'
require 'spec'
require 'spec/interop/test'
require 'sinatra/test'

require 'webrat'
Spec::Runner.configure do |config|
config.include Webrat::Matchers, :type => :views
end

describe 'GET /recipes/permalink' do
include Sinatra::Test

before(:all) do
RestClient.put @@db, { }
end

after(:all) do
RestClient.delete @@db
end

before (:each) do
@date = Date.today
@title = "Recipe Title"
@permalink = @date.to_s + "-" + @title.downcase.gsub(/\W/, '-')

RestClient.put "#{@@db}/#{@permalink}",
{ :title => @title,
:date => @date }.to_json,
:content_type => 'application/json'
end

it "should include a title" do
get "/recipes/#{@permalink}"
response.should be_ok
response.should have_selector("h1", :content => @title)
end
end

0 comments on commit ee0e193

Please sign in to comment.