Skip to content

Commit

Permalink
Move dev/test dependencies to gemfile and remoce mocha dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanshasselberg committed Jul 31, 2012
1 parent 0dfa713 commit e7bd153
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 40 deletions.
18 changes: 17 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
source :rubygems

gemspec

gem "rake"

group :development, :test do
gem "rspec", "~> 2.11"

gem "sinatra", "~> 1.3"
gem "json"

if RUBY_PLATFORM == "java"
gem "spoon"
end

unless ENV["CI"]
gem "guard-rspec", "~> 0.7"
end
end
10 changes: 0 additions & 10 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))

if RUBY_VERSION =~ /1.9/ && RUBY_ENGINE == 'ruby'
require 'simplecov'

SimpleCov.start do
add_filter 'spec'
end
end

require "bundler"
Bundler.setup
require "typhoeus"
Expand All @@ -23,8 +15,6 @@
Dir['./spec/support/**/*.rb'].each { |f| require f }

RSpec.configure do |config|
config.mock_with(:mocha)

config.before(:suite) do
Boot.start_servers
end
Expand Down
8 changes: 5 additions & 3 deletions spec/typhoeus/hydras/easy_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let(:easy_factory) { described_class.new(request, hydra) }

it "sets easy.on_complete callback" do
easy_factory.easy.expects(:on_complete)
easy_factory.easy.should_receive(:on_complete)
easy_factory.set_callback
end

Expand All @@ -22,7 +22,7 @@

it "resets easy" do
easy_factory.set_callback
easy_factory.easy.expects(:reset)
easy_factory.easy.should_receive(:reset)
easy_factory.easy.complete
end

Expand All @@ -40,7 +40,9 @@
end

it "runs requests complete callback" do
request.instance_variable_set(:@on_complete, [mock(:call)])
callback = mock(:call)
callback.should_receive(:call)
request.instance_variable_set(:@on_complete, [callback])
easy_factory.set_callback
easy_factory.easy.complete
end
Expand Down
4 changes: 2 additions & 2 deletions spec/typhoeus/hydras/easy_pool_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

describe "#release_easy" do
it "resets easy" do
easy.expects(:reset)
easy.should_receive(:reset)
Typhoeus.release_easy(easy)
end

Expand All @@ -33,7 +33,7 @@

context "when no easy in pool" do
it "creates" do
Ethon::Easy.expects(:new)
Ethon::Easy.should_receive(:new)
Typhoeus.get_easy
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/typhoeus/hydras/memoizable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

it "doesn't call complete" do
request.expects(:complete).never
request.should_receive(:complete).never
hydra.queue(request)
end
end
Expand All @@ -32,12 +32,12 @@
end

it "sets response via instance_variable_set to avoid short circuit" do
request.expects(:instance_variable_set).with(:@response, response)
request.should_receive(:instance_variable_set).with(:@response, response)
hydra.queue(request)
end

it "calls complete" do
request.expects(:complete)
request.should_receive(:complete)
hydra.queue(request)
end
end
Expand All @@ -46,7 +46,7 @@

describe "#run" do
it "clears memory before starting" do
hydra.memory.expects(:clear)
hydra.memory.should_receive(:clear)
hydra.run
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/typhoeus/hydras/queueable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
let(:options) { { :max_concurrency => 10 } }

it "adds to multi" do
hydra.multi.expects(:add)
hydra.multi.should_receive(:add)
hydra.queue(request)
end
end
Expand All @@ -30,7 +30,7 @@
let(:options) { { :max_concurrency => 0 } }

it "doesn't add to multi" do
hydra.multi.expects(:add).never
hydra.multi.should_receive(:add).never
hydra.queue(request)
end

Expand Down
6 changes: 3 additions & 3 deletions spec/typhoeus/hydras/runnable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let(:requests) { [] }

it "does nothing" do
hydra.multi.expects(:perform)
hydra.multi.should_receive(:perform)
hydra.run
end
end
Expand All @@ -24,7 +24,7 @@
let(:requests) { [first] }

it "runs multi#perform" do
hydra.multi.expects(:perform)
hydra.multi.should_receive(:perform)
hydra.run
end

Expand All @@ -41,7 +41,7 @@
let(:requests) { [first, second, third] }

it "runs multi#perform" do
hydra.multi.expects(:perform)
hydra.multi.should_receive(:perform)
hydra.run
end

Expand Down
14 changes: 8 additions & 6 deletions spec/typhoeus/requests/operations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@

describe "#run" do
let(:easy) { Ethon::Easy.new }
before { Typhoeus.expects(:get_easy).returns(easy) }
before { Typhoeus.should_receive(:get_easy).and_return(easy) }

it "grabs an easy" do
request.run
end

it "generates settings" do
easy.expects(:http_request)
easy.should_receive(:http_request)
request.run
end

it "prepares" do
easy.expects(:prepare)
easy.should_receive(:prepare)
request.run
end

it "performs" do
easy.expects(:perform)
easy.should_receive(:perform)
request.run
end

Expand All @@ -33,12 +33,14 @@
end

it "releases easy" do
Typhoeus.expects(:release_easy)
Typhoeus.should_receive(:release_easy)
request.run
end

it "calls on_complete" do
request.instance_variable_set(:@on_complete, [mock(:call)])
callback = mock(:call)
callback.should_receive(:call)
request.instance_variable_set(:@on_complete, [callback])
request.run
end

Expand Down
9 changes: 0 additions & 9 deletions typhoeus.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ Gem::Specification.new do |s|

s.add_dependency('ethon', ["~> 0.4.2"])

s.add_development_dependency('sinatra', ['~> 1.3'])
s.add_development_dependency('json', ['~> 1.7'])
s.add_development_dependency('rake', ['~> 0.9'])
s.add_development_dependency("mocha", ["~> 0.11.4"])
s.add_development_dependency("rspec", ["~> 2.10"])
s.add_development_dependency("guard-rspec", ["~> 1.1.0"])
s.add_development_dependency('spoon') if RUBY_PLATFORM == "java"
s.add_development_dependency 'simplecov', '~> 0.5.3'

s.files = Dir.glob("lib/**/*") + %w(CHANGELOG.md Gemfile LICENSE README.md Rakefile)
s.require_path = 'lib'
end

0 comments on commit e7bd153

Please sign in to comment.