diff --git a/octopress/octopress.gemspec b/octopress/octopress.gemspec index 923817b..a9ec927 100644 --- a/octopress/octopress.gemspec +++ b/octopress/octopress.gemspec @@ -23,5 +23,6 @@ bin/octopress s.add_development_dependency('rake') s.add_development_dependency('rdoc') 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 diff --git a/octopress/spec/octopress/commands/create_spec.rb b/octopress/spec/octopress/commands/create_spec.rb index 5d76852..d712ecc 100644 --- a/octopress/spec/octopress/commands/create_spec.rb +++ b/octopress/spec/octopress/commands/create_spec.rb @@ -3,14 +3,16 @@ require 'spec_helper' describe Octopress::Commands::Create do include FakeFS::SpecHelpers + let(:url) { 'http://hostname.com/myfile.txt' } let(:project_path) { File.expand_path File.join('tmp', 'create') } subject { described_class.new(project_path) } it 'downloads to tmp location in project_path' do - download_path = subject.download 'https://github.com/octopress/theme-classic/zipball/master', 'theme-classic.zip' - download_path.should == File.join(project_path, 'tmp', 'theme-classic.zip') + stub_request(:get, url).to_return(body:'my file') + 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.size(download_path).should > 0 + File.read(download_path).should == 'my file' end end diff --git a/octopress/spec/spec_helper.rb b/octopress/spec/spec_helper.rb index 9ed1610..01032d0 100644 --- a/octopress/spec/spec_helper.rb +++ b/octopress/spec/spec_helper.rb @@ -1,2 +1,3 @@ require 'fakefs/spec_helpers' +require 'webmock/rspec' require 'octopress'