dismissible_blocks 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{LICENSE.text → LICENSE.txt} +0 -0
- data/{README.markdown → README.md} +0 -0
- data/app/controllers/dismissible_blocks_controller.rb +2 -2
- data/app/helpers/dismissible_blocks_helper.rb +1 -1
- data/dismissible_blocks.gemspec +33 -0
- data/lib/dismissible_blocks/version.rb +1 -1
- metadata +35 -126
- data/Gemfile +0 -7
- data/Rakefile +0 -34
- data/test/capybara_helper.rb +0 -34
- data/test/controllers/dismissible_blocks_controller_test.rb +0 -18
- data/test/dummy/Rakefile +0 -3
- data/test/dummy/app/assets/javascripts/application.js +0 -3
- data/test/dummy/app/assets/stylesheets/application.css +0 -17
- data/test/dummy/app/controllers/application_controller.rb +0 -29
- data/test/dummy/app/controllers/landings_controller.rb +0 -6
- data/test/dummy/app/controllers/sessions_controller.rb +0 -28
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/landings_helper.rb +0 -2
- data/test/dummy/app/helpers/sessions_helper.rb +0 -2
- data/test/dummy/app/models/user.rb +0 -9
- data/test/dummy/app/views/landings/show.html.erb +0 -10
- data/test/dummy/app/views/layouts/application.html.erb +0 -18
- data/test/dummy/app/views/sessions/new.html.erb +0 -15
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -29
- data/test/dummy/config.ru +0 -3
- data/test/dummy/config/application.rb +0 -13
- data/test/dummy/config/boot.rb +0 -4
- data/test/dummy/config/database.yml +0 -11
- data/test/dummy/config/environment.rb +0 -3
- data/test/dummy/config/environments/development.rb +0 -12
- data/test/dummy/config/environments/test.rb +0 -13
- data/test/dummy/config/initializers/assets.rb +0 -1
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -1
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -1
- data/test/dummy/config/initializers/session_store.rb +0 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -3
- data/test/dummy/config/routes.rb +0 -7
- data/test/dummy/config/secrets.yml +0 -5
- data/test/dummy/db/migrate/20140303154458_create_users.rb +0 -10
- data/test/dummy/db/migrate/20140303161500_add_dismissed_blocks_to_users.rb +0 -9
- data/test/dummy/db/schema.rb +0 -24
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +0 -442
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/58a8328804a777933d757eb9a448eaf5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/68b2c32b107dd99071629b05c392d6cd +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/96c147c638b08a4c0178d9c66c3b9c48 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a303e31a3b163f257d2061cd9abb98d2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ac2d5385dbcd9cea11c510dc83189bba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bec12e1e92fe458e19b5f9869454ac1a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/features/dismissible_blocks_test.rb +0 -21
- data/test/fixtures/users.yml +0 -9
- data/test/helpers/dismissible_blocks_helper_test.rb +0 -73
- data/test/lib/controllers/helpers_test.rb +0 -14
- data/test/test_helper.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c7f626613af83496fe42408bf4e578a4aa19afaac01889691f60500c5a37cf78
|
4
|
+
data.tar.gz: c5cba02f795af41d067fd11bd966168453ca608cd6924accdd804d0838ec92be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dff7e203a31bbc6a2249f804df4fe8fc265c6f11c3cf53c8491173ef54da2e498cea472064f050328f9f54a3762b018702285d78d1ee6046cb3f67ca76563b95
|
7
|
+
data.tar.gz: 873081056dd3d5a7d461fb417b4ecc4b698b9767c2ae5935ef510f1293ca6987f8912212583f734a90bde3f9007aa951ca87f0a252a8932ca2d97ba532a4534a
|
File without changes
|
File without changes
|
@@ -3,9 +3,9 @@ class DismissibleBlocksController < ApplicationController
|
|
3
3
|
if current_user_available
|
4
4
|
current_user.dismissed_blocks += [ params[:block].to_s ]
|
5
5
|
current_user.save!
|
6
|
-
render :
|
6
|
+
render json: {}, status: :ok
|
7
7
|
else
|
8
|
-
render :
|
8
|
+
render json: {}, status: :unprocessable_entity
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -27,7 +27,7 @@ module DismissibleBlocksHelper
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def add_block_name_to_attributes(contents, name)
|
30
|
-
contents.gsub!
|
30
|
+
contents.gsub!(/(data-dismissible)(-hide)?(?![-=])/, "\\1\\2='#{name}'")
|
31
31
|
contents.html_safe
|
32
32
|
end
|
33
33
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'dismissible_blocks/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'dismissible_blocks'
|
7
|
+
s.version = DismissibleBlocks::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ['Patrick Bougie']
|
10
|
+
s.email = ['hello@patrickbougie.com']
|
11
|
+
s.summary = 'Dismissible HTML blocks for Ruby on Rails'
|
12
|
+
s.description = 'Dismiss HTML blocks and save state in the database. Engine for Ruby on Rails.'
|
13
|
+
s.homepage = 'https://github.com/pbougie/dismissible_blocks'
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.files = Dir[
|
17
|
+
'{app,config,lib}/**/*',
|
18
|
+
'dismissible_blocks.gemspec',
|
19
|
+
'README.md',
|
20
|
+
'LICENSE.txt'
|
21
|
+
]
|
22
|
+
|
23
|
+
s.add_runtime_dependency 'rails', '>= 3.2'
|
24
|
+
s.add_runtime_dependency 'jquery-rails'
|
25
|
+
|
26
|
+
s.add_development_dependency 'bundler'
|
27
|
+
s.add_development_dependency 'rake'
|
28
|
+
s.add_development_dependency 'sqlite3'
|
29
|
+
s.add_development_dependency 'capybara'
|
30
|
+
s.add_development_dependency 'selenium-webdriver'
|
31
|
+
s.add_development_dependency 'listen'
|
32
|
+
s.add_development_dependency 'puma'
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dismissible_blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Bougie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -108,6 +108,34 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: listen
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: puma
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
111
139
|
description: Dismiss HTML blocks and save state in the database. Engine for Ruby on
|
112
140
|
Rails.
|
113
141
|
email:
|
@@ -116,78 +144,18 @@ executables: []
|
|
116
144
|
extensions: []
|
117
145
|
extra_rdoc_files: []
|
118
146
|
files:
|
119
|
-
-
|
120
|
-
-
|
121
|
-
- README.markdown
|
122
|
-
- Rakefile
|
147
|
+
- LICENSE.txt
|
148
|
+
- README.md
|
123
149
|
- app/assets/javascripts/dismissible_blocks.js
|
124
150
|
- app/assets/javascripts/dismissible_blocks_loader.js
|
125
151
|
- app/controllers/dismissible_blocks_controller.rb
|
126
152
|
- app/helpers/dismissible_blocks_helper.rb
|
127
153
|
- config/routes.rb
|
154
|
+
- dismissible_blocks.gemspec
|
128
155
|
- lib/dismissible_blocks.rb
|
129
156
|
- lib/dismissible_blocks/controllers/helpers.rb
|
130
157
|
- lib/dismissible_blocks/engine.rb
|
131
158
|
- lib/dismissible_blocks/version.rb
|
132
|
-
- test/capybara_helper.rb
|
133
|
-
- test/controllers/dismissible_blocks_controller_test.rb
|
134
|
-
- test/dummy/Rakefile
|
135
|
-
- test/dummy/app/assets/javascripts/application.js
|
136
|
-
- test/dummy/app/assets/stylesheets/application.css
|
137
|
-
- test/dummy/app/controllers/application_controller.rb
|
138
|
-
- test/dummy/app/controllers/landings_controller.rb
|
139
|
-
- test/dummy/app/controllers/sessions_controller.rb
|
140
|
-
- test/dummy/app/helpers/application_helper.rb
|
141
|
-
- test/dummy/app/helpers/landings_helper.rb
|
142
|
-
- test/dummy/app/helpers/sessions_helper.rb
|
143
|
-
- test/dummy/app/models/user.rb
|
144
|
-
- test/dummy/app/views/landings/show.html.erb
|
145
|
-
- test/dummy/app/views/layouts/application.html.erb
|
146
|
-
- test/dummy/app/views/sessions/new.html.erb
|
147
|
-
- test/dummy/bin/bundle
|
148
|
-
- test/dummy/bin/rails
|
149
|
-
- test/dummy/bin/rake
|
150
|
-
- test/dummy/bin/setup
|
151
|
-
- test/dummy/config.ru
|
152
|
-
- test/dummy/config/application.rb
|
153
|
-
- test/dummy/config/boot.rb
|
154
|
-
- test/dummy/config/database.yml
|
155
|
-
- test/dummy/config/environment.rb
|
156
|
-
- test/dummy/config/environments/development.rb
|
157
|
-
- test/dummy/config/environments/test.rb
|
158
|
-
- test/dummy/config/initializers/assets.rb
|
159
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
160
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
161
|
-
- test/dummy/config/initializers/session_store.rb
|
162
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
163
|
-
- test/dummy/config/routes.rb
|
164
|
-
- test/dummy/config/secrets.yml
|
165
|
-
- test/dummy/db/migrate/20140303154458_create_users.rb
|
166
|
-
- test/dummy/db/migrate/20140303161500_add_dismissed_blocks_to_users.rb
|
167
|
-
- test/dummy/db/schema.rb
|
168
|
-
- test/dummy/db/test.sqlite3
|
169
|
-
- test/dummy/log/test.log
|
170
|
-
- test/dummy/public/404.html
|
171
|
-
- test/dummy/public/422.html
|
172
|
-
- test/dummy/public/500.html
|
173
|
-
- test/dummy/public/favicon.ico
|
174
|
-
- test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
175
|
-
- test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
176
|
-
- test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
177
|
-
- test/dummy/tmp/cache/assets/test/sprockets/58a8328804a777933d757eb9a448eaf5
|
178
|
-
- test/dummy/tmp/cache/assets/test/sprockets/68b2c32b107dd99071629b05c392d6cd
|
179
|
-
- test/dummy/tmp/cache/assets/test/sprockets/96c147c638b08a4c0178d9c66c3b9c48
|
180
|
-
- test/dummy/tmp/cache/assets/test/sprockets/a303e31a3b163f257d2061cd9abb98d2
|
181
|
-
- test/dummy/tmp/cache/assets/test/sprockets/ac2d5385dbcd9cea11c510dc83189bba
|
182
|
-
- test/dummy/tmp/cache/assets/test/sprockets/bec12e1e92fe458e19b5f9869454ac1a
|
183
|
-
- test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
184
|
-
- test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
185
|
-
- test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
186
|
-
- test/features/dismissible_blocks_test.rb
|
187
|
-
- test/fixtures/users.yml
|
188
|
-
- test/helpers/dismissible_blocks_helper_test.rb
|
189
|
-
- test/lib/controllers/helpers_test.rb
|
190
|
-
- test/test_helper.rb
|
191
159
|
homepage: https://github.com/pbougie/dismissible_blocks
|
192
160
|
licenses:
|
193
161
|
- MIT
|
@@ -208,67 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
176
|
version: '0'
|
209
177
|
requirements: []
|
210
178
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.
|
179
|
+
rubygems_version: 2.7.6
|
212
180
|
signing_key:
|
213
181
|
specification_version: 4
|
214
182
|
summary: Dismissible HTML blocks for Ruby on Rails
|
215
|
-
test_files:
|
216
|
-
- test/capybara_helper.rb
|
217
|
-
- test/controllers/dismissible_blocks_controller_test.rb
|
218
|
-
- test/dummy/app/assets/javascripts/application.js
|
219
|
-
- test/dummy/app/assets/stylesheets/application.css
|
220
|
-
- test/dummy/app/controllers/application_controller.rb
|
221
|
-
- test/dummy/app/controllers/landings_controller.rb
|
222
|
-
- test/dummy/app/controllers/sessions_controller.rb
|
223
|
-
- test/dummy/app/helpers/application_helper.rb
|
224
|
-
- test/dummy/app/helpers/landings_helper.rb
|
225
|
-
- test/dummy/app/helpers/sessions_helper.rb
|
226
|
-
- test/dummy/app/models/user.rb
|
227
|
-
- test/dummy/app/views/landings/show.html.erb
|
228
|
-
- test/dummy/app/views/layouts/application.html.erb
|
229
|
-
- test/dummy/app/views/sessions/new.html.erb
|
230
|
-
- test/dummy/bin/bundle
|
231
|
-
- test/dummy/bin/rails
|
232
|
-
- test/dummy/bin/rake
|
233
|
-
- test/dummy/bin/setup
|
234
|
-
- test/dummy/config/application.rb
|
235
|
-
- test/dummy/config/boot.rb
|
236
|
-
- test/dummy/config/database.yml
|
237
|
-
- test/dummy/config/environment.rb
|
238
|
-
- test/dummy/config/environments/development.rb
|
239
|
-
- test/dummy/config/environments/test.rb
|
240
|
-
- test/dummy/config/initializers/assets.rb
|
241
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
242
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
243
|
-
- test/dummy/config/initializers/session_store.rb
|
244
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
245
|
-
- test/dummy/config/routes.rb
|
246
|
-
- test/dummy/config/secrets.yml
|
247
|
-
- test/dummy/config.ru
|
248
|
-
- test/dummy/db/migrate/20140303154458_create_users.rb
|
249
|
-
- test/dummy/db/migrate/20140303161500_add_dismissed_blocks_to_users.rb
|
250
|
-
- test/dummy/db/schema.rb
|
251
|
-
- test/dummy/db/test.sqlite3
|
252
|
-
- test/dummy/log/test.log
|
253
|
-
- test/dummy/public/404.html
|
254
|
-
- test/dummy/public/422.html
|
255
|
-
- test/dummy/public/500.html
|
256
|
-
- test/dummy/public/favicon.ico
|
257
|
-
- test/dummy/Rakefile
|
258
|
-
- test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
259
|
-
- test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
260
|
-
- test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
261
|
-
- test/dummy/tmp/cache/assets/test/sprockets/58a8328804a777933d757eb9a448eaf5
|
262
|
-
- test/dummy/tmp/cache/assets/test/sprockets/68b2c32b107dd99071629b05c392d6cd
|
263
|
-
- test/dummy/tmp/cache/assets/test/sprockets/96c147c638b08a4c0178d9c66c3b9c48
|
264
|
-
- test/dummy/tmp/cache/assets/test/sprockets/a303e31a3b163f257d2061cd9abb98d2
|
265
|
-
- test/dummy/tmp/cache/assets/test/sprockets/ac2d5385dbcd9cea11c510dc83189bba
|
266
|
-
- test/dummy/tmp/cache/assets/test/sprockets/bec12e1e92fe458e19b5f9869454ac1a
|
267
|
-
- test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
268
|
-
- test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
269
|
-
- test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
270
|
-
- test/features/dismissible_blocks_test.rb
|
271
|
-
- test/fixtures/users.yml
|
272
|
-
- test/helpers/dismissible_blocks_helper_test.rb
|
273
|
-
- test/lib/controllers/helpers_test.rb
|
274
|
-
- test/test_helper.rb
|
183
|
+
test_files: []
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
6
|
-
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
11
|
-
rdoc.title = 'DismissibleBlocks'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.rdoc')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
16
|
-
|
17
|
-
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
-
load 'rails/tasks/engine.rake'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
Bundler::GemHelper.install_tasks
|
23
|
-
|
24
|
-
require 'rake/testtask'
|
25
|
-
|
26
|
-
Rake::TestTask.new(:test) do |t|
|
27
|
-
t.libs << 'lib'
|
28
|
-
t.libs << 'test'
|
29
|
-
t.pattern = 'test/**/*_test.rb'
|
30
|
-
t.verbose = false
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
task default: :test
|
data/test/capybara_helper.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'capybara/rails'
|
3
|
-
|
4
|
-
class ActionDispatch::IntegrationTest
|
5
|
-
include Capybara::DSL
|
6
|
-
self.fixture_path = File.expand_path('../fixtures', __FILE__)
|
7
|
-
|
8
|
-
def login(user)
|
9
|
-
visit login_path
|
10
|
-
fill_in 'Username', with: user.username
|
11
|
-
fill_in 'Password', with: user.password
|
12
|
-
click_button 'Login'
|
13
|
-
assert current_path == landing_path
|
14
|
-
assert page.has_content? 'You have been logged in.'
|
15
|
-
end
|
16
|
-
|
17
|
-
def logout
|
18
|
-
visit logout_path
|
19
|
-
assert current_path == login_path
|
20
|
-
assert page.has_content? 'You have been logged out.'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# Prevent database locks when testing AJAX features
|
25
|
-
# https://github.com/jnicklas/capybara#transactions-and-database-setup
|
26
|
-
class ActiveRecord::Base
|
27
|
-
mattr_accessor :shared_connection
|
28
|
-
@@shared_connection = nil
|
29
|
-
|
30
|
-
def self.connection
|
31
|
-
@@shared_connection || retrieve_connection
|
32
|
-
end
|
33
|
-
end
|
34
|
-
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class DismissibleBlocksControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
test "dismiss block via ajax" do
|
6
|
-
session[:username] = users(:one).username # Login
|
7
|
-
refute users(:one).dismissed_blocks.include?('lorem')
|
8
|
-
xhr :post, :create, block: 'lorem', format: 'json'
|
9
|
-
users(:one).reload
|
10
|
-
assert users(:one).dismissed_blocks.include?('lorem')
|
11
|
-
assert_response :ok
|
12
|
-
end
|
13
|
-
|
14
|
-
test "dismiss block fails via ajax; not logged in" do
|
15
|
-
xhr :post, :create, block: 'lorem', format: 'json'
|
16
|
-
assert_response :unprocessable_entity
|
17
|
-
end
|
18
|
-
end
|
data/test/dummy/Rakefile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*= require_self
|
3
|
-
*/
|
4
|
-
|
5
|
-
.flash, .block {
|
6
|
-
border: 2px solid #333;
|
7
|
-
padding: 10px 20px;
|
8
|
-
background-color: #eee;
|
9
|
-
}
|
10
|
-
.flash-alert {
|
11
|
-
border-color: #ebccd1;
|
12
|
-
background-color: #f2dede;
|
13
|
-
}
|
14
|
-
.flash-notice {
|
15
|
-
border-color: #bce8f1;
|
16
|
-
background-color: #d9edf7;
|
17
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
class ApplicationController < ActionController::Base
|
2
|
-
protect_from_forgery with: :exception
|
3
|
-
|
4
|
-
def current_user
|
5
|
-
if session[:username].present?
|
6
|
-
@current_user ||= User.find_by(username: session[:username])
|
7
|
-
end
|
8
|
-
end
|
9
|
-
helper_method :current_user
|
10
|
-
|
11
|
-
def check_authentication
|
12
|
-
unless session[:username].present?
|
13
|
-
raise Dummy::Unauthorized
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def authenticated?
|
18
|
-
session[:username].present?
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
def signin(username)
|
23
|
-
session[:username] = username
|
24
|
-
end
|
25
|
-
|
26
|
-
def signout
|
27
|
-
reset_session
|
28
|
-
end
|
29
|
-
end
|