Permalink
Browse files

Standardize RSpec support class names

  • Loading branch information...
weppos committed Feb 16, 2012
1 parent a189de0 commit 230721833c5137a7301666f4f505f839b1a804bd
Showing with 23 additions and 28 deletions.
  1. +1 −1 spec/spec_helper.rb
  2. +2 −2 spec/support/helpers/connectivity_helper.rb
  3. +20 −25 spec/support/helpers/spec_helper.rb
View
@@ -8,7 +8,7 @@
# The fixtures are UTF-8 encoded.
# Make sure Ruby uses the proper encoding.
if RUBY_VERSION < '1.9'
- $KCODE='u'
+ $KCODE = 'u'
else
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
@@ -1,4 +1,4 @@
-module ConnectivityHelper
+module RSpecSupportConnectivityHelpers
def need_connectivity
if connectivity_available?
yield
@@ -11,5 +11,5 @@ def connectivity_available?
end
RSpec.configure do |config|
- config.extend ConnectivityHelper
+ config.extend RSpecSupportConnectivityHelpers
end
@@ -1,4 +1,4 @@
-module Helper
+module RSpecSupportSpecHelpers
# Gets the currently described class.
# Conversely to +subject+, it returns the class
@@ -11,38 +11,33 @@ def fixture(*names)
File.join(SPEC_ROOT, "fixtures", *names)
end
-end
-
-module SpecHelper
-
private
- # Temporary resets Server @@definitions
- # to let the test setup a custom definition list.
- def with_definitions
- definitions_setup
- yield
- ensure
- definitions_teardown
- end
+ # Temporary resets Server @@definitions
+ # to let the test setup a custom definition list.
+ def with_definitions
+ definitions_setup
+ yield
+ ensure
+ definitions_teardown
+ end
- def definitions_setup
- @_definitions = Whois::Server.definitions
- Whois::Server.send :class_variable_set, :@@definitions, { :tld => [], :ipv4 =>[], :ipv6 => [] }
- end
+ def definitions_setup
+ @_definitions = Whois::Server.definitions
+ Whois::Server.send :class_variable_set, :@@definitions, { :tld => [], :ipv4 =>[], :ipv6 => [] }
+ end
- def definitions_teardown
- Whois::Server.send :class_variable_set, :@@definitions, @_definitions
- end
+ def definitions_teardown
+ Whois::Server.send :class_variable_set, :@@definitions, @_definitions
+ end
- def nameserver(*params)
- Whois::Record::Nameserver.new(*params)
- end
+ def nameserver(*params)
+ Whois::Record::Nameserver.new(*params)
+ end
end
RSpec.configure do |config|
- config.include Helper
- config.include SpecHelper
+ config.include RSpecSupportSpecHelpers
end

0 comments on commit 2307218

Please sign in to comment.