foxynews 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +23 -0
  4. data/app/controllers/foxynews/presskits_controller.rb +10 -0
  5. data/app/controllers/foxynews/pressrooms_controller.rb +46 -0
  6. data/app/helpers/foxynews/foxynews_helper.rb +5 -0
  7. data/app/models/foxynews/featured_item.rb +4 -0
  8. data/app/services/foxynews/clipping.rb +14 -0
  9. data/app/services/foxynews/paging.rb +13 -0
  10. data/app/services/foxynews/parser.rb +28 -0
  11. data/app/services/foxynews/press_release.rb +22 -0
  12. data/app/services/foxynews/press_release_setter.rb +56 -0
  13. data/app/services/foxynews/presskit.rb +19 -0
  14. data/app/services/foxynews/presskit_setter.rb +48 -0
  15. data/app/services/foxynews/pressroom.rb +20 -0
  16. data/app/services/foxynews/pressroom_setter.rb +75 -0
  17. data/app/views/foxynews/partials/_contact_details.html.erb +18 -0
  18. data/app/views/foxynews/partials/_contact_panels.html.erb +28 -0
  19. data/app/views/foxynews/partials/_contact_social_media.html.erb +17 -0
  20. data/app/views/foxynews/partials/_featured_press_release.html.erb +12 -0
  21. data/app/views/foxynews/partials/_modal.html.erb +8 -0
  22. data/app/views/foxynews/partials/_presskits.html.erb +8 -0
  23. data/app/views/foxynews/partials/_pressroom_about.html.erb +6 -0
  24. data/app/views/foxynews/partials/_spokesman_details.html.erb +31 -0
  25. data/app/views/foxynews/partials/_thumbnails.html.erb +33 -0
  26. data/app/views/foxynews/partials/_timeline.html.erb +50 -0
  27. data/app/views/foxynews/presskits/show.html.erb +10 -0
  28. data/app/views/foxynews/pressrooms/index.html.erb +25 -0
  29. data/app/views/foxynews/pressrooms/show.html.erb +21 -0
  30. data/config/locales/en.yml +32 -0
  31. data/config/routes.rb +9 -0
  32. data/db/migrate/20150915120000_create_foxynews_featured_items.rb +13 -0
  33. data/db/migrate/20150921110000_change_article_to_article_id.rb +5 -0
  34. data/lib/foxynews.rb +10 -0
  35. data/lib/foxynews/engine.rb +13 -0
  36. data/lib/foxynews/version.rb +3 -0
  37. data/lib/generators/foxynews/initializer_generator.rb +12 -0
  38. data/lib/generators/foxynews/templates/foxynews_template.rb +3 -0
  39. data/lib/tasks/foxynews_tasks.rake +4 -0
  40. data/test/dummy/README.rdoc +28 -0
  41. data/test/dummy/Rakefile +6 -0
  42. data/test/dummy/app/assets/javascripts/application.js +13 -0
  43. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  44. data/test/dummy/app/controllers/application_controller.rb +5 -0
  45. data/test/dummy/app/helpers/application_helper.rb +2 -0
  46. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  47. data/test/dummy/bin/bundle +3 -0
  48. data/test/dummy/bin/rails +4 -0
  49. data/test/dummy/bin/rake +4 -0
  50. data/test/dummy/bin/setup +29 -0
  51. data/test/dummy/config.ru +4 -0
  52. data/test/dummy/config/application.rb +26 -0
  53. data/test/dummy/config/boot.rb +5 -0
  54. data/test/dummy/config/database.yml +25 -0
  55. data/test/dummy/config/environment.rb +5 -0
  56. data/test/dummy/config/environments/development.rb +41 -0
  57. data/test/dummy/config/environments/production.rb +79 -0
  58. data/test/dummy/config/environments/test.rb +42 -0
  59. data/test/dummy/config/initializers/assets.rb +11 -0
  60. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  61. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  62. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  63. data/test/dummy/config/initializers/foxynews.rb +3 -0
  64. data/test/dummy/config/initializers/inflections.rb +16 -0
  65. data/test/dummy/config/initializers/mime_types.rb +4 -0
  66. data/test/dummy/config/initializers/session_store.rb +3 -0
  67. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  68. data/test/dummy/config/locales/en.yml +23 -0
  69. data/test/dummy/config/routes.rb +59 -0
  70. data/test/dummy/config/secrets.yml +22 -0
  71. data/test/dummy/db/development.sqlite3 +0 -0
  72. data/test/dummy/db/migrate/20150921115208_create_foxynews_featured_items.foxynews.rb +14 -0
  73. data/test/dummy/db/migrate/20150921115209_change_article_to_article_id.foxynews.rb +6 -0
  74. data/test/dummy/db/schema.rb +27 -0
  75. data/test/dummy/db/test.sqlite3 +0 -0
  76. data/test/dummy/log/development.log +351 -0
  77. data/test/dummy/log/test.log +9326 -0
  78. data/test/dummy/public/404.html +67 -0
  79. data/test/dummy/public/422.html +67 -0
  80. data/test/dummy/public/500.html +66 -0
  81. data/test/dummy/public/favicon.ico +0 -0
  82. data/test/dummy/spec/features/pressroom_feature_spec.rb +101 -0
  83. data/test/dummy/spec/rails_helper.rb +52 -0
  84. data/test/dummy/spec/services/foxynews/press_release_setter_spec.rb +40 -0
  85. data/test/dummy/spec/services/foxynews/presskit_setter_spec.rb +40 -0
  86. data/test/dummy/spec/services/foxynews/pressroom_setter_spec.rb +50 -0
  87. data/test/dummy/spec/spec_helper.rb +92 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/0ieeKnMtadPClPcf7n4_-7f9dFAa5EKPn-nhh8g4E_I.cache +1 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/3fB7XY5WyPu8FySUeyC372vbXJ2Ix4iB1QaNHXbk_BY.cache +1 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  91. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/9dpacct--ty4g6t9ET48xr39Oa8KFJq67stokNMRBE0.cache +1 -0
  92. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/CzzhnWANCyFkiMpG8MGAUus0oHH7jFGSjgKNQytoGB8.cache +0 -0
  93. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/EHcymtlGKlOMMf7gOs-X2_jpvcBTW92Qeaxu2B5-Wbg.cache +1 -0
  94. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/LGn_lRMM4VGWV-tOkzVE711bHWh5XhMIHtLL-ydCc5s.cache +0 -0
  95. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +3 -0
  96. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/P6CzQLNPa_qmqh4oEs_FJcmJUu_RgN9rxL-u5eUX8a8.cache +0 -0
  97. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/SGxtd6iKmB2TMwH-VOx-jVYXh5m_09UjNEOkifPHLL0.cache +1 -0
  98. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ZF-VgWKVwd4l6mDAOWYmcWP44GkNpVapsSWxOVT_jXs.cache +1 -0
  99. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/e_NLP8hWf6Ma_xNwWM6lWrQIYZIy62BM5mIpRIVEz24.cache +0 -0
  100. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/eyIVoTHtfeBUAG8zonwJLMFQsk7muavIqU6by75vy6E.cache +1 -0
  101. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +3 -0
  102. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hkb4T84XlBEogo6JU3t-W-8oWx1BbAVq7dqJ2DNHwt4.cache +0 -0
  103. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  104. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/1fnsGuWQsCAFit0Lhxi-NuDTrnuzg0MPZnEeYfoXT9Q.cache +0 -0
  105. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  106. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/9dpacct--ty4g6t9ET48xr39Oa8KFJq67stokNMRBE0.cache +1 -0
  107. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/9jPCqzZvmeFf31Rz8y3OEo8OQXEHVcwmLgkx0tXs-o8.cache +1 -0
  108. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/CzzhnWANCyFkiMpG8MGAUus0oHH7jFGSjgKNQytoGB8.cache +0 -0
  109. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/N-1CMS_rjg3LKA5Sh64XgIXIzy-4T-PQ8PIf4HY_R8s.cache +0 -0
  110. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +3 -0
  111. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/WZy7M8vyOXLZi2NSRoODBS6edlqJTSpd1JoU8Aq03fY.cache +0 -0
  112. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZF-VgWKVwd4l6mDAOWYmcWP44GkNpVapsSWxOVT_jXs.cache +1 -0
  113. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/eyIVoTHtfeBUAG8zonwJLMFQsk7muavIqU6by75vy6E.cache +1 -0
  114. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +3 -0
  115. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/o2kqwqoUQ3gkgncZO1IWdVRzFD0wCSQ-HyL62cINFOU.cache +1 -0
  116. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  117. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/pQIgTfLmEPykNamzxdqBww21SMT7YlZlZGy6hgQ6eVE.cache +1 -0
  118. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/tAO-KLuNv0f9gUG3lGwGw7ujopxtlyjAr83jAzLWyq0.cache +0 -0
  119. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/td9wUl9SLRnSSgE2ZK_VqCzLxTkFiCW50KkOhE916Wo.cache +1 -0
  120. data/test/dummy_responses/pressrooms_id.json +1 -0
  121. data/test/dummy_responses/pressrooms_id_press_releases.json +45 -0
  122. data/test/dummy_responses/pressrooms_id_press_releases_109544.json +1 -0
  123. data/test/dummy_responses/pressrooms_id_presskits.json +1 -0
  124. data/test/dummy_responses/pressrooms_id_presskits_215958.json +1 -0
  125. data/test/dummy_responses/pressrooms_id_timeline.json +135 -0
  126. data/test/test_helper.rb +19 -0
  127. metadata +302 -0
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,101 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe 'Pressroom functionality' do
4
+
5
+ #contact info
6
+ address = 'pataphysics Pa Ubu 1-800-POLAND'
7
+ main_website_url = 'www.example.com'
8
+ company_blog_url = 'blog.example.com'
9
+ contact_url = 'www.example.com/contact'
10
+
11
+ #social media
12
+ facebook_url = 'www.facebook.com/example'
13
+ linkedin_url = 'linkedin.com/example/example'
14
+ gplus_url = "google.com"
15
+
16
+ published_date = '31 August, 2015'
17
+ pr_title = 'Once more, dear Palcontents, once more!'
18
+ pr_subtitle = 'Soon Ubu Roi shall be king of Poland anon!'
19
+ pr_summary = 'my custom summary'
20
+ pr_about = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
21
+
22
+ before do
23
+ featured_item = Foxynews::FeaturedItem.create(article_id: 109544, title: 'Once more, dear Palcontents, once more!', featured: true)
24
+ visit '/'
25
+ end
26
+
27
+ context 'sidebar' do
28
+
29
+ describe 'displays the contact information' do
30
+ it 'has an address' do
31
+ expect(page).to have_content(address)
32
+ end
33
+
34
+ it 'has a website url' do
35
+ expect(page.source).to match(main_website_url)
36
+ end
37
+
38
+ it 'has a company blog' do
39
+ expect(page.source).to match(company_blog_url)
40
+ end
41
+
42
+ it 'has a contact url' do
43
+ expect(page.source).to match(contact_url)
44
+ end
45
+ end
46
+
47
+ describe 'displays the social media information' do
48
+ it 'has a facebook url' do
49
+ expect(page.source).to match(facebook_url)
50
+ end
51
+ it 'has a linkedin url' do
52
+ expect(page.source).to match(linkedin_url)
53
+ end
54
+ it 'has a google plus url' do
55
+ expect(page.source).to match(gplus_url)
56
+ end
57
+ end
58
+ end
59
+
60
+ context 'pressroom' do
61
+
62
+ describe 'displays press releases' do
63
+ it 'has a published date' do
64
+ expect(page).to have_content(published_date)
65
+ end
66
+ it 'has a title' do
67
+ expect(page).to have_content(pr_title)
68
+ end
69
+ it 'has a summary' do
70
+ expect(page).to have_content(pr_summary)
71
+ end
72
+
73
+ it 'has an about' do
74
+ expect(page).to have_content(pr_about)
75
+ end
76
+ end
77
+
78
+ describe 'navigates to a press release page' do
79
+ before do
80
+ click_link "Once more, dear Palcontents, once more!", match: :first
81
+ end
82
+
83
+ it 'displays title' do
84
+ expect(page).to have_content(pr_title)
85
+ end
86
+
87
+ it 'displays subtitle' do
88
+ expect(page).to have_content(pr_subtitle)
89
+ end
90
+
91
+ it 'displays body' do
92
+ expect(page).to have_content('This is a test press release')
93
+ end
94
+ end
95
+
96
+ end
97
+
98
+ context 'timeline' do
99
+ end
100
+
101
+ end
@@ -0,0 +1,52 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require File.expand_path('../../config/environment', __FILE__)
4
+ # Prevent database truncation if the environment is production
5
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
6
+ require 'spec_helper'
7
+ require 'rspec/rails'
8
+ # Add additional requires below this line. Rails is not loaded until this point!
9
+
10
+ # Requires supporting ruby files with custom matchers and macros, etc, in
11
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12
+ # run as spec files by default. This means that files in spec/support that end
13
+ # in _spec.rb will both be required and run as specs, causing the specs to be
14
+ # run twice. It is recommended that you do not name files matching this glob to
15
+ # end with _spec.rb. You can configure this pattern with the --pattern
16
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17
+ #
18
+ # The following line is provided for convenience purposes. It has the downside
19
+ # of increasing the boot-up time by auto-requiring all files in the support
20
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
21
+ # require only the support files necessary.
22
+ #
23
+ # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
24
+
25
+ # Checks for pending migrations before tests are run.
26
+ # If you are not using ActiveRecord, you can remove this line.
27
+ ActiveRecord::Migration.maintain_test_schema!
28
+
29
+ RSpec.configure do |config|
30
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
31
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
32
+
33
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
34
+ # examples within a transaction, remove the following line or assign false
35
+ # instead of true.
36
+ config.use_transactional_fixtures = true
37
+
38
+ # RSpec Rails can automatically mix in different behaviours to your tests
39
+ # based on their file location, for example enabling you to call `get` and
40
+ # `post` in specs under `spec/controllers`.
41
+ #
42
+ # You can disable this behaviour by removing the line below, and instead
43
+ # explicitly tag your specs with their type, e.g.:
44
+ #
45
+ # RSpec.describe UsersController, :type => :controller do
46
+ # # ...
47
+ # end
48
+ #
49
+ # The different available types are documented in the features, such as in
50
+ # https://relishapp.com/rspec/rspec-rails/docs
51
+ config.infer_spec_type_from_file_location!
52
+ end
@@ -0,0 +1,40 @@
1
+ require 'rails_helper'
2
+
3
+ describe Foxynews::PressReleaseSetter do
4
+
5
+ context '#all' do
6
+ before do
7
+ @press_release = Foxynews::PressReleaseSetter.all
8
+ end
9
+
10
+ it 'returns a collection of presskits' do
11
+ expect(@press_release.class).to be(Foxynews::PressReleaseSetter)
12
+ expect(@press_release.data.first.class).to be(Foxynews::PressRelease)
13
+ end
14
+
15
+ it 'returns a paging object' do
16
+ expect(@press_release.paging.class).to be(Foxynews::Paging)
17
+ end
18
+ end
19
+
20
+ context '#find' do
21
+ it 'handles a bad url' do
22
+ pk = Foxynews::PressReleaseSetter.find('abc')
23
+
24
+ expect(pk).to eq(false)
25
+ end
26
+
27
+ it 'returns a presskit' do
28
+ pk = Foxynews::PressReleaseSetter.find(109544)
29
+
30
+ expect(pk.class).to be(Foxynews::PressRelease)
31
+ expect(pk.id).to eq(109544)
32
+ end
33
+
34
+ it 'handles nil' do
35
+ pk = Foxynews::PressReleaseSetter.find(nil)
36
+
37
+ expect(pk).to eq(false)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ require 'rails_helper'
2
+
3
+ describe Foxynews::PresskitSetter do
4
+
5
+ context '#all' do
6
+ before do
7
+ @presskits = Foxynews::PresskitSetter.all
8
+ end
9
+
10
+ it 'returns a collection of presskits' do
11
+ expect(@presskits.data.class).to be(Array)
12
+ expect(@presskits.data.first.class).to be(Foxynews::Presskit)
13
+ end
14
+
15
+ it 'returns a paging object' do
16
+ expect(@presskits.paging.class).to be(Foxynews::Paging)
17
+ end
18
+ end
19
+
20
+ context '#find' do
21
+ it 'handles a bad url' do
22
+ pk = Foxynews::PresskitSetter.find('abc')
23
+
24
+ expect(pk).to eq(false)
25
+ end
26
+
27
+ it 'returns a presskit' do
28
+ pk = Foxynews::PresskitSetter.find(215958)
29
+
30
+ expect(pk.class).to be(Foxynews::Presskit)
31
+ expect(pk.id).to eq(215958)
32
+ end
33
+
34
+ it 'handles nil' do
35
+ pk = Foxynews::PresskitSetter.find(nil)
36
+
37
+ expect(pk).to eq(false)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,50 @@
1
+ require 'rails_helper'
2
+
3
+ describe Foxynews::PressroomSetter do
4
+
5
+ describe "#pressroom" do
6
+ it 'returns a pressroom object' do
7
+ pressroom = Foxynews::PressroomSetter.pressroom
8
+
9
+ expect(pressroom.class).to eq(Foxynews::Pressroom)
10
+ expect(pressroom.id).to eq(60679)
11
+ end
12
+ end
13
+
14
+ describe "#timeline" do
15
+ before do
16
+ @timeline = Foxynews::PressroomSetter.timeline
17
+ end
18
+
19
+ it 'returns a pressroom setter object' do
20
+ expect(@timeline.class).to eq(Foxynews::PressroomSetter)
21
+ end
22
+
23
+ it 'returns an array of press releases and clippings grouped by month' do
24
+ expect(@timeline.data['September 2015'].first.class).to eq(Foxynews::PressRelease)
25
+ expect(@timeline.data['August 2015'].first.class).to eq(Foxynews::Clipping)
26
+ end
27
+
28
+ it 'returns paging information' do
29
+ expect(@timeline.paging.class).to eq(Foxynews::Paging)
30
+ end
31
+ end
32
+
33
+ describe ".filter_timeline_by_language!" do
34
+ before do
35
+ @timeline = Foxynews::PressroomSetter.timeline
36
+ @timeline.filter_timeline_by_language!('de')
37
+ end
38
+
39
+ it 'returns only german results' do
40
+ expect(@timeline.data['September 2015'].length).to eq(1)
41
+ expect(@timeline.data['August 2015'].length).to eq(1)
42
+ expect(@timeline.data['September 2015'].first.language).to eq('de')
43
+ end
44
+ end
45
+
46
+ #TODO
47
+ describe "#search" do
48
+ end
49
+
50
+ end