Skip to content

Commit

Permalink
reset fakeweb after test
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoriz committed Mar 2, 2013
1 parent 3e12eec commit 12bd638
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions features/hetzner.feature
Expand Up @@ -12,6 +12,7 @@ Feature: Hetzner
When I run `hetzner failover --username='myusername' --password='mycoolpassword'`
Then the output should contain "active_server_ip"

@wip
Scenario: Display the status of a failover IP
When I run `hetzner failover 11.11.11.111 --username='myusername' --password='mycoolpassword'`
Then the output should contain "11.11.11.111"
Expand Down
6 changes: 6 additions & 0 deletions features/support/env.rb
@@ -1,10 +1,16 @@
require 'coveralls'
Coveralls.wear!

require 'fakeweb'
require File.expand_path('../../../spec/spec_constants.rb', __FILE__)
require File.expand_path('../../../spec/api_stubs.rb', __FILE__)

ENV['HETZNER_API_CUCUMBER_TEST'] = "1"

# This long timeout is needed for jruby, as each step launches a jruby instance for the cli
#
Before do
@aruba_timeout_seconds = 60
FakeWeb.allow_net_connect = false
end

4 changes: 1 addition & 3 deletions spec/api_stubs.rb
Expand Up @@ -15,8 +15,6 @@ def uri(path = nil, args = nil)
end


FakeWeb.allow_net_connect = false


@resource = 'reset'

Expand Down Expand Up @@ -177,4 +175,4 @@ def uri(path = nil, args = nil)

FakeWeb.register_uri :post, uri("#{FAILOVER_IP}?active_server_ip=#{WORKING_IP_2}"),
:response => fixture('post_with_active_server_ip.raw')
#pp FakeWeb::Registry.instance.uri_map
#pp FakeWeb::Registry.instance.uri_map
10 changes: 10 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -4,6 +4,16 @@
require "spec_constants"
require "api_stubs"

RSpec.configure do |c|
c.before(:suite) do
FakeWeb.allow_net_connect = false
end
c.after(:suite) do
FakeWeb.allow_net_connect = true
end
end


RSpec::Matchers.define :have_JSON_error_code do |expected|
match do |actual|
actual['error']['code'] == expected.to_s
Expand Down

0 comments on commit 12bd638

Please sign in to comment.