paloma 4.2.1 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +5 -5
  2. data/app/views/paloma/_hook.html.erb +10 -13
  3. data/lib/paloma/action_controller_extension.rb +4 -4
  4. data/lib/paloma/controller.rb +13 -4
  5. data/lib/paloma/test_helper.rb +7 -0
  6. data/vendor/assets/javascripts/paloma/base_controller.js +8 -0
  7. data/vendor/assets/javascripts/paloma/before_callback_performer.js +69 -0
  8. data/vendor/assets/javascripts/paloma/controller_builder.js +36 -0
  9. data/vendor/assets/javascripts/paloma/controller_class_factory.js +62 -0
  10. data/vendor/assets/javascripts/paloma/engine.js +59 -53
  11. data/vendor/assets/javascripts/paloma/index.js +5 -4
  12. data/vendor/assets/javascripts/paloma/init.js +5 -10
  13. data/vendor/assets/javascripts/paloma/paloma.js +20 -21
  14. metadata +18 -88
  15. data/.gitignore +0 -5
  16. data/Changelog.md +0 -42
  17. data/DEVELOPMENT.md +0 -15
  18. data/Gemfile +0 -2
  19. data/License +0 -22
  20. data/README.md +0 -353
  21. data/TODO.md +0 -1
  22. data/paloma.gemspec +0 -22
  23. data/test_app/.gitignore +0 -15
  24. data/test_app/.rspec +0 -1
  25. data/test_app/Gemfile +0 -5
  26. data/test_app/README.rdoc +0 -261
  27. data/test_app/Rakefile +0 -11
  28. data/test_app/app/assets/images/rails.png +0 -0
  29. data/test_app/app/assets/javascripts/admin/bar.js +0 -2
  30. data/test_app/app/assets/javascripts/application.js +0 -68
  31. data/test_app/app/assets/stylesheets/admin/bar.css +0 -4
  32. data/test_app/app/assets/stylesheets/application.css +0 -13
  33. data/test_app/app/assets/stylesheets/foo.css +0 -4
  34. data/test_app/app/assets/stylesheets/main.css +0 -4
  35. data/test_app/app/assets/stylesheets/multiple_names.css +0 -4
  36. data/test_app/app/controllers/admin/foos_controller.rb +0 -29
  37. data/test_app/app/controllers/application_controller.rb +0 -3
  38. data/test_app/app/controllers/main_controller.rb +0 -111
  39. data/test_app/app/helpers/admin/bar_helper.rb +0 -2
  40. data/test_app/app/helpers/application_helper.rb +0 -2
  41. data/test_app/app/helpers/foo_helper.rb +0 -2
  42. data/test_app/app/helpers/main_helper.rb +0 -2
  43. data/test_app/app/helpers/multiple_names_helper.rb +0 -2
  44. data/test_app/app/mailers/.gitkeep +0 -0
  45. data/test_app/app/models/.gitkeep +0 -0
  46. data/test_app/app/views/layouts/application.html.erb +0 -40
  47. data/test_app/app/views/main/ajax.html.erb +0 -2
  48. data/test_app/config.ru +0 -4
  49. data/test_app/config/application.rb +0 -69
  50. data/test_app/config/boot.rb +0 -6
  51. data/test_app/config/environment.rb +0 -5
  52. data/test_app/config/environments/development.rb +0 -37
  53. data/test_app/config/environments/production.rb +0 -67
  54. data/test_app/config/environments/test.rb +0 -37
  55. data/test_app/config/initializers/backtrace_silencers.rb +0 -7
  56. data/test_app/config/initializers/inflections.rb +0 -15
  57. data/test_app/config/initializers/mime_types.rb +0 -5
  58. data/test_app/config/initializers/secret_token.rb +0 -7
  59. data/test_app/config/initializers/session_store.rb +0 -8
  60. data/test_app/config/initializers/wrap_parameters.rb +0 -14
  61. data/test_app/config/locales/en.yml +0 -5
  62. data/test_app/config/routes.rb +0 -28
  63. data/test_app/db/seeds.rb +0 -7
  64. data/test_app/doc/README_FOR_APP +0 -2
  65. data/test_app/lib/assets/.gitkeep +0 -0
  66. data/test_app/lib/tasks/.gitkeep +0 -0
  67. data/test_app/log/.gitkeep +0 -0
  68. data/test_app/public/404.html +0 -26
  69. data/test_app/public/422.html +0 -26
  70. data/test_app/public/500.html +0 -25
  71. data/test_app/public/favicon.ico +0 -0
  72. data/test_app/public/robots.txt +0 -5
  73. data/test_app/script/rails +0 -6
  74. data/test_app/spec/integration/advanced_spec.rb +0 -64
  75. data/test_app/spec/integration/basic_spec.rb +0 -195
  76. data/test_app/spec/javascripts/controller_factory_spec.js +0 -48
  77. data/test_app/spec/javascripts/router_spec.js +0 -52
  78. data/test_app/spec/javascripts/support/jasmine.yml +0 -20
  79. data/test_app/spec/spec_helper.rb +0 -37
  80. data/test_app/spec/units/controller_spec.rb +0 -109
  81. data/test_app/spec/units/utilities_spec.rb +0 -114
  82. data/test_app/test/fixtures/.gitkeep +0 -0
  83. data/test_app/test/functional/.gitkeep +0 -0
  84. data/test_app/test/integration/.gitkeep +0 -0
  85. data/test_app/test/performance/browsing_test.rb +0 -12
  86. data/test_app/test/test_helper.rb +0 -13
  87. data/test_app/test/unit/.gitkeep +0 -0
  88. data/test_app/vendor/assets/javascripts/.gitkeep +0 -0
  89. data/test_app/vendor/assets/stylesheets/.gitkeep +0 -0
  90. data/test_app/vendor/plugins/.gitkeep +0 -0
  91. data/vendor/assets/javascripts/paloma/controller.js +0 -10
  92. data/vendor/assets/javascripts/paloma/controller_factory.js +0 -55
  93. data/vendor/assets/javascripts/paloma/router.js +0 -23
@@ -1,48 +0,0 @@
1
-
2
- describe('Paloma.ControllerFactory', function(){
3
-
4
- var router = new Paloma.Router({namespace: '/', action: '#'});
5
-
6
-
7
- describe('#make(name)', function(){
8
- var factory = new Paloma.ControllerFactory(router),
9
- Controller;
10
-
11
- beforeEach(function(){
12
- Controller = factory.make('Resource');
13
- });
14
-
15
-
16
- it('returns a new Controller constructor', function(){
17
- expect(typeof Controller).toEqual('function');
18
- });
19
-
20
- it('saves the Controller constructor', function(){
21
- expect(factory.get('Resource')).toEqual(Controller);
22
- });
23
- });
24
-
25
-
26
-
27
-
28
-
29
- describe('#get(name)', function(){
30
- var factory = new Paloma.ControllerFactory(router),
31
- Controller = factory.make('Foo');
32
-
33
- describe('when controller exists', function(){
34
- it('returns the controller', function(){
35
- expect(factory.get('Foo')).toEqual(Controller);
36
- });
37
- });
38
-
39
-
40
- describe('when controller does not exist', function(){
41
- it('returns null', function(){
42
- expect(factory.get('WhatTheFuck')).toBeNull();
43
- });
44
- });
45
-
46
- });
47
-
48
- });
@@ -1,52 +0,0 @@
1
-
2
- describe('Paloma.Router', function(){
3
- var delimiter = '/',
4
- router = new Paloma.Router(delimiter);
5
-
6
- describe('#parse(path)', function(){
7
-
8
- describe('when path has a namespace', function(){
9
- var result;
10
-
11
- beforeEach(function(){
12
- result = router.parse('Foo/Bar/Baz/Controller');
13
- });
14
-
15
- it('returns the array of the namespaces', function(){
16
- expect(result.namespaces).toEqual(['Foo', 'Bar', 'Baz']);
17
- });
18
-
19
- it('returns the controller', function(){
20
- expect(result.controller).toEqual('Controller');
21
- });
22
-
23
- it('returns the controllerPath', function(){
24
- expect(result.controllerPath).toEqual(['Foo', 'Bar', 'Baz', 'Controller']);
25
- });
26
- });
27
-
28
-
29
-
30
- describe('when path has no namespace', function(){
31
- var result;
32
-
33
- beforeEach(function(){
34
- result = router.parse('Controller');
35
- });
36
-
37
- it('returns an empty array of namespaces', function(){
38
- expect(result.namespaces).toEqual([]);
39
- });
40
-
41
- it('returns the controller', function(){
42
- expect(result.controller).toEqual('Controller');
43
- });
44
-
45
- it('returns the controllerPath', function(){
46
- expect(result.controllerPath).toEqual(['Controller']);
47
- });
48
- });
49
-
50
- });
51
-
52
- });
@@ -1,20 +0,0 @@
1
- # path to parent directory of src_files
2
- # relative path from Rails.root
3
- # defaults to app/assets/javascripts
4
- src_dir: "app/assets/javascripts"
5
- # list of file expressions to include as source files
6
- # relative path from scr_dir
7
- src_files:
8
- - "application.{js,coffee}"
9
- # path to parent directory of spec_files
10
- # relative path from Rails.root
11
- # defaults to spec/javascripts
12
- spec_dir: spec/javascripts
13
- # list of file expressions to include as helpers into spec runner
14
- # relative path from spec_dir
15
- helpers:
16
- - "helpers/**/*.{js,coffee}"
17
- # list of file expressions to include as specs into spec runner
18
- # relative path from spec_dir
19
- spec_files:
20
- - "**/*[Ss]pec.{js,coffee}"
@@ -1,37 +0,0 @@
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
- require 'rspec/rails'
5
- require 'rspec/autorun'
6
-
7
- # Requires supporting ruby files with custom matchers and macros, etc,
8
- # in spec/support/ and its subdirectories.
9
- Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
10
-
11
- RSpec.configure do |config|
12
- config.include Capybara::DSL
13
-
14
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
15
- # config.fixture_path = "#{::Rails.root}/spec/fixtures"
16
-
17
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
18
- # examples within a transaction, remove the following line or assign false
19
- # instead of true.
20
- # config.use_transactional_fixtures = true
21
-
22
- # If true, the base class of anonymous controllers will be inferred
23
- # automatically. This will be the default behavior in future versions of
24
- # rspec-rails.
25
- config.infer_base_class_for_anonymous_controllers = false
26
-
27
- # Run specs in random order to surface order dependencies. If you find an
28
- # order dependency and want to debug it, you can fix the order by providing
29
- # the seed, which is printed after each run.
30
- # --seed 1234
31
- config.order = "random"
32
- end
33
-
34
-
35
- def request
36
- page.evaluate_script 'Paloma.engine.getRequest()'
37
- end
@@ -1,109 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- describe Paloma::Controller do
5
-
6
- let(:controller){ Paloma::Controller.new }
7
-
8
-
9
- before do
10
- controller.resource = 'Test'
11
- controller.action = 'new'
12
- controller.params = {:x => 1, :y => 2}
13
- end
14
-
15
-
16
-
17
- shared_examples 'request is cleared' do
18
- it 'assigns nil to resource' do
19
- expect(controller.resource).to be_nil
20
- end
21
-
22
-
23
- it 'assigns nil to action' do
24
- expect(controller.action).to be_nil
25
- end
26
-
27
-
28
- it 'assigns an empty hash to params' do
29
- expect(controller.params).to be_empty
30
- end
31
-
32
-
33
- it 'returns true' do
34
- expect(@return).to be_true
35
- end
36
- end
37
-
38
-
39
-
40
- shared_examples 'request is not cleared' do
41
- it 'returns false' do
42
- expect(@return).to be_false
43
- end
44
-
45
-
46
- it 'has a request' do
47
- expect(controller.has_request?).to be_true
48
- end
49
- end
50
-
51
-
52
-
53
-
54
-
55
- describe '#clear_request' do
56
- before { @return = controller.clear_request }
57
- it_behaves_like 'request is cleared'
58
- end
59
-
60
-
61
-
62
- describe '#request' do
63
- it 'returns a hash object' do
64
- expect(controller.request).to be_an_instance_of Hash
65
- end
66
-
67
-
68
- it 'returns the current value of resource' do
69
- expect(controller.request[:resource]).to eq 'Test'
70
- end
71
-
72
-
73
- it 'returns the current value of action' do
74
- expect(controller.request[:action]).to eq 'new'
75
- end
76
-
77
-
78
- it 'returns the current value of params' do
79
- expect(controller.request[:params]).to eq ({:x => 1, :y => 2})
80
- end
81
- end
82
-
83
-
84
-
85
- describe '#has_request?' do
86
- context 'when resource is nil' do
87
- it 'returns false' do
88
- controller.resource = nil
89
- expect(controller.has_request?).to be_false
90
- end
91
- end
92
-
93
-
94
- context 'when action is nil' do
95
- it 'returns false' do
96
- controller.action = nil
97
- expect(controller.has_request?).to be_false
98
- end
99
- end
100
-
101
-
102
- context 'when resource and action is present' do
103
- it 'returns true' do
104
- expect(controller.has_request?).to be_true
105
- end
106
- end
107
- end
108
-
109
- end
@@ -1,114 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- describe Paloma::Utilities do
5
-
6
- let(:utilities){ Paloma::Utilities }
7
-
8
-
9
-
10
- describe '.get_resource(path)' do
11
- context 'when path is only 1 word' do
12
- it 'returns the controller resource name' do
13
- expect(utilities.get_resource('test')).to eq 'Test'
14
- end
15
- end
16
-
17
-
18
- context 'when path is more than 1 word' do
19
- it 'returns the controller resource name' do
20
- expect(utilities.get_resource('my_super_resources')).to eq 'MySuperResources'
21
- end
22
- end
23
-
24
-
25
- context 'when path has namespace' do
26
- it 'returns "Namespace/Resource"' do
27
- expect(utilities.get_resource('admin/my_mega_test')).to eq 'Admin/MyMegaTest'
28
- end
29
- end
30
-
31
-
32
- context 'when path has 2 or more namespace' do
33
- it 'returns "Namespace1/NamespaceN/Resource' do
34
- expect(utilities.get_resource('admin/test/my_resources')).to eq 'Admin/Test/MyResources'
35
- end
36
- end
37
- end
38
-
39
-
40
-
41
-
42
-
43
- shared_examples 'resource is passed' do |resource|
44
- it 'returns its returned as the resource' do
45
- expect(route[:resource]).to eq resource
46
- end
47
- end
48
-
49
-
50
- shared_examples 'action is passed' do |action|
51
- it 'returns the action' do
52
- expect(route[:action]).to eq action
53
- end
54
- end
55
-
56
-
57
- shared_examples 'resource is not passed' do
58
- it 'returns a nil resource' do
59
- expect(route[:resource]).to be_nil
60
- end
61
- end
62
-
63
-
64
- shared_examples 'action is not passed' do
65
- it 'returns a nil action' do
66
- expect(route[:action]).to be_nil
67
- end
68
- end
69
-
70
-
71
-
72
-
73
-
74
- describe '.interpret_route(route_string)' do
75
- context 'when route_string is empty' do
76
- it 'raises an error' do
77
- expect { utilities.interpret_route }.to raise_error 'Empty route cannot be interpreted'
78
- end
79
- end
80
-
81
-
82
- context 'when route_string has a word' do
83
- let(:route){ utilities.interpret_route 'MyResources' }
84
-
85
- it_behaves_like 'resource is passed', 'MyResources'
86
- it_behaves_like 'action is not passed'
87
- end
88
-
89
-
90
- context 'when route_string has a namespace' do
91
- let(:route){ utilities.interpret_route 'Namespace/MyResource' }
92
-
93
- it_behaves_like 'resource is passed', 'Namespace/MyResource'
94
- it_behaves_like 'action is not passed'
95
- end
96
-
97
-
98
- context 'when route_string has an action' do
99
- let(:route){ utilities.interpret_route 'Namespace/MyResources#action' }
100
-
101
- it_behaves_like 'resource is passed', 'Namespace/MyResources'
102
- it_behaves_like 'action is passed', 'action'
103
- end
104
-
105
-
106
- context 'when route_string has action only' do
107
- let(:route){ utilities.interpret_route '#edit' }
108
-
109
- it_behaves_like 'resource is not passed'
110
- it_behaves_like 'action is passed', 'edit'
111
- end
112
- end
113
-
114
- end
File without changes
File without changes
File without changes
@@ -1,12 +0,0 @@
1
- require 'test_helper'
2
- require 'rails/performance_test_help'
3
-
4
- class BrowsingTest < ActionDispatch::PerformanceTest
5
- # Refer to the documentation for all available options
6
- # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
7
- # :output => 'tmp/performance', :formats => [:flat] }
8
-
9
- def test_homepage
10
- get '/'
11
- end
12
- end
@@ -1,13 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
10
- fixtures :all
11
-
12
- # Add more helper methods to be used by all tests here...
13
- end
File without changes
File without changes
File without changes
File without changes
@@ -1,10 +0,0 @@
1
- (function(Paloma){
2
-
3
- var Controller = function(params){
4
- this.params = params;
5
- };
6
-
7
-
8
- Paloma.Controller = Controller;
9
-
10
- })(window.Paloma);