lanes 0.0.5 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/Gemfile +0 -1
  4. data/README.md +2 -0
  5. data/client/lanes/data/Bootstrap.coffee +2 -2
  6. data/client/lanes/data/Collection.coffee +4 -0
  7. data/client/lanes/data/Config.coffee +0 -5
  8. data/client/lanes/data/Model.coffee +236 -150
  9. data/client/lanes/data/PubSub.coffee +6 -12
  10. data/client/lanes/data/Sync.coffee +1 -0
  11. data/client/lanes/extension/Extensions.coffee +4 -2
  12. data/client/lanes/lib/MakeBaseClass.coffee +1 -1
  13. data/client/lanes/minimal.js +11 -0
  14. data/client/lanes/minimal.scss.erb +12 -0
  15. data/client/lanes/screens/Base.coffee +1 -2
  16. data/client/lanes/screens/Instance.coffee +52 -0
  17. data/client/lanes/vendor/packaged.js +1 -2
  18. data/client/lanes/views/Base.coffee +12 -10
  19. data/client/lanes/workspace.scss.erb +3 -0
  20. data/client/lanes/workspace/index.js +2 -12
  21. data/docs/command.md +111 -0
  22. data/docs/model.md +188 -0
  23. data/docs/todo-example-part-1.md +71 -0
  24. data/docs/view.md +275 -0
  25. data/{spec/client/jasmine_examples/PlayerSpec.js → docs/welcome.md} +0 -0
  26. data/lanes.gemspec +3 -1
  27. data/lib/lanes/api/helper_methods.rb +8 -0
  28. data/lib/lanes/api/javascript_processor.rb +14 -10
  29. data/lib/lanes/api/pub_sub.rb +7 -7
  30. data/lib/lanes/api/request_wrapper.rb +1 -0
  31. data/lib/lanes/api/root.rb +2 -7
  32. data/lib/lanes/api/sprockets_compressor.rb +6 -2
  33. data/lib/lanes/api/sprockets_extension.rb +25 -9
  34. data/lib/lanes/api/test_specs.rb +13 -9
  35. data/lib/lanes/command.rb +16 -6
  36. data/lib/lanes/command/app.rb +11 -5
  37. data/lib/lanes/command/generate_model.rb +4 -3
  38. data/lib/lanes/command/generate_screen.rb +2 -1
  39. data/lib/lanes/command/generate_view.rb +1 -1
  40. data/lib/lanes/command/named_command.rb +5 -4
  41. data/lib/lanes/command/templates/Gemfile +1 -2
  42. data/lib/lanes/command/templates/client/data/Model.coffee +3 -3
  43. data/lib/lanes/command/templates/client/{namespace-extension.js → index.js} +0 -0
  44. data/lib/lanes/command/templates/client/screens/Screen.coffee +1 -3
  45. data/lib/lanes/command/templates/client/{styles/styles.scss → styles.scss} +0 -0
  46. data/lib/lanes/command/templates/client/views/View.coffee +1 -3
  47. data/lib/lanes/command/templates/config/lanes.rb +1 -1
  48. data/lib/lanes/command/templates/gitignore +1 -0
  49. data/lib/lanes/command/templates/lib/namespace/screen.rb +1 -1
  50. data/lib/lanes/command/templates/public/.gitkeep +0 -0
  51. data/lib/lanes/command/templates/spec/client/Screen.coffee +7 -0
  52. data/lib/lanes/command/templates/spec/client/views/ViewSpec.coffee +2 -2
  53. data/lib/lanes/concerns/all.rb +1 -1
  54. data/lib/lanes/concerns/sanitize_fields.rb +32 -0
  55. data/lib/lanes/concerns/set_attribute_data.rb +4 -4
  56. data/lib/lanes/db.rb +7 -8
  57. data/lib/lanes/extension.rb +37 -3
  58. data/lib/lanes/guard_tasks.rb +2 -2
  59. data/lib/lanes/model.rb +2 -2
  60. data/lib/lanes/screens.rb +1 -0
  61. data/lib/lanes/spec_helper.rb +17 -6
  62. data/{spec → lib/lanes}/testing_models.rb +1 -1
  63. data/lib/lanes/version.rb +1 -1
  64. data/npm-build/compile.coffee +1 -6
  65. data/public/javascripts/jasmine_examples/Player.js +22 -0
  66. data/public/javascripts/jasmine_examples/Song.js +7 -0
  67. data/spec/api/javascript_processor_spec.rb +6 -3
  68. data/spec/concerns/api_path_spec.rb +1 -1
  69. data/spec/concerns/association_extensions_spec.rb +7 -3
  70. data/spec/concerns/attr_accessor_with_default_spec.rb +1 -1
  71. data/spec/concerns/code_identifier_spec.rb +1 -1
  72. data/spec/concerns/export_associations_spec.rb +1 -1
  73. data/spec/concerns/export_methods_spec.rb +1 -14
  74. data/spec/concerns/export_scope_spec.rb +7 -9
  75. data/spec/concerns/exported_limits_spec.rb +1 -1
  76. data/spec/concerns/pub_sub_spec.rb +1 -1
  77. data/spec/concerns/set_attribute_data_spec.rb +16 -24
  78. data/spec/configuration_spec.rb +1 -1
  79. data/spec/helpers/lanes-helpers.coffee +61 -0
  80. data/spec/lanes/data/ModelSpec.coffee +152 -0
  81. data/spec/lanes/data/PubSubSpec.coffee +21 -0
  82. data/spec/{client/view → lanes/views}/BaseSpec.coffee +6 -26
  83. data/spec/numbers_spec.rb +1 -1
  84. data/spec/strings_spec.rb +1 -1
  85. data/views/index.erb +3 -10
  86. data/views/specs.erb +4 -1
  87. metadata +62 -16
  88. data/client/lanes/plugins/trigger.coffee +0 -15
  89. data/client/lanes/workspace/Instance.es6 +0 -64
  90. data/lib/lanes/concerns/sanitize_api_data.rb +0 -15
  91. data/spec/api/user_spec.rb +0 -52
  92. data/spec/fixtures/lanes/users.yml +0 -13
  93. data/spec/locked_fields_spec.rb +0 -27
  94. data/spec/role_collection_spec.rb +0 -19
  95. data/spec/user_role_spec.rb +0 -7
  96. data/spec/user_spec.rb +0 -53
data/views/specs.erb CHANGED
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"/>
7
7
  <title>Lanes Specs</title>
8
8
 
9
- <%= javascript_tag 'lanes-workspace.js' %>
9
+ <%= javascript_tag 'lanes/workspace.js' %>
10
10
 
11
11
  <% specs.css_files.each do |css_file| %>
12
12
  <link rel="stylesheet" href="<%= css_file %>" type="text/css" media="screen"/>
@@ -15,6 +15,9 @@
15
15
  <% specs.js_files.each do | js_file | %>
16
16
  <script src="<%= js_file %>" type="text/javascript"></script>
17
17
  <% end %>
18
+ <script type="text/javascript">
19
+ Lanes.Data.Bootstrap.initialize( <%= client_bootstrap_data %> );
20
+ </script>
18
21
 
19
22
  </head>
20
23
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lanes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Stitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-06 00:00:00.000000000 Z
11
+ date: 2014-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -262,6 +262,20 @@ dependencies:
262
262
  - - "~>"
263
263
  - !ruby/object:Gem::Version
264
264
  version: '0.2'
265
+ - !ruby/object:Gem::Dependency
266
+ name: mocha
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: '1.1'
272
+ type: :runtime
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - "~>"
277
+ - !ruby/object:Gem::Version
278
+ version: '1.1'
265
279
  - !ruby/object:Gem::Dependency
266
280
  name: guard-minitest
267
281
  requirement: !ruby/object:Gem::Requirement
@@ -290,6 +304,20 @@ dependencies:
290
304
  - - "~>"
291
305
  - !ruby/object:Gem::Version
292
306
  version: '0.12'
307
+ - !ruby/object:Gem::Dependency
308
+ name: closure-compiler
309
+ requirement: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - "~>"
312
+ - !ruby/object:Gem::Version
313
+ version: '1.1'
314
+ type: :runtime
315
+ prerelease: false
316
+ version_requirements: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - "~>"
319
+ - !ruby/object:Gem::Version
320
+ version: '1.1'
293
321
  - !ruby/object:Gem::Dependency
294
322
  name: guard-jasmine
295
323
  requirement: !ruby/object:Gem::Requirement
@@ -346,6 +374,20 @@ dependencies:
346
374
  - - "~>"
347
375
  - !ruby/object:Gem::Version
348
376
  version: '1.3'
377
+ - !ruby/object:Gem::Dependency
378
+ name: sanitize
379
+ requirement: !ruby/object:Gem::Requirement
380
+ requirements:
381
+ - - "~>"
382
+ - !ruby/object:Gem::Version
383
+ version: '3.0'
384
+ type: :runtime
385
+ prerelease: false
386
+ version_requirements: !ruby/object:Gem::Requirement
387
+ requirements:
388
+ - - "~>"
389
+ - !ruby/object:Gem::Version
390
+ version: '3.0'
349
391
  - !ruby/object:Gem::Dependency
350
392
  name: bundler
351
393
  requirement: !ruby/object:Gem::Requirement
@@ -494,12 +536,14 @@ files:
494
536
  - client/lanes/lib/promise_helpers.coffee
495
537
  - client/lanes/lib/results.coffee
496
538
  - client/lanes/lib/utilFunctions.coffee
539
+ - client/lanes/minimal.js
540
+ - client/lanes/minimal.scss.erb
497
541
  - client/lanes/plugins/ResizeSensor.js
498
542
  - client/lanes/plugins/index.js
499
543
  - client/lanes/plugins/overlay.coffee
500
- - client/lanes/plugins/trigger.coffee
501
544
  - client/lanes/screens/Base.coffee
502
545
  - client/lanes/screens/ChangeListener.coffee
546
+ - client/lanes/screens/Instance.coffee
503
547
  - client/lanes/screens/Router.coffee
504
548
  - client/lanes/screens/index.js
505
549
  - client/lanes/screens/screen-definitions.js.erb
@@ -541,7 +585,6 @@ files:
541
585
  - client/lanes/views/model-update.html
542
586
  - client/lanes/workspace.scss.erb
543
587
  - client/lanes/workspace/ActiveScreensSwitcher.coffee
544
- - client/lanes/workspace/Instance.es6
545
588
  - client/lanes/workspace/Layout.coffee
546
589
  - client/lanes/workspace/Navbar.coffee
547
590
  - client/lanes/workspace/Pages.coffee
@@ -721,6 +764,11 @@ files:
721
764
  - config.ru
722
765
  - config/database.yml
723
766
  - db/migrate/20140615031600_create_hip_users.rb
767
+ - docs/command.md
768
+ - docs/model.md
769
+ - docs/todo-example-part-1.md
770
+ - docs/view.md
771
+ - docs/welcome.md
724
772
  - lanes.gemspec
725
773
  - lib/generators/lanes/migrations/install_generator.rb
726
774
  - lib/lanes.rb
@@ -764,12 +812,12 @@ files:
764
812
  - lib/lanes/command/templates/client/components/.gitkeep
765
813
  - lib/lanes/command/templates/client/components/Component.coffee
766
814
  - lib/lanes/command/templates/client/data/Model.coffee
767
- - lib/lanes/command/templates/client/namespace-extension.js
815
+ - lib/lanes/command/templates/client/index.js
768
816
  - lib/lanes/command/templates/client/screens/Screen.coffee
769
817
  - lib/lanes/command/templates/client/screens/index.js
770
818
  - lib/lanes/command/templates/client/screens/layout.html
771
819
  - lib/lanes/command/templates/client/screens/styles.scss
772
- - lib/lanes/command/templates/client/styles/styles.scss
820
+ - lib/lanes/command/templates/client/styles.scss
773
821
  - lib/lanes/command/templates/client/views/.gitkeep
774
822
  - lib/lanes/command/templates/client/views/View.coffee
775
823
  - lib/lanes/command/templates/client/views/template.html
@@ -784,6 +832,8 @@ files:
784
832
  - lib/lanes/command/templates/lib/namespace/model.rb
785
833
  - lib/lanes/command/templates/lib/namespace/screen.rb
786
834
  - lib/lanes/command/templates/lib/namespace/version.rb
835
+ - lib/lanes/command/templates/public/.gitkeep
836
+ - lib/lanes/command/templates/spec/client/Screen.coffee
787
837
  - lib/lanes/command/templates/spec/client/data/ModelSpec.coffee
788
838
  - lib/lanes/command/templates/spec/client/views/ViewSpec.coffee
789
839
  - lib/lanes/command/templates/spec/fixtures/namespace/model.yml
@@ -808,7 +858,7 @@ files:
808
858
  - lib/lanes/concerns/pub_sub.rb
809
859
  - lib/lanes/concerns/queries.rb
810
860
  - lib/lanes/concerns/random_hash_code.rb
811
- - lib/lanes/concerns/sanitize_api_data.rb
861
+ - lib/lanes/concerns/sanitize_fields.rb
812
862
  - lib/lanes/concerns/set_attribute_data.rb
813
863
  - lib/lanes/concerns/visible_id_identifier.rb
814
864
  - lib/lanes/configuration.rb
@@ -827,6 +877,7 @@ files:
827
877
  - lib/lanes/spec_asset_expander.rb
828
878
  - lib/lanes/spec_helper.rb
829
879
  - lib/lanes/strings.rb
880
+ - lib/lanes/testing_models.rb
830
881
  - lib/lanes/validators/all.rb
831
882
  - lib/lanes/validators/email.rb
832
883
  - lib/lanes/validators/set.rb
@@ -839,9 +890,6 @@ files:
839
890
  - public/javascripts/jasmine_examples/Player.js
840
891
  - public/javascripts/jasmine_examples/Song.js
841
892
  - spec/api/javascript_processor_spec.rb
842
- - spec/api/user_spec.rb
843
- - spec/client/jasmine_examples/PlayerSpec.js
844
- - spec/client/view/BaseSpec.coffee
845
893
  - spec/concerns/api_path_spec.rb
846
894
  - spec/concerns/association_extensions_spec.rb
847
895
  - spec/concerns/attr_accessor_with_default_spec.rb
@@ -853,17 +901,15 @@ files:
853
901
  - spec/concerns/pub_sub_spec.rb
854
902
  - spec/concerns/set_attribute_data_spec.rb
855
903
  - spec/configuration_spec.rb
856
- - spec/fixtures/lanes/users.yml
857
904
  - spec/helpers/.gitkeep
858
905
  - spec/helpers/jasmine-jquery.js
859
906
  - spec/helpers/jasmine-matchers.js
860
- - spec/locked_fields_spec.rb
907
+ - spec/helpers/lanes-helpers.coffee
908
+ - spec/lanes/data/ModelSpec.coffee
909
+ - spec/lanes/data/PubSubSpec.coffee
910
+ - spec/lanes/views/BaseSpec.coffee
861
911
  - spec/numbers_spec.rb
862
- - spec/role_collection_spec.rb
863
912
  - spec/strings_spec.rb
864
- - spec/testing_models.rb
865
- - spec/user_role_spec.rb
866
- - spec/user_spec.rb
867
913
  - tasks/migrations.rake
868
914
  - tasks/publish.rake
869
915
  - views/index.erb
@@ -1,15 +0,0 @@
1
-
2
- jqTrigger = Lanes.$.fn.trigger
3
-
4
- Lanes.$.fn.trigger = ( event, data, elem, onlyHandlers ) ->
5
- evt = window.document.createEvent('CustomEvent')
6
- event_name = if _.isObject(event)
7
- data ||= event
8
- event.type
9
- else
10
- event
11
- evt.initCustomEvent(event_name, true, true, data )
12
- this.each( (index,el)->
13
- el.dispatchEvent(evt) unless _.isFunction(el[event_name])
14
- )
15
- jqTrigger.apply(this, arguments);
@@ -1,64 +0,0 @@
1
- Lanes.Workspace.create = function(selector, options, extension_data){
2
- return new Lanes.Workspace.Instance(selector, options, extension_data);
3
- };
4
-
5
- Lanes.Workspace.Instance = class Instance {
6
-
7
- constructor(selector, options, extension_data){
8
- _.extend(this,options);
9
-
10
- this.viewport = new Lanes.Views.Viewport({ selector: selector, instance: this });
11
- Lanes.Data.Bootstrap.initialize({
12
- csrf: options.csrf_token,
13
- root: options.root_path,
14
- data: extension_data
15
- });
16
- Lanes.$(document).ready( ()=> {
17
- this.boot();
18
- });
19
- }
20
-
21
- boot(){
22
- this.root = Lanes.$( this.viewport.selector );
23
- this.root.data().workspace = this;
24
- this.viewport.root = this.root;
25
-
26
- Lanes.lib.ResizeSensor(this.root[0], _.bind( _.debounce( function(){
27
- this.viewport.set({ width: this.root.width(), height: this.root.height() });
28
- }, 250 ), this) );
29
-
30
- this.root.addClass('lanes root');
31
- this.root.tooltip({
32
- viewport: '.lanes',
33
- selector: '[data-tooltip-message]',
34
- title: function(){ return this.getAttribute('data-tooltip-message'); }
35
- });
36
- var view = Lanes.getPath(this.view);
37
- if (view){
38
- this.displayInitialView(view);
39
- } else {
40
- var definition=Lanes.Data.Screens.all.findWhere({view: this.view});
41
- if (definition){
42
- definition.getScreen().then( (screen)=>{
43
- // break out of the promise so an errors during render get thrown properly
44
- _.defer( ()=>{ this.displayInitialView(screen); } );
45
- }, (msg)=>{
46
- Lanes.fatal("Unable to load initial screen ${this.view}", msg);
47
- });
48
- } else {
49
- Lanes.fatal(this.view + " doesn't exist!");
50
- }
51
- }
52
- }
53
-
54
- displayInitialView(view){
55
- this.view = new view({parent: this, model: this.viewport}).render();
56
- this.viewport.el = this.view.$el;
57
-
58
- this.root.append( this.view.el );
59
-
60
- Lanes.Views.Keys.initialize();
61
- Lanes.Data.PubSub.initialize();
62
- Lanes.Extensions.fireOnAvailable(this);
63
- }
64
- };
@@ -1,15 +0,0 @@
1
- module Lanes::Concerns
2
-
3
-
4
- # SanitizeJson is responsible for only cleaning a hash of attributes that should not
5
- # be written to the model by the given user
6
- module SanitizeApiData
7
- extend ActiveSupport::Concern
8
-
9
- module ClassMethods
10
- end
11
-
12
- end
13
-
14
-
15
- end
@@ -1,52 +0,0 @@
1
- require_relative "../spec_helper"
2
-
3
- class ApiUserTest < Lanes::ApiTestCase
4
-
5
- def test_query
6
- get "/users/#{admin.id}.json"
7
- refute_ok
8
- login!
9
- get "/users/#{admin.id}.json"
10
- assert_ok
11
- assert_equal admin.id, json_data.id
12
- end
13
-
14
- def test_create
15
- login!
16
- assert_difference ->{User.count}, 1 do
17
- post "/users.json", {
18
- login: "nas", name: "Nathan", email: "test@test.com", password: 'testing1234'
19
- }
20
- assert_ok
21
- end
22
- end
23
-
24
- def test_update_by_self
25
- user = lanes_users(:support)
26
- login!(user)
27
- assert User.can_write_attributes?({id: user.id, :foo=>1}, user)
28
- put "/users/#{user.id}.json", { name: 'Updated Name', password: 'pass1234', email: 'sam@test.com' }
29
- assert_ok
30
- user.reload
31
- assert_equal 'Updated Name', user.name
32
- assert_equal 'sam@test.com', user.email
33
- end
34
-
35
- def test_updating_roles
36
- login!
37
- user = lanes_users(:support)
38
- put "/users/#{user.id}.json", { name: 'Sam', role_names:['administrator'] }
39
- assert_ok
40
- user.reload
41
- assert_equal 'Sam', user.name
42
- assert_equal ['administrator'], user.role_names
43
- end
44
-
45
- def test_delete
46
- login!
47
- assert_difference ->{User.count}, -1 do
48
- delete "/users/#{admin.id}.json"
49
- end
50
- end
51
-
52
- end
@@ -1,13 +0,0 @@
1
- admin:
2
- login: admin
3
- name: Administrator Jane
4
- email: admin@test.com
5
- password_digest: <%= BCrypt::Password.create('password') %>
6
- role_names: ['administrator']
7
-
8
- support:
9
- login: support
10
- name: Supporter Joe
11
- email: support@test.com
12
- password_digest: <%= BCrypt::Password.create('password') %>
13
- role_names: ['support']
@@ -1,27 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- class Customer < Lanes::Model
4
- def self.attribute_names
5
- [:terms_id]
6
- end
7
- end
8
-
9
- Lanes::Access::Roles::Support.read << Customer
10
- Lanes::Access::Roles::Administrator.lock Customer, :terms_id
11
-
12
- class LockedFieldsTest < Lanes::TestCase
13
-
14
- def setup
15
- @user = Lanes::User.new( login: 'test', email: 'bob@test.com', name: 'Bob', password: 'testtest')
16
- @purchaser = Lanes::User.new( login: 'test', email: 'bob@test.com', name: 'Bob', password: 'testtest')
17
- end
18
-
19
- def test_validations
20
- @user.role_names = ['support']
21
- assert_saves @user
22
- assert @user.can_read?(Customer), "User with support role cannot read Customer"
23
- refute @user.can_write?(Customer), "User can write, but shouldn't be able to"
24
- refute @user.can_read?(Customer, :terms_id), "User can read :terms_id but shouldn't be able to"
25
- end
26
-
27
- end
@@ -1,19 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
-
4
-
5
- class AccessTester < Lanes::Model
6
- def self.attribute_names
7
- [:name]
8
- end
9
- end
10
-
11
-
12
- class RoleCollectionTest < Lanes::TestCase
13
-
14
- def test_administrator_grants
15
- user = lanes_users(:admin)
16
- assert_includes user.role_names, 'administrator'
17
- assert user.roles.can_read?(AccessTester)
18
- end
19
- end
@@ -1,7 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
-
4
- class UserRoleTest < Lanes::TestCase
5
-
6
-
7
- end
data/spec/user_spec.rb DELETED
@@ -1,53 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- describe Lanes::User do
4
-
5
- before do
6
- @user = Lanes::User.new( login: 'test', email: 'bob@test.com', name: 'Bob', password: 'testtest')
7
- end
8
-
9
- it "validates attributes" do
10
- user = Lanes::User.new
11
- refute_saves user, 'login'
12
- user.assign_attributes login: 'test', email: 'bob', name: 'Bob'
13
- refute_saves user, 'email'
14
- user.email = 'bob@test.com'
15
- refute_saves user, 'password'
16
- user.password = 'password'
17
- assert_saves user
18
- end
19
-
20
- it "sets roles" do
21
- @user.role_names = ['administrator']
22
- assert_saves @user
23
- assert_equal [ 'administrator' ], @user.role_names
24
- end
25
-
26
- it "can has built-in roles" do
27
- @support = Lanes::User.new( login: 'test', email: 'support@test.com', name: 'support Bob',
28
- password: 'testtest', role_names:['support'])
29
- @admin = Lanes::User.new( login: 'test', email: 'admin@test.com', name: 'admin Bob',
30
- password: 'testtest', role_names:['administrator'])
31
-
32
- assert @admin.can_read?(@support)
33
- assert @admin.can_write?(@support)
34
-
35
- assert @support.can_read?(@admin)
36
- refute @support.can_write?(@admin)
37
- end
38
-
39
- it "can be set from attribute data" do
40
- attrs = { login: 'test', email: 'bob', name: 'Bob', password:'password' }
41
- assert_equal attrs, @user.set_attribute_data( attrs, lanes_users(:admin) )
42
- end
43
-
44
- it "users can update themselves" do
45
- user = lanes_users(:support)
46
- admin = lanes_users(:admin)
47
- attrs = { id: 34, login: 'test', email: 'bob', name: 'Bob', password:'password' }
48
- assert_empty admin.set_attribute_data( attrs, user )
49
- attrs[:id] = user.id
50
- assert_equal( {email: 'bob', name: 'Bob', password:'password'}, user.set_attribute_data(attrs, user) )
51
- end
52
-
53
- end