annotate test/integration/api_test/news_test.rb @ 1458:b1f4c9a2af24 bug_794

Makes the default radio button checked by default -- this should fix bug #794.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Mon, 11 Nov 2013 18:25:22 +0000
parents 433d4f72a19b
children 622f24f53b42 261b3d9a4903
rev   line source
Chris@119 1 # Redmine - project management software
Chris@1115 2 # Copyright (C) 2006-2012 Jean-Philippe Lang
Chris@119 3 #
Chris@119 4 # This program is free software; you can redistribute it and/or
Chris@119 5 # modify it under the terms of the GNU General Public License
Chris@119 6 # as published by the Free Software Foundation; either version 2
Chris@119 7 # of the License, or (at your option) any later version.
Chris@909 8 #
Chris@119 9 # This program is distributed in the hope that it will be useful,
Chris@119 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@119 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@119 12 # GNU General Public License for more details.
Chris@909 13 #
Chris@119 14 # You should have received a copy of the GNU General Public License
Chris@119 15 # along with this program; if not, write to the Free Software
Chris@119 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@119 17
Chris@119 18 require File.expand_path('../../../test_helper', __FILE__)
Chris@119 19 require 'pp'
Chris@119 20 class ApiTest::NewsTest < ActionController::IntegrationTest
Chris@909 21 fixtures :projects, :trackers, :issue_statuses, :issues,
Chris@909 22 :enumerations, :users, :issue_categories,
Chris@909 23 :projects_trackers,
Chris@909 24 :roles,
Chris@909 25 :member_roles,
Chris@909 26 :members,
Chris@909 27 :enabled_modules,
Chris@909 28 :workflows,
Chris@909 29 :news
Chris@119 30
Chris@119 31 def setup
Chris@119 32 Setting.rest_api_enabled = '1'
Chris@119 33 end
Chris@119 34
Chris@119 35 context "GET /news" do
Chris@119 36 context ".xml" do
Chris@119 37 should "return news" do
Chris@119 38 get '/news.xml'
Chris@909 39
Chris@119 40 assert_tag :tag => 'news',
Chris@119 41 :attributes => {:type => 'array'},
Chris@119 42 :child => {
Chris@119 43 :tag => 'news',
Chris@119 44 :child => {
Chris@119 45 :tag => 'id',
Chris@119 46 :content => '2'
Chris@119 47 }
Chris@119 48 }
Chris@119 49 end
Chris@119 50 end
Chris@909 51
Chris@119 52 context ".json" do
Chris@119 53 should "return news" do
Chris@119 54 get '/news.json'
Chris@909 55
Chris@119 56 json = ActiveSupport::JSON.decode(response.body)
Chris@119 57 assert_kind_of Hash, json
Chris@119 58 assert_kind_of Array, json['news']
Chris@119 59 assert_kind_of Hash, json['news'].first
Chris@119 60 assert_equal 2, json['news'].first['id']
Chris@119 61 end
Chris@119 62 end
Chris@119 63 end
Chris@119 64
Chris@119 65 context "GET /projects/:project_id/news" do
Chris@119 66 context ".xml" do
Chris@119 67 should_allow_api_authentication(:get, "/projects/onlinestore/news.xml")
Chris@909 68
Chris@119 69 should "return news" do
Chris@119 70 get '/projects/ecookbook/news.xml'
Chris@909 71
Chris@119 72 assert_tag :tag => 'news',
Chris@119 73 :attributes => {:type => 'array'},
Chris@119 74 :child => {
Chris@119 75 :tag => 'news',
Chris@119 76 :child => {
Chris@119 77 :tag => 'id',
Chris@119 78 :content => '2'
Chris@119 79 }
Chris@119 80 }
Chris@119 81 end
Chris@119 82 end
Chris@909 83
Chris@119 84 context ".json" do
Chris@119 85 should_allow_api_authentication(:get, "/projects/onlinestore/news.json")
Chris@909 86
Chris@119 87 should "return news" do
Chris@119 88 get '/projects/ecookbook/news.json'
Chris@909 89
Chris@119 90 json = ActiveSupport::JSON.decode(response.body)
Chris@119 91 assert_kind_of Hash, json
Chris@119 92 assert_kind_of Array, json['news']
Chris@119 93 assert_kind_of Hash, json['news'].first
Chris@119 94 assert_equal 2, json['news'].first['id']
Chris@119 95 end
Chris@119 96 end
Chris@119 97 end
Chris@119 98 end