This repository has been archived by the owner on Feb 5, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
95 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--color | ||
--format=nested |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'bundler' | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new(:test) do |t| | ||
t.pattern = 'spec/*_spec.rb' | ||
t.verbose = false | ||
end | ||
|
||
task :default => :test | ||
|
||
task :environment do | ||
require './app' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Application' do | ||
it 'should respond to /' do | ||
get '/' | ||
last_response.status.should == 200 | ||
end | ||
|
||
it 'should render the content on /render' do | ||
post '/render' | ||
|
||
last_response.status.should == 400 | ||
last_response.body.should match(/Content required/) | ||
|
||
post '/render', :content => "Hello world" | ||
last_response.status.should == 400 | ||
last_response.body.should match(/Markup required/) | ||
|
||
post '/render', :content => "Hello world", :markup => 'invalidmarkup' | ||
last_response.status.should == 400 | ||
last_response.body.should match(/Invalid markup/) | ||
|
||
%w(markdown textile rdoc).each do |m| | ||
post '/render', :content => "Hello world", :markup => m | ||
last_response.status.should == 200 | ||
last_response.body.should match(/Hello world/) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
$:.unshift File.expand_path("../..", __FILE__) | ||
|
||
require 'app' | ||
require 'webmock' | ||
require 'webmock/rspec' | ||
require 'rack/test' | ||
|
||
set :environment, :test | ||
|
||
RSpec.configure do |conf| | ||
conf.include Rack::Test::Methods | ||
end | ||
|
||
def app | ||
Sinatra::Application | ||
end | ||
|
||
def fixture_path | ||
File.expand_path("../fixtures", __FILE__) | ||
end | ||
|
||
def fixture(file) | ||
File.read(File.join(fixture_path, file)) | ||
end | ||
|
||
def basecamp(opts={}) | ||
Services::Basecamp.new(opts) | ||
end | ||
|
||
def campfire(opts={}) | ||
Services::Campfire.new(opts) | ||
end | ||
|
||
def postbin(opts={}) | ||
Services::Postbin.new(opts) | ||
end |