mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-10-31 23:35:00 -04:00
Stubbing web call.
This commit is contained in:
parent
7181a5a8bf
commit
50719f03a7
@ -23,5 +23,6 @@ bin/octopress
|
|||||||
s.add_development_dependency('rake')
|
s.add_development_dependency('rake')
|
||||||
s.add_development_dependency('rdoc')
|
s.add_development_dependency('rdoc')
|
||||||
s.add_development_dependency('fakefs')
|
s.add_development_dependency('fakefs')
|
||||||
s.add_development_dependency('aruba', '0.4.10')
|
s.add_development_dependency('webmock')
|
||||||
|
s.add_development_dependency('aruba', '0.4.11')
|
||||||
end
|
end
|
||||||
|
@ -3,14 +3,16 @@ require 'spec_helper'
|
|||||||
describe Octopress::Commands::Create do
|
describe Octopress::Commands::Create do
|
||||||
include FakeFS::SpecHelpers
|
include FakeFS::SpecHelpers
|
||||||
|
|
||||||
|
let(:url) { 'http://hostname.com/myfile.txt' }
|
||||||
let(:project_path) { File.expand_path File.join('tmp', 'create') }
|
let(:project_path) { File.expand_path File.join('tmp', 'create') }
|
||||||
|
|
||||||
subject { described_class.new(project_path) }
|
subject { described_class.new(project_path) }
|
||||||
|
|
||||||
it 'downloads to tmp location in project_path' do
|
it 'downloads to tmp location in project_path' do
|
||||||
download_path = subject.download 'https://github.com/octopress/theme-classic/zipball/master', 'theme-classic.zip'
|
stub_request(:get, url).to_return(body:'my file')
|
||||||
download_path.should == File.join(project_path, 'tmp', 'theme-classic.zip')
|
download_path = subject.download url, 'thename.txt'
|
||||||
|
download_path.should == File.join(project_path, 'tmp', 'thename.txt')
|
||||||
File.exists?(download_path).should be_true
|
File.exists?(download_path).should be_true
|
||||||
File.size(download_path).should > 0
|
File.read(download_path).should == 'my file'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
require 'fakefs/spec_helpers'
|
require 'fakefs/spec_helpers'
|
||||||
|
require 'webmock/rspec'
|
||||||
require 'octopress'
|
require 'octopress'
|
||||||
|
Loading…
Reference in New Issue
Block a user