andrewroth_activeadmin 0.3.4.3 → 0.3.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +18 -32
  3. data/Gemfile +5 -7
  4. data/activeadmin.gemspec +1 -1
  5. data/features/step_definitions/additional_web_steps.rb +3 -3
  6. data/features/step_definitions/asset_steps.rb +1 -1
  7. data/features/step_definitions/comment_steps.rb +3 -3
  8. data/features/step_definitions/configuration_steps.rb +5 -5
  9. data/features/step_definitions/dashboard_steps.rb +2 -2
  10. data/features/step_definitions/index_scope_steps.rb +5 -5
  11. data/features/step_definitions/pagination_steps.rb +2 -2
  12. data/features/step_definitions/tab_steps.rb +1 -1
  13. data/features/step_definitions/user_steps.rb +1 -1
  14. data/features/step_definitions/web_steps.rb +4 -4
  15. data/lib/active_admin/arbre.rb +0 -1
  16. data/lib/active_admin/arbre/builder.rb +8 -5
  17. data/lib/active_admin/arbre/context.rb +1 -1
  18. data/lib/active_admin/arbre/html/attributes.rb +1 -1
  19. data/lib/active_admin/arbre/html/class_list.rb +0 -4
  20. data/lib/active_admin/arbre/html/collection.rb +2 -2
  21. data/lib/active_admin/arbre/html/document.rb +1 -1
  22. data/lib/active_admin/arbre/html/element.rb +5 -9
  23. data/lib/active_admin/arbre/html/tag.rb +3 -3
  24. data/lib/active_admin/arbre/html/text_node.rb +2 -2
  25. data/lib/active_admin/locales/de.yml +1 -0
  26. data/lib/active_admin/menu_item.rb +25 -17
  27. data/lib/active_admin/resource_controller/collection.rb +1 -1
  28. data/lib/active_admin/version.rb +1 -1
  29. data/lib/active_admin/views/components/columns.rb +4 -4
  30. data/script/use_rails +14 -7
  31. data/spec/spec_helper.rb +5 -11
  32. data/spec/spec_helper_without_rails.rb +10 -0
  33. data/spec/support/detect_rails_version.rb +22 -3
  34. data/spec/unit/arbre/context_spec.rb +1 -1
  35. data/spec/unit/arbre/html/element_spec.rb +5 -5
  36. data/spec/unit/arbre/html/tag_attributes_spec.rb +3 -3
  37. data/spec/unit/arbre/html_spec.rb +32 -22
  38. data/spec/unit/menu_item_spec.rb +25 -20
  39. data/spec/unit/views/tabbed_navigation_spec.rb +2 -1
  40. data/tasks/test.rake +15 -13
  41. metadata +10 -9
  42. data/lib/active_admin/arbre/core_extensions.rb +0 -5
@@ -1,4 +1,5 @@
1
- require 'spec_helper'
1
+ require 'spec_helper_without_rails'
2
+ require 'active_admin/menu_item'
2
3
 
3
4
  module ActiveAdmin
4
5
  describe MenuItem do
@@ -7,27 +8,27 @@ module ActiveAdmin
7
8
  item = MenuItem.new("Dashboard", "/admin")
8
9
  item.name.should == "Dashboard"
9
10
  end
10
-
11
+
11
12
  it "should have a url" do
12
13
  item = MenuItem.new("Dashboard", "/admin")
13
14
  item.url.should == "/admin"
14
15
  end
15
-
16
+
16
17
  it "should have a priority of 10 by default" do
17
18
  item = MenuItem.new("Dashboard", "/admin")
18
19
  item.priority.should == 10
19
20
  end
20
-
21
+
21
22
  it "should accept an optional options hash" do
22
23
  item = MenuItem.new("Dashboard", "/admin", 10, :if => lambda{ logged_in? } )
23
24
  end
24
-
25
+
25
26
  it "should have a display if block" do
26
27
  block = lambda{ logged_in? }
27
28
  item = MenuItem.new("Dashboard", "/admin", 10, :if => block )
28
29
  item.display_if_block.should == block
29
30
  end
30
-
31
+
31
32
  it "should have a default display if block always returning true" do
32
33
  item = MenuItem.new("Dashboard", "/admin")
33
34
  item.display_if_block.should be_instance_of(Proc)
@@ -36,20 +37,24 @@ module ActiveAdmin
36
37
 
37
38
  describe "url generation and caching" do
38
39
  it "should generate a url if it is a symbol" do
39
- MenuItem.new("Posts", :admin_posts_path).url.should == "/admin/posts"
40
+ item = MenuItem.new("Posts", :admin_posts_path)
41
+ MenuItem.should_receive(:generate_url).with(:admin_posts_path).
42
+ and_return("/admin/posts")
43
+
44
+ item.url.should == "/admin/posts"
40
45
  end
41
46
 
42
47
  it "should generate a url if it is a string" do
43
48
  MenuItem.new("Posts", "/admin/posts").url.should == "/admin/posts"
44
49
  end
45
50
  end
46
-
51
+
47
52
  context "with no children" do
48
53
  it "should be empty" do
49
54
  item = MenuItem.new("Blog", "/admin/blog")
50
55
  item.children.should == []
51
56
  end
52
-
57
+
53
58
  it "should accept new children" do
54
59
  item = MenuItem.new("Blog", "/admin/blog")
55
60
  item.add "Dashboard", "/admin"
@@ -57,7 +62,7 @@ module ActiveAdmin
57
62
  item.children.first.name.should == "Dashboard"
58
63
  end
59
64
  end
60
-
65
+
61
66
  context "with many children" do
62
67
  let(:item) do
63
68
  i = MenuItem.new("Dashboard", "/admin")
@@ -68,11 +73,11 @@ module ActiveAdmin
68
73
  i.add "Analytics", "/", 44
69
74
  i
70
75
  end
71
-
76
+
72
77
  it "should give access to the menu item as an array" do
73
78
  item['Blog'].name.should == 'Blog'
74
79
  end
75
-
80
+
76
81
  it "should sort items based on priority and name" do
77
82
  item.children[0].name.should == 'Users'
78
83
  item.children[1].name.should == 'Settings'
@@ -80,12 +85,12 @@ module ActiveAdmin
80
85
  item.children[3].name.should == 'Cars'
81
86
  item.children[4].name.should == 'Analytics'
82
87
  end
83
-
88
+
84
89
  it "children should hold a reference to their parent" do
85
90
  item["Blog"].parent.should == item
86
91
  end
87
92
  end
88
-
93
+
89
94
  describe "building children using block syntax" do
90
95
  let(:item) do
91
96
  MenuItem.new("Blog", "/") do |blog|
@@ -95,25 +100,25 @@ module ActiveAdmin
95
100
  end
96
101
  end
97
102
  end
98
-
103
+
99
104
  it "should have 2 children" do
100
105
  item.children.size.should == 2
101
106
  end
102
-
107
+
103
108
  it "should have sub-sub items" do
104
109
  item["Comments"]["Approved"].name.should == 'Approved'
105
110
  end
106
111
  end
107
-
112
+
108
113
  describe "accessing ancestory" do
109
114
  let(:item){ MenuItem.new "Blog", "/blog" }
110
-
115
+
111
116
  context "with no parent" do
112
117
  it "should return an empty array" do
113
118
  item.ancestors.should == []
114
119
  end
115
120
  end
116
-
121
+
117
122
  context "with one parent" do
118
123
  let(:sub_item) do
119
124
  item.add "Create New", "/blog/new"
@@ -123,7 +128,7 @@ module ActiveAdmin
123
128
  sub_item.ancestors.should == [item]
124
129
  end
125
130
  end
126
-
131
+
127
132
  context "with many parents" do
128
133
  before(:each) do
129
134
  item.add "C1", "/c1" do |c1|
@@ -80,7 +80,8 @@ describe ActiveAdmin::Views::TabbedNavigation do
80
80
 
81
81
  it "should add the 'current' and 'has_nested' classes to the li and 'current' to the sub li" do
82
82
  assigns[:current_tab] = "Reports/A Sub Reports"
83
- html.should have_tag("li", :attributes => { :id => "reports", :class => "current has_nested" })
83
+ html.should have_tag("li", :attributes => { :id => "reports", :class => /current/ })
84
+ html.should have_tag("li", :attributes => { :id => "reports", :class => /has_nested/ })
84
85
  html.should have_tag("li", :attributes => { :id => "a_sub_reports", :class => "current" })
85
86
  end
86
87
 
@@ -11,28 +11,30 @@ task :test => ['spec:unit', 'spec:integration', 'cucumber', 'cucumber:class_relo
11
11
 
12
12
  namespace :test do
13
13
 
14
- desc "Run the full suite against the important versions of rails"
15
- task :major_supported_rails do
14
+ def run_tests_against(*versions)
16
15
  current_version = detect_rails_version if File.exists?("Gemfile.lock")
17
16
 
18
- ["3.0.10", "3.1.0"].each do |version|
17
+ versions.each do |version|
19
18
  puts
20
19
  puts "== Using Rails #{version}"
21
20
 
22
- if File.exists?("Gemfile.lock")
23
- puts "Removing the current Gemfile.lock"
24
- cmd "rm Gemfile.lock"
25
- end
26
-
27
- cmd "export RAILS=#{version} && ./script/use_rails #{version}"
28
- cmd "export RAILS=#{version} && bundle exec rspec spec/unit"
29
- cmd "export RAILS=#{version} && bundle exec rspec spec/integration"
30
- cmd "export RAILS=#{version} && bundle exec cucumber features"
31
- cmd "export RAILS=#{version} && bundle exec cucumber -p class-reloading features"
21
+ cmd "./script/use_rails #{version}"
22
+ cmd "bundle exec rspec spec"
23
+ cmd "bundle exec cucumber features"
24
+ cmd "bundle exec cucumber -p class-reloading features"
32
25
  end
26
+
33
27
  cmd "./script/use_rails #{current_version}" if current_version
34
28
  end
35
29
 
30
+ desc "Run the full suite against the important versions of rails"
31
+ task :major_supported_rails do
32
+ run_tests_against "3.0.11", "3.1.3"
33
+ end
34
+
35
+ desc "Alias for major_supported_rails"
36
+ task :all => :major_supported_rails
37
+
36
38
  end
37
39
 
38
40
  require 'rspec/core/rake_task'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andrewroth_activeadmin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 65
4
+ hash: 79
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
9
  - 4
10
- - 3
11
- version: 0.3.4.3
10
+ - 4
11
+ version: 0.3.4.4
12
12
  platform: ruby
13
13
  authors:
14
14
  - Greg Bell
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-01-03 00:00:00 -05:00
19
+ date: 2012-01-11 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -139,12 +139,12 @@ dependencies:
139
139
  requirements:
140
140
  - - ">="
141
141
  - !ruby/object:Gem::Version
142
- hash: 39
142
+ hash: 43
143
143
  segments:
144
144
  - 0
145
- - 12
146
- - 4
147
- version: 0.12.4
145
+ - 13
146
+ - 0
147
+ version: 0.13.0
148
148
  type: :runtime
149
149
  version_requirements: *id008
150
150
  - !ruby/object:Gem::Dependency
@@ -339,7 +339,6 @@ files:
339
339
  - lib/active_admin/arbre.rb
340
340
  - lib/active_admin/arbre/builder.rb
341
341
  - lib/active_admin/arbre/context.rb
342
- - lib/active_admin/arbre/core_extensions.rb
343
342
  - lib/active_admin/arbre/html/attributes.rb
344
343
  - lib/active_admin/arbre/html/class_list.rb
345
344
  - lib/active_admin/arbre/html/collection.rb
@@ -504,6 +503,7 @@ files:
504
503
  - spec/integration/memory_spec.rb
505
504
  - spec/integration/stylesheets_spec.rb
506
505
  - spec/spec_helper.rb
506
+ - spec/spec_helper_without_rails.rb
507
507
  - spec/support/detect_rails_version.rb
508
508
  - spec/support/integration_example_group.rb
509
509
  - spec/support/jslint.yml
@@ -678,6 +678,7 @@ test_files:
678
678
  - spec/integration/memory_spec.rb
679
679
  - spec/integration/stylesheets_spec.rb
680
680
  - spec/spec_helper.rb
681
+ - spec/spec_helper_without_rails.rb
681
682
  - spec/support/detect_rails_version.rb
682
683
  - spec/support/integration_example_group.rb
683
684
  - spec/support/jslint.yml
@@ -1,5 +0,0 @@
1
- class Object
2
- def to_html
3
- to_s
4
- end
5
- end