diff options
Diffstat (limited to 'test/integration/api_test/news_test.rb')
-rw-r--r-- | test/integration/api_test/news_test.rb | 93 |
1 files changed, 40 insertions, 53 deletions
diff --git a/test/integration/api_test/news_test.rb b/test/integration/api_test/news_test.rb index 41be26260..e5a31885c 100644 --- a/test/integration/api_test/news_test.rb +++ b/test/integration/api_test/news_test.rb @@ -31,67 +31,54 @@ class Redmine::ApiTest::NewsTest < Redmine::ApiTest::Base Setting.rest_api_enabled = '1' end - context "GET /news" do - context ".xml" do - should "return news" do - get '/news.xml' + should_allow_api_authentication(:get, "/projects/onlinestore/news.xml") + should_allow_api_authentication(:get, "/projects/onlinestore/news.json") - assert_tag :tag => 'news', - :attributes => {:type => 'array'}, - :child => { - :tag => 'news', - :child => { - :tag => 'id', - :content => '2' - } - } - end - end + test "GET /news.xml should return news" do + get '/news.xml' - context ".json" do - should "return news" do - get '/news.json' - - json = ActiveSupport::JSON.decode(response.body) - assert_kind_of Hash, json - assert_kind_of Array, json['news'] - assert_kind_of Hash, json['news'].first - assert_equal 2, json['news'].first['id'] - end - end + assert_tag :tag => 'news', + :attributes => {:type => 'array'}, + :child => { + :tag => 'news', + :child => { + :tag => 'id', + :content => '2' + } + } end - context "GET /projects/:project_id/news" do - context ".xml" do - should_allow_api_authentication(:get, "/projects/onlinestore/news.xml") + test "GET /news.json should return news" do + get '/news.json' - should "return news" do - get '/projects/ecookbook/news.xml' + json = ActiveSupport::JSON.decode(response.body) + assert_kind_of Hash, json + assert_kind_of Array, json['news'] + assert_kind_of Hash, json['news'].first + assert_equal 2, json['news'].first['id'] + end - assert_tag :tag => 'news', - :attributes => {:type => 'array'}, - :child => { - :tag => 'news', - :child => { - :tag => 'id', - :content => '2' - } - } - end - end + test "GET /projects/:project_id/news.xml should return news" do + get '/projects/ecookbook/news.xml' - context ".json" do - should_allow_api_authentication(:get, "/projects/onlinestore/news.json") + assert_tag :tag => 'news', + :attributes => {:type => 'array'}, + :child => { + :tag => 'news', + :child => { + :tag => 'id', + :content => '2' + } + } + end - should "return news" do - get '/projects/ecookbook/news.json' + test "GET /projects/:project_id/news.json should return news" do + get '/projects/ecookbook/news.json' - json = ActiveSupport::JSON.decode(response.body) - assert_kind_of Hash, json - assert_kind_of Array, json['news'] - assert_kind_of Hash, json['news'].first - assert_equal 2, json['news'].first['id'] - end - end + json = ActiveSupport::JSON.decode(response.body) + assert_kind_of Hash, json + assert_kind_of Array, json['news'] + assert_kind_of Hash, json['news'].first + assert_equal 2, json['news'].first['id'] end end |