Skip to content

Commit 3241f2f

Browse files
committed
Replace FakeWeb with WebMock
1 parent e0be555 commit 3241f2f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ end
1515
group :test do
1616
gem 'childlabor'
1717
gem 'coveralls', '>= 0.5.7'
18-
gem 'fakeweb', '>= 1.3'
18+
gem 'webmock', '>= 1.20'
1919
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
2020
gem 'rspec', '>= 3'
2121
gem 'rspec-mocks', '>= 3'

spec/actions/file_manipulation_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,20 @@ def file
138138

139139
it "accepts http remote sources" do
140140
body = "__start__\nHTTPFILE\n__end__\n"
141-
FakeWeb.register_uri(:get, "http://example.com/file.txt", :body => body)
141+
stub_request(:get, "http://example.com/file.txt").to_return(:body => body)
142142
action :get, "http://example.com/file.txt" do |content|
143+
expect(a_request(:get, "http://example.com/file.txt")).to have_been_made
143144
expect(content).to eq(body)
144145
end
145-
FakeWeb.clean_registry
146146
end
147147

148148
it "accepts https remote sources" do
149149
body = "__start__\nHTTPSFILE\n__end__\n"
150-
FakeWeb.register_uri(:get, "https://example.com/file.txt", :body => body)
150+
stub_request(:get, "https://example.com/file.txt").to_return(:body => body)
151151
action :get, "https://example.com/file.txt" do |content|
152+
expect(a_request(:get, "https://example.com/file.txt")).to have_been_made
152153
expect(content).to eq(body)
153154
end
154-
FakeWeb.clean_registry
155155
end
156156
end
157157

spec/helper.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
require "rdoc"
2121
require "rspec"
2222
require "diff/lcs" # You need diff/lcs installed to run specs (but not to run Thor).
23-
require "fakeweb" # You need fakeweb installed to run specs (but not to run Thor).
23+
require "webmock/rspec"
24+
25+
WebMock.disable_net_connect!(:allow => "coveralls.io")
26+
2427

2528
# Set shell to basic
2629
$0 = "thor"

0 commit comments

Comments
 (0)