banner_lite 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +9 -0
  3. data/app/controllers/banner_lite/{banners_controller.rb → image_banners_controller.rb} +9 -9
  4. data/app/controllers/banner_lite/text_banners_controller.rb +53 -0
  5. data/app/helpers/banner_lite/{banners_helper.rb → image_banners_helper.rb} +3 -3
  6. data/app/helpers/banner_lite/text_banners_helper.rb +12 -0
  7. data/app/models/banner_lite/banner.rb +0 -29
  8. data/app/models/banner_lite/image_banner.rb +32 -0
  9. data/app/models/banner_lite/text_banner.rb +5 -0
  10. data/app/views/banner_lite/{banners → image_banners}/_form.html.erb +0 -0
  11. data/app/views/banner_lite/{banners → image_banners}/edit.html.erb +1 -1
  12. data/app/views/banner_lite/{banners → image_banners}/index.html.erb +2 -2
  13. data/app/views/banner_lite/{banners → image_banners}/new.html.erb +1 -1
  14. data/app/views/banner_lite/image_banners/preview.html.erb +1 -0
  15. data/app/views/banner_lite/{banners → image_banners}/show.html.erb +2 -2
  16. data/app/views/banner_lite/text_banners/_form.html.erb +33 -0
  17. data/app/views/banner_lite/text_banners/edit.html.erb +6 -0
  18. data/app/views/banner_lite/text_banners/index.html.erb +31 -0
  19. data/app/views/banner_lite/text_banners/new.html.erb +5 -0
  20. data/app/views/banner_lite/text_banners/preview.html.erb +1 -0
  21. data/app/views/banner_lite/text_banners/show.html.erb +24 -0
  22. data/config/routes.rb +6 -1
  23. data/db/migrate/20140901033058_add_banner_text_to_banner_lite_banners.rb +13 -0
  24. data/lib/banner_lite/engine.rb +2 -1
  25. data/lib/banner_lite/version.rb +1 -1
  26. data/spec/controllers/banner_lite/image_banners_controller_spec.rb +141 -0
  27. data/spec/controllers/banner_lite/text_banners_controller_spec.rb +138 -0
  28. data/spec/factories/image_banners.rb +8 -0
  29. data/spec/factories/text_banners.rb +8 -0
  30. data/spec/features/image_banners_spec.rb +18 -0
  31. data/spec/fixtures/files/dummy.png +0 -0
  32. data/spec/helpers/banner_lite/image_banners_helper_spec.rb +6 -0
  33. data/spec/helpers/banner_lite/text_banners_helper_spec.rb +6 -0
  34. data/spec/models/banner_lite/image_banner_spec.rb +15 -0
  35. data/spec/models/banner_lite/text_banner_spec.rb +15 -0
  36. data/spec/spec_helper.rb +50 -0
  37. data/spec/test_app/README.rdoc +28 -0
  38. data/spec/test_app/Rakefile +6 -0
  39. data/spec/test_app/app/assets/javascripts/application.js +13 -0
  40. data/spec/test_app/app/assets/stylesheets/application.css +15 -0
  41. data/spec/test_app/app/controllers/application_controller.rb +5 -0
  42. data/spec/test_app/app/helpers/application_helper.rb +2 -0
  43. data/spec/test_app/app/views/layouts/application.html.erb +14 -0
  44. data/spec/test_app/bin/bundle +3 -0
  45. data/spec/test_app/bin/rails +4 -0
  46. data/spec/test_app/bin/rake +4 -0
  47. data/spec/test_app/config/application.rb +29 -0
  48. data/spec/test_app/config/boot.rb +5 -0
  49. data/spec/test_app/config/database.yml +25 -0
  50. data/spec/test_app/config/environment.rb +5 -0
  51. data/spec/test_app/config/environments/development.rb +29 -0
  52. data/spec/test_app/config/environments/production.rb +80 -0
  53. data/spec/test_app/config/environments/test.rb +36 -0
  54. data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
  55. data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  56. data/spec/test_app/config/initializers/inflections.rb +16 -0
  57. data/spec/test_app/config/initializers/mime_types.rb +5 -0
  58. data/spec/test_app/config/initializers/session_store.rb +3 -0
  59. data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
  60. data/spec/test_app/config/locales/en.yml +23 -0
  61. data/spec/test_app/config/routes.rb +4 -0
  62. data/spec/test_app/config/secrets.yml +20 -0
  63. data/spec/test_app/config.ru +4 -0
  64. data/spec/test_app/db/development.sqlite3 +0 -0
  65. data/spec/test_app/db/schema.rb +25 -0
  66. data/spec/test_app/db/test.sqlite3 +0 -0
  67. data/spec/test_app/log/development.log +2022 -0
  68. data/spec/test_app/log/test.log +2944 -0
  69. data/spec/test_app/public/404.html +67 -0
  70. data/spec/test_app/public/422.html +67 -0
  71. data/spec/test_app/public/500.html +66 -0
  72. data/spec/test_app/public/favicon.ico +0 -0
  73. data/spec/test_app/spec/fixtures/files/image.png +0 -0
  74. data/spec/test_app/tmp/cache/assets/development/sprockets/003a38e9fd7ca25c13cedf53bf372ae6 +0 -0
  75. data/spec/test_app/tmp/cache/assets/development/sprockets/03ac7af390932302330c5edf40f1a0c4 +0 -0
  76. data/spec/test_app/tmp/cache/assets/development/sprockets/04407df44edd603d47fc64d43aba1105 +0 -0
  77. data/spec/test_app/tmp/cache/assets/development/sprockets/10a0a05683e0182480089f585e73d994 +0 -0
  78. data/spec/test_app/tmp/cache/assets/development/sprockets/168e239e81a66290e62ea7b88ae0a6f0 +0 -0
  79. data/spec/test_app/tmp/cache/assets/development/sprockets/5c7aaccf5c3cfe31473143cad225e0a3 +0 -0
  80. data/spec/test_app/tmp/cache/assets/development/sprockets/63b2a7b060b4143f09c1f65fa4d05cec +0 -0
  81. data/spec/test_app/tmp/cache/assets/development/sprockets/6b6316f40abcc8e662f825828fb86a60 +0 -0
  82. data/spec/test_app/tmp/cache/assets/development/sprockets/6e59c9d94357e0bad4932c0d6e08aae4 +0 -0
  83. data/spec/test_app/tmp/cache/assets/development/sprockets/8473b4217b725147b48cc7c35a5613f1 +0 -0
  84. data/spec/test_app/tmp/cache/assets/development/sprockets/9a37adb41b90d5a705ad5ac5b36908a5 +0 -0
  85. data/spec/test_app/tmp/cache/assets/development/sprockets/a282da187ba14975a311bdee34282b68 +0 -0
  86. data/spec/test_app/tmp/cache/assets/development/sprockets/b140558c17c5a6a0b4d0db1aa9eec7d9 +0 -0
  87. data/spec/test_app/tmp/cache/assets/development/sprockets/bd2620ba816de25a2d516af4f4d3d9fa +0 -0
  88. data/spec/test_app/tmp/cache/assets/development/sprockets/bd7f920a6fb16d903905510c1b54ac58 +0 -0
  89. data/spec/test_app/tmp/cache/assets/development/sprockets/dad42ce6da98af2bb068880ecf0c4e3b +0 -0
  90. data/spec/test_app/tmp/cache/assets/development/sprockets/f1ea951eed23da8d08839fed76489094 +0 -0
  91. data/spec/test_app/tmp/cache/assets/development/sprockets/f8d343216bb921b4b9f3ff80a279ade1 +0 -0
  92. data/spec/test_app/tmp/cache/assets/test/sprockets/003a38e9fd7ca25c13cedf53bf372ae6 +0 -0
  93. data/spec/test_app/tmp/cache/assets/test/sprockets/03ac7af390932302330c5edf40f1a0c4 +0 -0
  94. data/spec/test_app/tmp/cache/assets/test/sprockets/04407df44edd603d47fc64d43aba1105 +0 -0
  95. data/spec/test_app/tmp/cache/assets/test/sprockets/10a0a05683e0182480089f585e73d994 +0 -0
  96. data/spec/test_app/tmp/cache/assets/test/sprockets/168e239e81a66290e62ea7b88ae0a6f0 +0 -0
  97. data/spec/test_app/tmp/cache/assets/test/sprockets/28d0637a096857502bb280f6159054d5 +0 -0
  98. data/spec/test_app/tmp/cache/assets/test/sprockets/3061646d05a58b102019803c24a45bfb +0 -0
  99. data/spec/test_app/tmp/cache/assets/test/sprockets/3bf4f025073a083e355b74670ab85dad +0 -0
  100. data/spec/test_app/tmp/cache/assets/test/sprockets/5c7aaccf5c3cfe31473143cad225e0a3 +0 -0
  101. data/spec/test_app/tmp/cache/assets/test/sprockets/63b2a7b060b4143f09c1f65fa4d05cec +0 -0
  102. data/spec/test_app/tmp/cache/assets/test/sprockets/6b6316f40abcc8e662f825828fb86a60 +0 -0
  103. data/spec/test_app/tmp/cache/assets/test/sprockets/6e59c9d94357e0bad4932c0d6e08aae4 +0 -0
  104. data/spec/test_app/tmp/cache/assets/test/sprockets/8473b4217b725147b48cc7c35a5613f1 +0 -0
  105. data/spec/test_app/tmp/cache/assets/test/sprockets/9a37adb41b90d5a705ad5ac5b36908a5 +0 -0
  106. data/spec/test_app/tmp/cache/assets/test/sprockets/a282da187ba14975a311bdee34282b68 +0 -0
  107. data/spec/test_app/tmp/cache/assets/test/sprockets/bd7f920a6fb16d903905510c1b54ac58 +0 -0
  108. data/spec/test_app/tmp/cache/assets/test/sprockets/dad42ce6da98af2bb068880ecf0c4e3b +0 -0
  109. data/spec/test_app/tmp/cache/assets/test/sprockets/e1fd1402695e7f441a0b016d610e5a01 +0 -0
  110. data/spec/test_app/tmp/cache/assets/test/sprockets/f1ea951eed23da8d08839fed76489094 +0 -0
  111. data/spec/test_app/tmp/cache/assets/test/sprockets/f8d343216bb921b4b9f3ff80a279ade1 +0 -0
  112. metadata +209 -12
  113. data/app/views/banner_lite/banners/preview.html.erb +0 -1
@@ -0,0 +1,138 @@
1
+ require 'spec_helper'
2
+
3
+ module BannerLite
4
+ describe TextBannersController do
5
+ routes { BannerLite::Engine.routes }
6
+
7
+ let(:valid_attributes) { {
8
+ url:'http://www.google.co.jp',
9
+ text: 'Visit our special site!',
10
+ } }
11
+
12
+ let(:invalid_attributes) { {
13
+ url: '',
14
+ text: '',
15
+ } }
16
+ let(:valid_session) { { } }
17
+
18
+ describe "GET index" do
19
+ it "assigns all text_banners as @text_banners" do
20
+ text_banner = TextBanner.create! valid_attributes
21
+ get :index, {}, valid_session
22
+ expect(assigns(:text_banners)).to eq([text_banner])
23
+ end
24
+ end
25
+
26
+ describe "GET show" do
27
+ it "assigns the requested text_banner as @text_banner" do
28
+ text_banner = TextBanner.create! valid_attributes
29
+ get :show, {:id => text_banner.to_param}, valid_session
30
+ expect(assigns(:text_banner)).to eq(text_banner)
31
+ end
32
+ end
33
+
34
+ describe "GET new" do
35
+ it "assigns a new text_banner as @text_banner" do
36
+ get :new, {}, valid_session
37
+ expect(assigns(:text_banner)).to be_a_new(TextBanner)
38
+ end
39
+ end
40
+
41
+ describe "GET edit" do
42
+ it "assigns the requested text_banner as @text_banner" do
43
+ text_banner = TextBanner.create! valid_attributes
44
+ get :edit, {:id => text_banner.to_param}, valid_session
45
+ expect(assigns(:text_banner)).to eq(text_banner)
46
+ end
47
+ end
48
+
49
+ describe "POST create" do
50
+ describe "with valid params" do
51
+ it "creates a new TextBanner" do
52
+ expect {
53
+ post :create, {:text_banner => valid_attributes}, valid_session
54
+ }.to change(TextBanner, :count).by(1)
55
+ end
56
+
57
+ it "assigns a newly created text_banner as @text_banner" do
58
+ post :create, {:text_banner => valid_attributes}, valid_session
59
+ expect(assigns(:text_banner)).to be_a(TextBanner)
60
+ expect(assigns(:text_banner)).to be_persisted
61
+ end
62
+
63
+ it "redirects to the created text_banner" do
64
+ post :create, {:text_banner => valid_attributes}, valid_session
65
+ expect(response).to redirect_to(TextBanner.last)
66
+ end
67
+ end
68
+
69
+ describe "with invalid params" do
70
+ it "assigns a newly created but unsaved text_banner as @text_banner" do
71
+ post :create, {:text_banner => invalid_attributes}, valid_session
72
+ expect(assigns(:text_banner)).to be_a_new(TextBanner)
73
+ end
74
+
75
+ it "re-renders the 'new' template" do
76
+ post :create, {:text_banner => invalid_attributes}, valid_session
77
+ expect(response).to render_template("new")
78
+ end
79
+ end
80
+ end
81
+
82
+ describe "PUT update" do
83
+ describe "with valid params" do
84
+ let(:new_attributes) { {
85
+ url: 'http://www.google.co.jp'
86
+ } }
87
+
88
+ it "updates the requested text_banner" do
89
+ text_banner = TextBanner.create! valid_attributes
90
+ put :update, {:id => text_banner.to_param, :text_banner => new_attributes}, valid_session
91
+ text_banner.reload
92
+ end
93
+
94
+ it "assigns the requested text_banner as @text_banner" do
95
+ text_banner = TextBanner.create! valid_attributes
96
+ put :update, {:id => text_banner.to_param, :text_banner => valid_attributes}, valid_session
97
+ expect(assigns(:text_banner)).to eq(text_banner)
98
+ end
99
+
100
+ it "redirects to the text_banner" do
101
+ text_banner = TextBanner.create! valid_attributes
102
+ put :update, {:id => text_banner.to_param, :text_banner => valid_attributes}, valid_session
103
+ expect(response).to redirect_to(text_banner)
104
+ end
105
+ end
106
+
107
+ describe "with invalid params" do
108
+ it "assigns the text_banner as @text_banner" do
109
+ text_banner = TextBanner.create! valid_attributes
110
+ put :update, {:id => text_banner.to_param, :text_banner => invalid_attributes}, valid_session
111
+ expect(assigns(:text_banner)).to eq(text_banner)
112
+ end
113
+
114
+ it "re-renders the 'edit' template" do
115
+ text_banner = TextBanner.create! valid_attributes
116
+ put :update, {:id => text_banner.to_param, :text_banner => invalid_attributes}, valid_session
117
+ expect(response).to render_template("edit")
118
+ end
119
+ end
120
+ end
121
+
122
+ describe "DELETE destroy" do
123
+ it "destroys the requested text_banner" do
124
+ text_banner = TextBanner.create! valid_attributes
125
+ expect {
126
+ delete :destroy, {:id => text_banner.to_param}, valid_session
127
+ }.to change(TextBanner, :count).by(-1)
128
+ end
129
+
130
+ it "redirects to the text_banners list" do
131
+ text_banner = TextBanner.create! valid_attributes
132
+ delete :destroy, {:id => text_banner.to_param}, valid_session
133
+ expect(response).to redirect_to(text_banners_url)
134
+ end
135
+ end
136
+
137
+ end
138
+ end
@@ -0,0 +1,8 @@
1
+ FactoryGirl.define do
2
+ factory :banner, class: BannerLite::ImageBanner do
3
+ url 'http://example.com'
4
+ file Rack::Test::UploadedFile.new(File.expand_path('../../fixtures/files/dummy.png', __FILE__), 'image/jpeg')
5
+ active_from '2014-01-05 06:00:00'
6
+ active_until '2014-02-25 21:00:00'
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ FactoryGirl.define do
2
+ factory :text_banner, class: BannerLite::TextBanner do
3
+ url 'http://example.com'
4
+ banner_text 'Visit our brand-new site!'
5
+ active_from '2014-01-05 06:00:00'
6
+ active_until '2014-02-25 21:00:00'
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'banner management' do
4
+ given(:image_path){ Rails.root + 'spec/fixtures/files/image.png' }
5
+
6
+ scenario 'create and show banners' do
7
+ visit '/banner_lite/image_banners/new'
8
+ fill_in 'Url', with: 'http://rubyonrails.org'
9
+ attach_file 'File', image_path
10
+ click_on 'Create Image banner'
11
+
12
+ visit BannerLite::ImageBanner.last.src
13
+ expect(page.body).to eq File.read(image_path, mode: 'rb')
14
+
15
+ visit '/banner_lite/image_banners'
16
+ click_on 'Destroy'
17
+ end
18
+ end
Binary file
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ module BannerLite
4
+ describe ImageBannersHelper do
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ module BannerLite
4
+ RSpec.describe TextBannersHelper, :type => :helper do
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ module BannerLite
4
+ describe ImageBanner do
5
+ describe ".active" do
6
+ let!(:inactive1){ create :banner, active_from: 1.month.ago, active_until: 1.second.ago }
7
+ let!(:active) { create :banner, active_from: 1.second.ago, active_until: 5.second.from_now }
8
+ let!(:inactive2){ create :banner, active_from: 5.second.from_now, active_until: 1.month.from_now }
9
+
10
+ it "picks active banners" do
11
+ expect(BannerLite::ImageBanner.active).to eq [active]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ module BannerLite
4
+ describe TextBanner do
5
+ describe ".banner_text" do
6
+ it "should be invalid without banner_text" do
7
+ banner = BannerLite::TextBanner.new({
8
+ url: 'http://www.google.com',
9
+ text: ''
10
+ })
11
+ expect(banner).to be_invalid
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,50 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../spec/test_app/config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+ require 'capybara/rspec'
7
+ require 'factory_girl_rails'
8
+
9
+ # Requires supporting ruby files with custom matchers and macros, etc,
10
+ # in spec/support/ and its subdirectories.
11
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
12
+
13
+ # Checks for pending migrations before tests are run.
14
+ # If you are not using ActiveRecord, you can remove this line.
15
+ ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
16
+
17
+ RSpec.configure do |config|
18
+ # ## Mock Framework
19
+ #
20
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
21
+ #
22
+ # config.mock_with :mocha
23
+ # config.mock_with :flexmock
24
+ # config.mock_with :rr
25
+
26
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
27
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
28
+
29
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
30
+ # examples within a transaction, remove the following line or assign false
31
+ # instead of true.
32
+ config.use_transactional_fixtures = true
33
+
34
+ # If true, the base class of anonymous controllers will be inferred
35
+ # automatically. This will be the default behavior in future versions of
36
+ # rspec-rails.
37
+ config.infer_base_class_for_anonymous_controllers = false
38
+
39
+ # Run specs in random order to surface order dependencies. If you find an
40
+ # order dependency and want to debug it, you can fix the order by providing
41
+ # the seed, which is printed after each run.
42
+ # --seed 1234
43
+ config.order = "random"
44
+
45
+ config.include FactoryGirl::Syntax::Methods
46
+
47
+ config.after :each do
48
+ FileUtils.rm_rf Dir[Rails.root + 'public/system/*']
49
+ end
50
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestApp</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "action_view/railtie"
8
+ require "sprockets/railtie"
9
+ # require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "banner_lite"
13
+
14
+ module TestApp
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+ end
28
+ end
29
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,29 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end
@@ -0,0 +1,80 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end
@@ -0,0 +1,36 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = "public, max-age=3600"
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Print deprecation notices to the stderr.
35
+ config.active_support.deprecation = :stderr
36
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_test_app_session'