Skip to content

Commit

Permalink
Merge branch 'release/0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
potomak committed May 7, 2012
2 parents ffbbc1e + 65f473a commit 5b546bb
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 26 deletions.
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
source :gemcutter

gem 'goliath', :git => 'git://github.com/postrank-labs/goliath.git'
gem 'goliath', '0.9.4'
gem 'em-http-request', '1.0.2'
gem 'em-synchrony', '1.0.1'
gem 'artii'
gem 'rake'

group :development, :test do
gem 'rspec'
gem 'foreman'
end
end
48 changes: 25 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
GIT
remote: git://github.com/postrank-labs/goliath.git
revision: 9c1e0383bc91c6088986a0f71e063b95f804aba2
specs:
goliath (0.9.4)
async-rack
em-synchrony (>= 1.0.0)
em-websocket
eventmachine (>= 1.0.0.beta.3)
http_parser.rb (~> 0.5.3)
http_router (~> 0.9.0)
log4r
multi_json
rack (>= 1.2.2)
rack-contrib
rack-respond_to

GEM
remote: http://rubygems.org/
specs:
addressable (2.2.6)
addressable (2.2.8)
artii (2.0.0)
artii
async-rack (0.5.1)
rack (~> 1.1)
cookiejar (0.3.0)
diff-lcs (1.1.3)
em-http-request (1.0.2)
addressable (>= 2.2.3)
cookiejar
em-socksify
eventmachine (>= 1.0.0.beta.4)
http_parser.rb (>= 0.5.3)
em-socksify (0.2.0)
eventmachine (>= 1.0.0.beta.4)
em-synchrony (1.0.1)
eventmachine (>= 1.0.0.beta.1)
em-websocket (0.3.6)
addressable (>= 2.1.1)
eventmachine (>= 0.12.9)
eventmachine (1.0.0.beta.4)
foreman (0.41.0)
thor (>= 0.13.6)
goliath (0.9.4)
async-rack
em-synchrony (>= 1.0.0)
eventmachine (>= 1.0.0.beta.3)
http_parser.rb
http_router (~> 0.9.0)
log4r
multi_json
rack (>= 1.2.2)
rack-contrib
rack-respond_to
http_parser.rb (0.5.3)
http_router (0.9.7)
rack (>= 1.0.0)
url_mount (~> 0.2.1)
log4r (1.1.10)
multi_json (1.0.4)
multi_json (1.3.4)
rack (1.4.1)
rack-accept-media-types (0.9)
rack-contrib (1.1.0)
Expand All @@ -62,7 +62,9 @@ PLATFORMS

DEPENDENCIES
artii
em-http-request (= 1.0.2)
em-synchrony (= 1.0.1)
foreman
goliath!
goliath (= 0.9.4)
rake
rspec
2 changes: 1 addition & 1 deletion artii_api.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'goliath'
require 'artii'

VERSION = '0.1.1'.freeze
VERSION = '0.1.2'.freeze

class MakeAsciiArt < Goliath::API
use Goliath::Rack::Params
Expand Down
Empty file removed spec/integration/.gitkeep
Empty file.
17 changes: 17 additions & 0 deletions spec/integration/fonts_list_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

describe FontsList do
before do
@artii = Object.new
@artii.should_receive(:all_fonts).and_return({'font 1' => nil, 'font 2' => nil})
Artii::Base.should_receive(:new).and_return(@artii)
end

it 'renders a list of fonts' do
with_api(FontsList) do
get_request(path: '/fonts_list') do |c|
c.response.should == "font 1\nfont 2"
end
end
end
end
55 changes: 55 additions & 0 deletions spec/integration/make_ascii_art_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
require 'spec_helper'

describe MakeAsciiArt do
before do
@text = 'ascii+art'
@font = 'my_font'
@expected = 'ASCII ART'
@artii = Object.new
end

context 'without text' do
before do
Artii::Base.should_receive(:new).with({}).and_return(@artii)
@artii.should_receive(:asciify).with('')
end

it 'renders an empty string' do
with_api(MakeAsciiArt) do
get_request(path: '/make') do |c|
c.response.should == ''
end
end
end
end

context 'with text' do
before do
Artii::Base.should_receive(:new).with({}).and_return(@artii)
@artii.should_receive(:asciify).with(@text).and_return(@expected)
end

it 'renders ascii art' do
with_api(MakeAsciiArt) do
get_request(path: '/make', query: {text: @text}) do |c|
c.response.should == @expected
end
end
end
end

context 'with text and font' do
before do
Artii::Base.should_receive(:new).with({font: @font}).and_return(@artii)
@artii.should_receive(:asciify).with(@text).and_return(@expected)
end

it 'renders ascii art' do
with_api(MakeAsciiArt) do
get_request(path: '/make', query: {text: @text, font: @font}) do |c|
c.response.should == @expected
end
end
end
end
end

0 comments on commit 5b546bb

Please sign in to comment.