Skip to content

Commit

Permalink
Fixed failing spec and used alias_method instead of defining the same…
Browse files Browse the repository at this point in the history
… method twice
  • Loading branch information
jeremydurham committed Nov 27, 2010
1 parent cd55ede commit 586b39b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/service_proxy/client.rb
Expand Up @@ -78,9 +78,8 @@ def generate_methods
call_service(options.update(:method => service_method))
end

self.class.send(:define_method, ServiceProxy::Utils.underscore(service_method)) do |*args|
options = args.pop || {}
call_service(options.update(:method => service_method))
self.class.class_eval do
alias_method :"#{ServiceProxy::Utils.underscore(service_method)}", "#{service_method}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/service_proxy_spec.rb
Expand Up @@ -21,8 +21,8 @@
@proxy = proxy = ServiceProxy::Client.new('http://webservices.daehosting.com/services/isbnservice.wso?WSDL')
end

it "should not require build or parse methods" do
@proxy.IsValidISBN13(:isbn => '978-0977616633').should == 'true'
it "should not raise an error without a build or parse method" do
lambda { @proxy.IsValidISBN13(:sISBN => '978-0977616633') }.should_not raise_error
end

it "should not use method_missing to call the service" do
Expand Down

0 comments on commit 586b39b

Please sign in to comment.