From 9faf54be942f2055c56e53208f1ddb33de7beabb Mon Sep 17 00:00:00 2001 From: futurechimp Date: Sat, 11 Jun 2011 18:13:52 +0100 Subject: [PATCH] Moved notify action outside of secured area. BREAKS TESTS! --- admin/controllers/feeds.rb | 5 ----- app/controllers/updates.rb | 9 +++++++++ app/helpers/updates_helper.rb | 7 +++++++ lib/octopus.rb | 5 ++--- test/app/controllers/updates_controller_test.rb | 13 +++++++++++++ 5 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 app/controllers/updates.rb create mode 100644 app/helpers/updates_helper.rb create mode 100644 test/app/controllers/updates_controller_test.rb diff --git a/admin/controllers/feeds.rb b/admin/controllers/feeds.rb index 6da4280..0dcef91 100644 --- a/admin/controllers/feeds.rb +++ b/admin/controllers/feeds.rb @@ -47,9 +47,4 @@ redirect url(:feeds, :index) end - post :notify, :with => :id do - @feed = Feed.find(params[:id]) - @feed.update_feed_items(params[:data]) - "success" - end end \ No newline at end of file diff --git a/app/controllers/updates.rb b/app/controllers/updates.rb new file mode 100644 index 0000000..760c72d --- /dev/null +++ b/app/controllers/updates.rb @@ -0,0 +1,9 @@ +Mongoaggro.controllers :updates do + + post :notify, :with => :id do + @feed = Feed.find(params[:id]) + @feed.update_feed_items(params[:data]) + "success" + end + +end \ No newline at end of file diff --git a/app/helpers/updates_helper.rb b/app/helpers/updates_helper.rb new file mode 100644 index 0000000..7549de4 --- /dev/null +++ b/app/helpers/updates_helper.rb @@ -0,0 +1,7 @@ +# Helper methods defined here can be accessed in any controller or view in the application + +Mongoaggro.helpers do + # def simple_helper_method + # ... + # end +end \ No newline at end of file diff --git a/lib/octopus.rb b/lib/octopus.rb index 6470ff4..a057b77 100644 --- a/lib/octopus.rb +++ b/lib/octopus.rb @@ -11,12 +11,11 @@ def self.create_resource(feed) :body => { :net_resource => { :url => feed.url }, :subscription => { - :url => "#{::SERVER_URL}/admin/feeds/notify/#{feed.id}" + :url => "#{::SERVER_URL}/updates/notify/#{feed.id}" } } } post( '/create', options) end -end - +end \ No newline at end of file diff --git a/test/app/controllers/updates_controller_test.rb b/test/app/controllers/updates_controller_test.rb new file mode 100644 index 0000000..70b1730 --- /dev/null +++ b/test/app/controllers/updates_controller_test.rb @@ -0,0 +1,13 @@ +require File.expand_path(File.dirname(__FILE__) + '/../../test_config.rb') + +class UpdatesControllerTest < Test::Unit::TestCase + context "UpdatesController" do + setup do + get '/' + end + + should "return hello world text" do + assert_equal "Hello World", last_response.body + end + end +end