padrino-admin 0.7.9 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,11 +44,11 @@ it:
44
44
  nameText: "Nome"
45
45
  valueText: "Valore"
46
46
  dateFormat: "j/m/Y"
47
- search:
48
- searchText: "Cerca"
49
- searchTipText: "Inserisci una parola o premi cerca"
50
- selectAllText: "Seleziona Tutto"
51
- minCharsTipText: "Inserisci almeno {0} caratteri"
47
+ search:
48
+ searchText: "Cerca"
49
+ searchTipText: "Inserisci una parola o premi cerca"
50
+ selectAllText: "Seleziona Tutto"
51
+ minCharsTipText: "Inserisci almeno {0} caratteri"
52
52
  pagingToolbar:
53
53
  beforePageText: "Pagina"
54
54
  afterPageText: "di {0}"
@@ -4,18 +4,11 @@ module Padrino
4
4
  module Admin
5
5
  module Middleware
6
6
  ##
7
- # FlashSessionCookieMiddleware
8
- # passing your session in the URI, when it should be in the cookie
9
- #
10
- # This code only works in following cases:
11
- # - passing the session as the variable for 'session_key' (it is best to set this to your app's session cookie name
12
- # - the value is URI escaped once, (don't do it explicetally if using rails helpers, they do it for you)
13
- # - Loading this middleware before session_store middleware
14
- #
15
- # Note, this could work also after session_store middleware (or others).
16
- # However, these could already have modified the cooky values, and this module
17
- # could become unstable because of that, and it's functioning can not be
18
- # guaranteed.
7
+ # FlashMiddleware help you passing your session in the URI, when it should be in the cookie.
8
+ #
9
+ # This code it's only performed when:
10
+ #
11
+ # env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
19
12
  #
20
13
  class FlashMiddleware
21
14
  def initialize(app, session_key = 'session_id')
@@ -11,6 +11,13 @@ module Padrino
11
11
  #
12
12
  module Orm
13
13
 
14
+ ##
15
+ # ExtSearch it's the result of an ext_search
16
+ #
17
+ # result = Account.ext_search(..)
18
+ # result.count
19
+ # result.records
20
+ #
14
21
  class ExtSearch < Struct.new(:count, :records); end
15
22
 
16
23
  ##
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{padrino-admin}
8
- s.version = "0.7.9"
8
+ s.version = "0.8.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
12
- s.date = %q{2010-02-11}
12
+ s.date = %q{2010-02-14}
13
13
  s.description = %q{Admin View for Padrino applications}
14
14
  s.email = %q{padrinorb@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -318,8 +318,8 @@ Gem::Specification.new do |s|
318
318
  "lib/padrino-admin/generators/templates/uploader/lib/uploader.rb",
319
319
  "lib/padrino-admin/generators/templates/uploader/views/grid.js.erb",
320
320
  "lib/padrino-admin/generators/templates/uploader/views/store.jml",
321
- "lib/padrino-admin/helpers/authentication.rb",
322
- "lib/padrino-admin/helpers/view.rb",
321
+ "lib/padrino-admin/helpers/authentication_helpers.rb",
322
+ "lib/padrino-admin/helpers/view_helpers.rb",
323
323
  "lib/padrino-admin/locale/admin/de.yml",
324
324
  "lib/padrino-admin/locale/admin/en.yml",
325
325
  "lib/padrino-admin/locale/admin/it.yml",
@@ -342,11 +342,15 @@ Gem::Specification.new do |s|
342
342
  "test/fixtures/data_mapper.rb",
343
343
  "test/fixtures/mongo_mapper.rb",
344
344
  "test/fixtures/test_column_store.jml",
345
+ "test/generators/test_admin_app_generator.rb",
346
+ "test/generators/test_admin_page_generator.rb",
347
+ "test/generators/test_admin_uploader_generator.rb",
345
348
  "test/helper.rb",
346
349
  "test/test_access_control.rb",
347
350
  "test/test_active_record.rb",
348
351
  "test/test_admin_application.rb",
349
352
  "test/test_column_store.rb",
353
+ "test/test_config.rb",
350
354
  "test/test_data_mapper.rb",
351
355
  "test/test_mongo_mapper.rb"
352
356
  ]
@@ -363,9 +367,9 @@ Gem::Specification.new do |s|
363
367
 
364
368
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
365
369
  s.add_runtime_dependency(%q<json_pure>, [">= 1.2.0"])
366
- s.add_runtime_dependency(%q<padrino-core>, ["= 0.7.9"])
367
- s.add_runtime_dependency(%q<padrino-gen>, ["= 0.7.9"])
368
- s.add_runtime_dependency(%q<padrino-helpers>, ["= 0.7.9"])
370
+ s.add_runtime_dependency(%q<padrino-core>, ["= 0.8.0"])
371
+ s.add_runtime_dependency(%q<padrino-gen>, ["= 0.8.0"])
372
+ s.add_runtime_dependency(%q<padrino-helpers>, ["= 0.8.0"])
369
373
  s.add_runtime_dependency(%q<tilt>, [">= 0.4"])
370
374
  s.add_development_dependency(%q<haml>, [">= 2.2.1"])
371
375
  s.add_development_dependency(%q<shoulda>, [">= 0"])
@@ -374,9 +378,9 @@ Gem::Specification.new do |s|
374
378
  s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
375
379
  else
376
380
  s.add_dependency(%q<json_pure>, [">= 1.2.0"])
377
- s.add_dependency(%q<padrino-core>, ["= 0.7.9"])
378
- s.add_dependency(%q<padrino-gen>, ["= 0.7.9"])
379
- s.add_dependency(%q<padrino-helpers>, ["= 0.7.9"])
381
+ s.add_dependency(%q<padrino-core>, ["= 0.8.0"])
382
+ s.add_dependency(%q<padrino-gen>, ["= 0.8.0"])
383
+ s.add_dependency(%q<padrino-helpers>, ["= 0.8.0"])
380
384
  s.add_dependency(%q<tilt>, [">= 0.4"])
381
385
  s.add_dependency(%q<haml>, [">= 2.2.1"])
382
386
  s.add_dependency(%q<shoulda>, [">= 0"])
@@ -386,9 +390,9 @@ Gem::Specification.new do |s|
386
390
  end
387
391
  else
388
392
  s.add_dependency(%q<json_pure>, [">= 1.2.0"])
389
- s.add_dependency(%q<padrino-core>, ["= 0.7.9"])
390
- s.add_dependency(%q<padrino-gen>, ["= 0.7.9"])
391
- s.add_dependency(%q<padrino-helpers>, ["= 0.7.9"])
393
+ s.add_dependency(%q<padrino-core>, ["= 0.8.0"])
394
+ s.add_dependency(%q<padrino-gen>, ["= 0.8.0"])
395
+ s.add_dependency(%q<padrino-helpers>, ["= 0.8.0"])
392
396
  s.add_dependency(%q<tilt>, [">= 0.4"])
393
397
  s.add_dependency(%q<haml>, [">= 2.2.1"])
394
398
  s.add_dependency(%q<shoulda>, [">= 0"])
@@ -0,0 +1,67 @@
1
+ require File.dirname(__FILE__) + '/../helper'
2
+ require 'thor/group'
3
+ require 'fakeweb'
4
+ require 'padrino-gen/generators/actions'
5
+ Dir[File.dirname(__FILE__) + '/generators/{components}/**/*.rb'].each { |lib| require lib }
6
+
7
+ class TestAdminAppGenerator < Test::Unit::TestCase
8
+
9
+ def setup
10
+ `rm -rf /tmp/sample_project`
11
+ @project = Padrino::Generators::Project.dup
12
+ @admin = Padrino::Generators::AdminApp.dup
13
+ end
14
+
15
+ context 'the admin app generator' do
16
+
17
+ should 'fail outside app root' do
18
+ output = silence_logger { @admin.start(['-r=/tmp/sample_project']) }
19
+ assert_match(/not at the root/, output)
20
+ assert_no_file_exists('/tmp/admin')
21
+ end
22
+
23
+ should 'fail if we don\'t an orm' do
24
+ assert_nothing_raised { silence_logger { @project.start(['sample_project', '--root=/tmp']) } }
25
+ assert_raise(SystemExit) { silence_logger { @admin.start(['-r=/tmp/sample_project']) } }
26
+ end
27
+
28
+ should 'fail if we don\'t avalid orm' do
29
+ assert_nothing_raised { silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=sequel']) } }
30
+ assert_raise(SystemExit) { silence_logger { @admin.start(['-r=/tmp/sample_project']) } }
31
+ end
32
+
33
+ should 'correctyl generate a new padrino admin application' do
34
+ assert_nothing_raised { silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=activerecord']) } }
35
+ assert_nothing_raised { silence_logger { @admin.start(['--root=/tmp/sample_project']) } }
36
+ assert_file_exists('/tmp/sample_project')
37
+ assert_file_exists('/tmp/sample_project/admin')
38
+ assert_file_exists('/tmp/sample_project/admin/app.rb')
39
+ assert_file_exists('/tmp/sample_project/admin/controllers')
40
+ assert_file_exists('/tmp/sample_project/admin/controllers/accounts.rb')
41
+ assert_file_exists('/tmp/sample_project/admin/controllers/base.rb')
42
+ assert_file_exists('/tmp/sample_project/admin/controllers/javascripts.rb')
43
+ assert_file_exists('/tmp/sample_project/admin/controllers/sessions.rb')
44
+ assert_file_exists('/tmp/sample_project/admin/views')
45
+ assert_file_exists('/tmp/sample_project/admin/views/accounts/_form.haml')
46
+ assert_file_exists('/tmp/sample_project/admin/views/accounts/edit.haml')
47
+ assert_file_exists('/tmp/sample_project/admin/views/accounts/grid.js.erb')
48
+ assert_file_exists('/tmp/sample_project/admin/views/accounts/new.haml')
49
+ assert_file_exists('/tmp/sample_project/admin/views/accounts/store.jml')
50
+ assert_file_exists('/tmp/sample_project/admin/views/base/dashboard.haml')
51
+ assert_file_exists('/tmp/sample_project/admin/views/base/index.haml')
52
+ assert_file_exists('/tmp/sample_project/admin/views/javascripts/admin.js.erb')
53
+ assert_file_exists('/tmp/sample_project/admin/views/javascripts/locale.js.erb')
54
+ assert_file_exists('/tmp/sample_project/admin/views/sessions/new.haml')
55
+ assert_file_exists('/tmp/sample_project/public/admin')
56
+ assert_file_exists('/tmp/sample_project/public/admin/flash')
57
+ assert_file_exists('/tmp/sample_project/public/admin/images')
58
+ assert_file_exists('/tmp/sample_project/public/admin/javascripts')
59
+ assert_file_exists('/tmp/sample_project/public/admin/stylesheets')
60
+ assert_file_exists('/tmp/sample_project/app/models/account.rb')
61
+ assert_file_exists('/tmp/sample_project/db/seeds.rb')
62
+ assert_match_in_file "gem 'haml'", '/tmp/sample_project/Gemfile'
63
+ assert_match_in_file 'Padrino.mount("Admin").to("/admin")', '/tmp/sample_project/config/apps.rb'
64
+ assert_match_in_file 'class Admin < Padrino::Application', '/tmp/sample_project/admin/app.rb'
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/../helper'
2
+ require 'thor/group'
3
+ require 'fakeweb'
4
+ require 'padrino-gen/generators/actions'
5
+ Dir[File.dirname(__FILE__) + '/generators/{components}/**/*.rb'].each { |lib| require lib }
6
+
7
+ class Person
8
+ def self.properties
9
+ [:id, :name, :age, :email].map { |c| OpenStruct.new(:name => c) }
10
+ end
11
+ end
12
+
13
+ class TestAdminPageGenerator < Test::Unit::TestCase
14
+
15
+ def setup
16
+ `rm -rf /tmp/sample_project`
17
+ @project = Padrino::Generators::Project.dup
18
+ @admin = Padrino::Generators::AdminApp.dup
19
+ @page = Padrino::Generators::AdminPage.dup
20
+ @model = Padrino::Generators::Model.dup
21
+ end
22
+
23
+ context 'the admin page generator' do
24
+
25
+ should 'fail outside app root' do
26
+ output = silence_logger { @page.start(['foo', '-r=/tmp/sample_project']) }
27
+ assert_match(/not at the root/, output)
28
+ assert_no_file_exists('/tmp/admin')
29
+ end
30
+
31
+ should 'fail without argument and model' do
32
+ silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=activerecord']) }
33
+ silence_logger { @admin.start(['--root=/tmp/sample_project']) }
34
+ assert_raise(NameError) { @page.start(['foo', '-r=/tmp/sample_project']) }
35
+ end
36
+
37
+ should 'correctyl generate a new padrino admin application' do
38
+ 'Person'.classify.constantize
39
+ silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=datamapper']) }
40
+ silence_logger { @admin.start(['--root=/tmp/sample_project']) }
41
+ silence_logger { @model.start(['person', "name:string", "age:integer", "email:string", '-root=/tmp/sample_project']) }
42
+ silence_logger { @page.start(['person', '--root=/tmp/sample_project']) }
43
+ assert_file_exists '/tmp/sample_project/admin/controllers/people.rb'
44
+ assert_file_exists '/tmp/sample_project/admin/views/people/_form.haml'
45
+ assert_file_exists '/tmp/sample_project/admin/views/people/edit.haml'
46
+ assert_file_exists '/tmp/sample_project/admin/views/people/grid.js.erb'
47
+ assert_file_exists '/tmp/sample_project/admin/views/people/new.haml'
48
+ assert_file_exists '/tmp/sample_project/admin/views/people/store.jml'
49
+ %w(name age email).each do |field|
50
+ assert_match_in_file "label :#{field}", '/tmp/sample_project/admin/views/people/_form.haml'
51
+ assert_match_in_file "text_field :#{field}", '/tmp/sample_project/admin/views/people/_form.haml'
52
+ end
53
+ assert_match_in_file 'role.project_module :people do |project|
54
+ project.menu :list, "/admin/people.js"
55
+ project.menu :new, "/admin/people/new"
56
+ end', '/tmp/sample_project/admin/app.rb'
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,56 @@
1
+ require File.dirname(__FILE__) + '/../helper'
2
+ require 'thor/group'
3
+ require 'fakeweb'
4
+ require 'padrino-gen/generators/actions'
5
+ Dir[File.dirname(__FILE__) + '/generators/{components}/**/*.rb'].each { |lib| require lib }
6
+
7
+ class TestAdminUploaderGenerator < Test::Unit::TestCase
8
+
9
+ def setup
10
+ `rm -rf /tmp/sample_project`
11
+ @project = Padrino::Generators::Project.dup
12
+ @admin = Padrino::Generators::AdminApp.dup
13
+ @uploader = Padrino::Generators::AdminUploader.dup
14
+ end
15
+
16
+ context 'the admin uploader generator' do
17
+
18
+ should 'fail outside app root' do
19
+ output = silence_logger { @uploader.start(['-r=/tmp/sample_project']) }
20
+ assert_match(/not at the root/, output)
21
+ assert_no_file_exists('/tmp/admin')
22
+ end
23
+
24
+ should 'fail if we don\'t have admin application' do
25
+ assert_nothing_raised { silence_logger { @project.start(['sample_project', '--root=/tmp']) } }
26
+ assert_raise(SystemExit) { silence_logger { @uploader.start(['-r=/tmp/sample_project']) } }
27
+ end
28
+
29
+ should 'correctyl generate a new padrino admin application for activerecord' do
30
+ assert_nothing_raised { silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=activerecord']) } }
31
+ assert_nothing_raised { silence_logger { @admin.start(['--root=/tmp/sample_project']) } }
32
+ assert_nothing_raised { silence_logger { @uploader.start(['--root=/tmp/sample_project']) } }
33
+ assert_file_exists '/tmp/sample_project/admin/controllers/uploads.rb'
34
+ assert_file_exists '/tmp/sample_project/admin/views/uploads/grid.js.erb'
35
+ assert_file_exists '/tmp/sample_project/admin/views/uploads/store.jml'
36
+ assert_file_exists '/tmp/sample_project/lib/uploader.rb'
37
+ assert_match_in_file 'mount_uploader :file, Uploader', '/tmp/sample_project/app/models/upload.rb'
38
+ assert_match_in_file "\n# Uploader requirements\n# gem 'mini_magick'\ngem 'carrierwave'\n", "/tmp/sample_project/Gemfile"
39
+ assert_match_in_file "role.project_module :uploads, \"/admin/uploads.js\"", '/tmp/sample_project/admin/app.rb'
40
+ end
41
+
42
+ should 'correctyl generate a new padrino admin application for datamapper' do
43
+ assert_nothing_raised { silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=datamapper']) } }
44
+ assert_nothing_raised { silence_logger { @admin.start(['--root=/tmp/sample_project']) } }
45
+ assert_nothing_raised { silence_logger { @uploader.start(['--root=/tmp/sample_project']) } }
46
+ assert_file_exists '/tmp/sample_project/admin/controllers/uploads.rb'
47
+ assert_file_exists '/tmp/sample_project/admin/views/uploads/grid.js.erb'
48
+ assert_file_exists '/tmp/sample_project/admin/views/uploads/store.jml'
49
+ assert_file_exists '/tmp/sample_project/lib/uploader.rb'
50
+ assert_match_in_file 'property :file, String, :auto_validation => false', '/tmp/sample_project/app/models/upload.rb'
51
+ assert_match_in_file 'mount_uploader :file, Uploader', '/tmp/sample_project/app/models/upload.rb'
52
+ assert_match_in_file "\n# Uploader requirements\n# gem 'mini_magick'\ngem 'carrierwave'\n", "/tmp/sample_project/Gemfile"
53
+ assert_match_in_file "role.project_module :uploads, \"/admin/uploads.js\"", '/tmp/sample_project/admin/app.rb'
54
+ end
55
+ end
56
+ end
data/test/helper.rb CHANGED
@@ -16,6 +16,9 @@ end
16
16
 
17
17
  require 'padrino-admin'
18
18
 
19
+ Padrino::Generators.setup!
20
+ Padrino::Generators.lockup!
21
+
19
22
  module Kernel
20
23
  # Silences the output by redirecting to stringIO
21
24
  # silence_logger { ...commands... } => "...output..."
@@ -49,6 +52,7 @@ class Test::Unit::TestCase
49
52
  # the application.
50
53
  def mock_app(base=Padrino::Application, &block)
51
54
  @app = Sinatra.new(base, &block)
55
+ @app.send :include, Test::Unit::Assertions
52
56
  @app.use Rack::Session::Cookie if Sinatra::VERSION =~ /0\.9\.\d+/ # Need this because Sinatra 0.9.x have use Rack::Session::Cookie if sessions? && !test?
53
57
  end
54
58
 
@@ -62,6 +66,25 @@ class Test::Unit::TestCase
62
66
  assert_match pattern, File.read(file)
63
67
  end
64
68
 
69
+ # Assert_file_exists('/tmp/app')
70
+ def assert_file_exists(file_path)
71
+ assert File.exist?(file_path), "File at path '#{file_path}' does not exist!"
72
+ end
73
+
74
+ # Assert_no_file_exists('/tmp/app')
75
+ def assert_no_file_exists(file_path)
76
+ assert !File.exist?(file_path), "File should not exist at path '#{file_path}' but was found!"
77
+ end
78
+
79
+ # Asserts that a file matches the pattern
80
+ def assert_match_in_file(pattern, file)
81
+ File.exist?(file) ? assert_match(pattern, File.read(file)) : assert_file_exists(file)
82
+ end
83
+
84
+ def assert_no_match_in_file(pattern, file)
85
+ File.exists?(file) ? !assert_match(pattern, File.read(file)) : assert_file_exists(file)
86
+ end
87
+
65
88
  # Delegate other missing methods to response.
66
89
  def method_missing(name, *args, &block)
67
90
  if response && response.respond_to?(name)
@@ -31,6 +31,7 @@ class TestAccessControl < Test::Unit::TestCase
31
31
  account.categories.each do |category|
32
32
  project.menu category.name, "/admin/categories/#{category.id}.js"
33
33
  end
34
+ project.menu :foo
34
35
  end
35
36
  end
36
37
  end
@@ -86,8 +87,8 @@ class TestAccessControl < Test::Unit::TestCase
86
87
  end
87
88
 
88
89
  should 'check a module config' do
89
- menu = Account.editor.categories.collect { |c| { :text => c.name, :handler => "function(){ Admin.app.load('/admin/categories/#{c.id}.js') }" } }
90
- assert_equal [{ :text => "Categories", :menu => menu }], @access.auths(Account.editor).project_modules.collect(&:config)
90
+ menu = Account.editor.categories.map { |c| { :text => c.name, :handler => "function(){ Admin.app.load('/admin/categories/#{c.id}.js') }" } }
91
+ assert_equal [{ :text => "Categories", :menu => menu + ["Foo"] }], @access.auths(Account.editor).project_modules.collect(&:config)
91
92
  end
92
93
 
93
94
  should 'check config handlers' do
@@ -39,6 +39,8 @@ class TestActiveRecord < Test::Unit::TestCase
39
39
  assert_respond_to Account, :properties
40
40
  assert_respond_to Account, :count
41
41
  assert_respond_to Account, :orm
42
+ assert_equal "Name", Account.human_local_attribute_name(:name)
43
+ assert_equal "Account", Account.human_local_name
42
44
  end
43
45
 
44
46
  should 'have errors_keys' do
@@ -6,33 +6,84 @@ class TestAdminApplication < Test::Unit::TestCase
6
6
  load_fixture 'data_mapper'
7
7
  end
8
8
 
9
- should 'set basic roles' do
9
+ should 'require correctly login' do
10
10
  mock_app do
11
11
  enable :authentication
12
12
  set :app_name, :test_me
13
- set :use_orm, :datamapper
13
+ set :use_orm, :datamapper
14
14
 
15
15
  # Do a simple mapping
16
16
  access_control.roles_for :any do |role|
17
17
  role.allow "/"
18
- role.deny "/foo"
18
+ role.require_login "/foo"
19
+ end
20
+
21
+ get "/foo", :respond_to => [:html, :js] do
22
+ "foo"
23
+ end
24
+ end
25
+
26
+ get "/foo"
27
+ assert_equal "You don't have permission for this resource", body
28
+
29
+ get "/foo.js"
30
+ assert_equal "alert('Protected resource')", body
31
+ end
32
+
33
+ should 'set basic roles with store location and login page' do
34
+ mock_app do
35
+ enable :authentication
36
+ enable :store_location
37
+ set :login_page, "/login"
38
+ set :app_name, :test_me
39
+ set :use_orm, :datamapper
40
+
41
+ # Do a simple mapping
42
+ access_control.roles_for :any do |role|
43
+ role.allow "/"
44
+ role.require_login "/foo"
19
45
  end
20
46
 
21
47
  # Prepare a basic page
22
- get("/login") do
48
+ get "/login" do
49
+ assert_equal "[]", admin_menu
50
+ redirect_back_or_default("/foo") if logged_in?
23
51
  set_current_account(Account.admin)
52
+ "login page"
24
53
  end
25
54
 
26
- get("/foo") do
55
+ get "/foo" do
27
56
  "foo"
28
57
  end
29
58
  end
30
-
31
- get "/login"
32
- assert_equal 200, status
33
-
59
+
34
60
  get "/foo"
35
- assert_not_equal "foo", body
61
+ follow_redirect!
62
+ assert_equal "login page", body
63
+
64
+ get "/login"
65
+ follow_redirect!
66
+ assert_equal "foo", body
67
+ end
68
+
69
+ should 'use correclty flash middleware' do
70
+ mock_app do
71
+ use Padrino::Admin::Middleware::FlashMiddleware, :session_id
72
+
73
+ get "/set_session_id" do
74
+ params[:session_id]
75
+ end
76
+
77
+ get "/get_session_id" do
78
+ session[:session_id]
79
+ end
80
+ end
81
+
82
+ get "/set_session_id", { :session_id => 24 }, 'HTTP_USER_AGENT' => 'Adobe Flash'
83
+ assert_equal "24", body
84
+
85
+ get "/get_session_id"
86
+ assert_equal "24", body
36
87
  end
37
88
 
38
89
  end