Skip to content

Commit

Permalink
Fix library loading for BackendController and its spec.
Browse files Browse the repository at this point in the history
ActionWebService::Protocol::Discovery uses write_inheritable_array to
register protocols. Due to the order of library loading, during testing
only, the ApplicationController class would be created before
ActionWebService::Protocol::XmlRpc was registered in
ActionController::Base. This meant BackendController needed to include
ActionWebService::Protocol::XmlRpc again in the specs to register it.

By requiring 'action_web_service' in environment.rb with the other included
libraries, we make sure it is loaded early enough to avoid this.

Also, some other unneccesary require statements were removed from the spec.
  • Loading branch information
mvz committed Sep 11, 2010
1 parent 3255b94 commit 1461045
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion app/controllers/backend_controller.rb
@@ -1,6 +1,5 @@
class BackendController < ContentController
skip_before_filter :verify_authenticity_token
require 'actionwebservice'
cache_sweeper :blog_sweeper

web_service_dispatching_mode :layered
Expand Down
1 change: 1 addition & 0 deletions config/environment.rb
Expand Up @@ -55,6 +55,7 @@
# Load included libraries.
#require 'uuidtools'

require 'action_web_service'
require 'migrator'
require 'rails_patch/active_record'
require 'rails_patch/active_support'
Expand Down
12 changes: 1 addition & 11 deletions spec/controllers/backend_controller_spec.rb
@@ -1,18 +1,8 @@
require File.dirname(__FILE__) + '/../spec_helper'
require 'spec_helper'
require 'action_web_service/test_invoke'
require 'backend_controller'
require 'blogger_service'
require 'meta_weblog_service'
require 'app/apis/movable_type_service.rb'
require 'digest/sha1'
require 'base64'

User.salt = 'change-me'

BackendController.class_eval do
include ActionWebService::Protocol::XmlRpc
end

describe BackendController do
before do
@protocol = :xmlrpc
Expand Down

0 comments on commit 1461045

Please sign in to comment.