Skip to content

Commit

Permalink
fixed and refactored specs to use rspec2 and follow conventions. also…
Browse files Browse the repository at this point in the history
… moved integration specs into their own repository.
  • Loading branch information
rubiii committed Sep 1, 2010
1 parent 5972d94 commit f6f7e0c
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 153 deletions.
5 changes: 0 additions & 5 deletions .autotest

This file was deleted.

1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--colour
53 changes: 8 additions & 45 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,13 @@
require "rake"
require "spec/rake/spectask"
require "spec/rake/verify_rcov"

task :default => :spec

Spec::Rake::SpecTask.new do |spec|
spec.spec_files = FileList["spec/{savon}/**/*_spec.rb"]
spec.spec_opts << "--color"
spec.libs += ["lib", "spec"]
spec.rcov = true
end

RCov::VerifyTask.new(:spec_verify => :spec) do |verify|
verify.threshold = 100.0
verify.index_html = "rcov/index.html"
end

desc "Run integration specs using WEBrick"
task :spec_integration do
pid = fork { exec "ruby spec/integration/server.rb" }
sleep 10 # wait until the server is actually ready
begin
task(:run_integration_spec).invoke
ensure
Process.kill "TERM", pid
Process.wait pid
end
end

desc "" # make this task invisible
Spec::Rake::SpecTask.new(:run_integration_spec) do |spec|
spec.spec_files = FileList["spec/{integration}/**/*_spec.rb"]
spec.spec_opts << "--color"
spec.libs += ["lib", "spec"]
end

begin
require "hanna/rdoctask"
require "rspec/core/rake_task"

Rake::RDocTask.new do |rdoc|
rdoc.title = "Savon - Heavy metal Ruby SOAP client library"
rdoc.rdoc_dir = "doc"
rdoc.rdoc_files.include("**/*.rdoc").include("lib/**/*.rb")
rdoc.options << "--line-numbers"
rdoc.options << "--webcvs=http://github.com/rubiii/savon/tree/master/"
RSpec::Core::RakeTask.new do |t|
t.spec_opts = %w(-fd -c)
end
rescue LoadError
puts "'gem install hanna' for documentation"
task :spec do
abort "Run 'gem install rspec --pre' to be able to run specs"
end
end

task :default => :spec
1 change: 1 addition & 0 deletions autotest/discover.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Autotest.add_discovery { "rspec2" }
1 change: 1 addition & 0 deletions discover.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Autotest.add_discovery { "rspec2" }
11 changes: 0 additions & 11 deletions spec/basic_spec_helper.rb

This file was deleted.

16 changes: 0 additions & 16 deletions spec/integration/http_basic_auth_spec.rb

This file was deleted.

51 changes: 0 additions & 51 deletions spec/integration/server.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/savon/core_ext/datetime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe DateTime do
before do
@datetime = DateTime.new 2012, 03, 22, 16, 22, 33
@datetime_string = "2012-03-22T16:22:33Z"
@datetime_string = "2012-03-22T16:22:33+00:00"
end

describe "to_soap_value" do
Expand Down
6 changes: 3 additions & 3 deletions spec/savon/core_ext/hash_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

it "should convert DateTime objects to xs:dateTime compliant Strings" do
hash = { :before => DateTime.new(2012, 03, 22, 16, 22, 33) }
result = "<before>2012-03-22T16:22:33Z</before>"
result = "<before>2012-03-22T16:22:33+00:00</before>"

hash.to_soap_xml.should == result
end
Expand All @@ -67,7 +67,7 @@ def singleton.to_datetime
DateTime.new(2012, 03, 22, 16, 22, 33)
end

hash, result = { :before => singleton }, "<before>2012-03-22T16:22:33Z</before>"
hash, result = { :before => singleton }, "<before>2012-03-22T16:22:33+00:00</before>"
hash.to_soap_xml.should == result
end

Expand Down Expand Up @@ -166,7 +166,7 @@ def singleton.to_datetime
end

it "should convert Hash values matching the xs:dateTime format into DateTime Objects" do
soap_response = { "response" => { "at" => "2012-03-22T16:22:33" } }
soap_response = { "response" => { "at" => "2012-03-22T16:22:33+00:00" } }
result = { :response => { :at => DateTime.new(2012, 03, 22, 16, 22, 33) } }

soap_response.map_soap_response.should == result
Expand Down
2 changes: 1 addition & 1 deletion spec/savon/core_ext/object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def singleton.to_datetime
DateTime.new(2012, 03, 22, 16, 22, 33)
end

singleton.to_soap_value.should == "2012-03-22T16:22:33Z"
singleton.to_soap_value.should == "2012-03-22T16:22:33+00:00"
end

it "calls to_s unless the Object responds to to_datetime" do
Expand Down
2 changes: 1 addition & 1 deletion spec/savon/soap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Savon::SOAP::DateTimeFormat.should_not be_empty

DateTime.new(2012, 03, 22, 16, 22, 33).strftime(Savon::SOAP::DateTimeFormat).
should == "2012-03-22T16:22:33Z"
should == "2012-03-22T16:22:33+00:00"
end

it "should contain a Regexp matching the xs:dateTime format" do
Expand Down
19 changes: 8 additions & 11 deletions spec/savon/wsse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
@wsse.password = @password
header = @wsse.header

header.should include_security_namespaces
header.should include(Savon::WSSE::WSENamespace)
header.should include(Savon::WSSE::WSUNamespace)
header.should include(@username)
header.should include(@password)
header.should include(Savon::WSSE::PasswordTextURI)
Expand All @@ -88,7 +89,8 @@
Savon::WSSE.password = @password
header = @wsse.header

header.should include_security_namespaces
header.should include(Savon::WSSE::WSENamespace)
header.should include(Savon::WSSE::WSUNamespace)
header.should include(@username)
header.should include(@password)
header.should include(Savon::WSSE::PasswordTextURI)
Expand All @@ -102,7 +104,8 @@
@wsse.digest = true
header = @wsse.header

header.should include_security_namespaces
header.should include(Savon::WSSE::WSENamespace)
header.should include(Savon::WSSE::WSUNamespace)
header.should include(@username)
header.should_not include(@password)
header.should include(Savon::WSSE::PasswordDigestURI)
Expand All @@ -114,19 +117,13 @@
Savon::WSSE.digest = true
header = @wsse.header

header.should include_security_namespaces
header.should include(Savon::WSSE::WSENamespace)
header.should include(Savon::WSSE::WSUNamespace)
header.should include(@username)
header.should_not include(@password)
header.should include(Savon::WSSE::PasswordDigestURI)
end
end

def include_security_namespaces
simple_matcher("include security namespaces") do |given|
given.should include(Savon::WSSE::WSENamespace)
given.should include(Savon::WSSE::WSUNamespace)
end
end
end

end
4 changes: 0 additions & 4 deletions spec/spec.opts

This file was deleted.

20 changes: 16 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
require "basic_spec_helper"
require "rspec"
require "mocha"
require "fakeweb"

FileList["spec/fixtures/**/*.rb"].each { |fixture| require fixture }
require "endpoint_helper"
require "http_stubs"
RSpec.configure do |config|
config.mock_with :mocha
end

require "savon"
Savon::Request.log = false

# Requires fixtures.
Dir["spec/fixtures/**/*.rb"].each {|file| require file }

# Requires supporting files.
require "support/endpoint_helper"
require "support/http_stubs"
File renamed without changes.
File renamed without changes.

0 comments on commit f6f7e0c

Please sign in to comment.