-
Notifications
You must be signed in to change notification settings - Fork 15
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
6 changed files
with
102 additions
and
26 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 |
---|---|---|
@@ -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 |
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
Empty file.
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,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 |
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,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 |