Permalink
Browse files

using rspec and stuff

  • Loading branch information...
rsanheim committed Nov 27, 2011
1 parent 73d54e4 commit 66d425b4338ecc6bfe5a816381e5e23727163452
Showing with 33 additions and 8 deletions.
  1. +2 −0 Gemfile
  2. +12 −0 Gemfile.lock
  3. +10 −0 Rakefile
  4. +9 −8 spec/app_spec.rb
View
@@ -1,4 +1,5 @@
source "http://rubygems.org"
+gem "rake"
gem "rack"
gem "sinatra", "1.1.2", :require => "sinatra"
gem "haml"
@@ -11,4 +12,5 @@ gem "heroku"
group :test do
gem "rack-test"
gem "mocha"
+ gem "rspec"
end
View
@@ -3,6 +3,7 @@ GEM
specs:
addressable (2.2.6)
crack (0.3.1)
+ diff-lcs (1.1.3)
emk-sinatra-url-for (0.2.1)
sinatra (>= 0.9.1.1)
faraday (0.7.5)
@@ -35,8 +36,17 @@ GEM
rack (1.2.1)
rack-test (0.6.1)
rack (>= 1.0)
+ rake (0.9.2.2)
rest-client (1.6.7)
mime-types (>= 1.16)
+ rspec (2.7.0)
+ rspec-core (~> 2.7.0)
+ rspec-expectations (~> 2.7.0)
+ rspec-mocks (~> 2.7.0)
+ rspec-core (2.7.1)
+ rspec-expectations (2.7.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.7.0)
rubyzip (0.9.4)
simple_oauth (0.1.5)
sinatra (1.1.2)
@@ -70,6 +80,8 @@ DEPENDENCIES
mocha
rack
rack-test
+ rake
+ rspec
sinatra (= 1.1.2)
sinatra-static-assets
swish
View
@@ -0,0 +1,10 @@
+require 'rubygems'
+require "bundler/setup"
+# require File.join(File.dirname(__FILE__), *%w[lib nachos version])
+
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:spec)
+
+task :default => [:spec]
+
View
@@ -2,26 +2,27 @@
Bundler.require(:test)
ENV['RACK_ENV'] = 'test'
require 'app'
-require 'test/unit'
+require 'rspec'
require 'mocha'
require 'rack/test'
-class AppTest < Test::Unit::TestCase
- include Mocha::API
- include Rack::Test::Methods
+RSpec.configure do |conf|
+ conf.include Rack::Test::Methods
+ conf.mock_with :mocha
+end
+describe "the App" do
def app
Sinatra::Application
end
- def test_good_response
+ it "has a good response" do
get '/'
- assert last_response.ok?
+ last_response.should be_ok
end
- def test_grabs_latest_tweet
+ it "grabs the latest tweet" do
foo = mock(:foo => "bar")
- foo.bar
# app.expects(:last_tweet).returns("this is a tweet!")
get "/"
# assert last_response.body.include?("this is a tweet!")

0 comments on commit 66d425b

Please sign in to comment.