Sha256: c2225807388292d660fcf86145fc5298e887ac830ccc1f1f1d5efc7d75615f70

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

pwd = File.dirname(__FILE__)
f = File.join(pwd, '..', '..', 'app', 'views')
AdminData::FeedController.prepend_view_path(f)

#TODO mention this dependency in gemspec
require 'nokogiri'

class AdminData::FeedControllerTest < ActionController::TestCase

  #TODO write a test to check before_filter authorization. Testing will be a bit tricky since
  #http_basic_authentication is done
  context 'GET index' do
    setup do
      Article.delete_all
      @article = Factory(:article)
      get :index, :format => :rss, :klasss => 'article'
      @feed = Nokogiri::XML(@response.body)
    end
    should_respond_with :success
    should 'have RSS feed 2.0' do
      assert_equal '2.0', @feed.at('rss')['version']
    end
    should 'have title' do
      assert_equal "Feeds from admin_data Article id: #{@article.id}", @feed.css('channel title').text
    end
    should 'have guid' do
      guid = @feed.css('channel item guid').text
      assert Regexp.new("/admin_data/klass/Article/#{@article.id}-").match(guid)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
admin_data-1.0.3 test/functional/feed_controller_test.rb
admin_data-1.0.2 test/functional/feed_controller_test.rb
admin_data-1.0.1 test/functional/feed_controller_test.rb
admin_data-1.0.0 test/functional/feed_controller_test.rb