Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add tests for shorten option

  • Loading branch information...
commit 9bf41b7382feb3f010af2294413511c81cc02d3a 1 parent af2c0d1
@dlo dlo authored
Showing with 17 additions and 1 deletion.
  1. +3 −1 Gemfile
  2. +11 −0 spec/shorten_spec.rb
  3. +3 −0  spec/spec_helper.rb
View
4 Gemfile
@@ -1,3 +1,5 @@
source :rubygems
-gemspec
+gemspec
+extensions
+webmock
View
11 spec/shorten_spec.rb
@@ -0,0 +1,11 @@
+describe '...' do
+ before do
+ stub_request(:post, /api\.github.com\/gists\?access_token=.*/).to_return(:body => '{"html_url": "http://github.com/"}')
+ stub_request(:post, "http://git.io/").to_return(:status => 201, :headers => { 'Location' => 'http://git.io/XXXXXX' })
+ end
+
+ it "should return a shortened version of the URL" do
+ Jist.gist("Test gist", :shorten => true).should == {"html_url" => "http://git.io/XXXXXX"}
+ end
+end
+
View
3  spec/spec_helper.rb
@@ -10,4 +10,7 @@
config.filter_run :focus
end
+require 'extensions/all'
+require 'webmock/rspec'
require_relative '../lib/jist'
+
Please sign in to comment.
Something went wrong with that request. Please try again.