Skip to content
Browse files

Addition of rspec tests

  • Loading branch information...
1 parent 0816831 commit b0d5f7b701a267953b6c7b5a4c640fc324ab1673 @coldfumonkeh committed Mar 7, 2012
Showing with 34 additions and 0 deletions.
  1. +2 −0 .autotest
  2. +2 −0 .rspec
  3. +1 −0 settings.xml
  4. +29 −0 spec/application_spec.rb
View
2 .autotest
@@ -0,0 +1,2 @@
+require 'autotest/growl'
+#require 'autotest/fsevent'
View
2 .rspec
@@ -0,0 +1,2 @@
+--format nested
+--color
View
1 settings.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" ?><ResourceDetails><ServerName></ServerName><LauncherName></LauncherName><ExternalBrowser></ExternalBrowser><UseStartPage>false</UseStartPage><StartPage useextension="false" ></StartPage><Mappings></Mappings><VariableMappings></VariableMappings></ResourceDetails>
View
29 spec/application_spec.rb
@@ -0,0 +1,29 @@
+require_relative '../application.rb'
+require 'rack/test'
+
+set :environment, :test
+
+def app
+ Sinatra::Application
+end
+
+describe 'URL Shortening Service' do
+
+ include Rack::Test::Methods
+
+ it "should load the home page" do
+ get '/'
+ last_response.should be_ok
+ end
+
+ it "should obtain a shortened URL from the query param" do
+ get '/?url=http://www.google.com'
+ last_response.should be_ok
+ end
+
+ it "should fail when trying to expand a hash that hasnt been sent" do
+ get '/expand/'
+ last_response.should_not be_ok
+ end
+
+end

0 comments on commit b0d5f7b

Please sign in to comment.
Something went wrong with that request. Please try again.