magic_grid 0.12.3 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,16 +19,20 @@ begin
19
19
  require 'will_paginate/array'
20
20
  require 'will_paginate/view_helpers/action_view'
21
21
  puts "Testing with WillPaginate"
22
+ $will_paginate = true
22
23
  rescue LoadError
23
24
  puts "skipping WillPaginate"
25
+ $will_paginate = false
24
26
  end
25
27
 
26
28
  begin
27
29
  require 'kaminari'
28
30
  require 'kaminari/models/array_extension'
29
31
  puts "Testing with Kaminari"
32
+ $kaminari = true
30
33
  rescue LoadError
31
34
  puts "skipping Kaminari"
35
+ $kaminari = false
32
36
  end
33
37
 
34
38
  class NullObject
@@ -77,14 +81,15 @@ module FakeCollections
77
81
 
78
82
  def fake_active_record_collection(table_name = 'some_table',
79
83
  columns = [:name, :description])
84
+ columns = columns.map{|c| {:name => c} }
80
85
  (1..1000).to_a.tap do |c|
81
- c.stub(connection: fake_connection)
82
- c.stub(quoted_table_name: table_name)
83
- c.stub(table_name: table_name)
84
- c.stub(to_sql: "SELECT * FROM MONKEYS")
86
+ c.stub(:connection => fake_connection)
87
+ c.stub(:quoted_table_name => table_name)
88
+ c.stub(:table_name => table_name)
89
+ c.stub(:to_sql => "SELECT * FROM MONKEYS")
85
90
  c.stub(:table) {
86
91
  double.tap do |t|
87
- t.stub(:columns) { columns.map{|c| {name: c} } }
92
+ t.stub(:columns => columns)
88
93
  end
89
94
  }
90
95
  c.stub(:where) { c }
@@ -99,8 +104,8 @@ RSpec.configure do |config|
99
104
  config.filter_run :focus
100
105
 
101
106
  config.include ActionView::Helpers
102
- config.include WillPaginate::ActionView if Module.const_defined? :WillPaginate
103
- config.include Kaminari::ActionViewExtension if Module.const_defined? :Kaminari
107
+ config.include WillPaginate::ActionView if $will_paginate
108
+ config.include Kaminari::ActionViewExtension if $kaminari
104
109
  config.include ActionFaker
105
110
  config.include FakeCollections
106
111
 
@@ -16,7 +16,7 @@ class PostsController < ApplicationController
16
16
 
17
17
  respond_to do |format|
18
18
  format.html # index.html.erb
19
- format.json { render json: @posts }
19
+ format.json { render :json => @posts }
20
20
  end
21
21
  end
22
22
 
@@ -27,7 +27,7 @@ class PostsController < ApplicationController
27
27
  @posts = Post.includes(:user).where(:user_id => params[:user_id])
28
28
  respond_to do |format|
29
29
  format.html # by_user.html.erb
30
- format.json { render json: @posts }
30
+ format.json { render :json => @posts }
31
31
  end
32
32
  end
33
33
 
@@ -38,7 +38,7 @@ class PostsController < ApplicationController
38
38
 
39
39
  respond_to do |format|
40
40
  format.html # show.html.erb
41
- format.json { render json: @post }
41
+ format.json { render :json => @post }
42
42
  end
43
43
  end
44
44
 
@@ -49,7 +49,7 @@ class PostsController < ApplicationController
49
49
 
50
50
  respond_to do |format|
51
51
  format.html # new.html.erb
52
- format.json { render json: @post }
52
+ format.json { render :json => @post }
53
53
  end
54
54
  end
55
55
 
@@ -65,11 +65,11 @@ class PostsController < ApplicationController
65
65
 
66
66
  respond_to do |format|
67
67
  if @post.save
68
- format.html { redirect_to @post, notice: 'Post was successfully created.' }
69
- format.json { render json: @post, status: :created, location: @post }
68
+ format.html { redirect_to @post, :notice => 'Post was successfully created.' }
69
+ format.json { render :json => @post, :status => :created, :location => @post }
70
70
  else
71
- format.html { render action: "new" }
72
- format.json { render json: @post.errors, status: :unprocessable_entity }
71
+ format.html { render :action => "new" }
72
+ format.json { render :json => @post.errors, :status => :unprocessable_entity }
73
73
  end
74
74
  end
75
75
  end
@@ -81,11 +81,11 @@ class PostsController < ApplicationController
81
81
 
82
82
  respond_to do |format|
83
83
  if @post.update_attributes(params[:post])
84
- format.html { redirect_to @post, notice: 'Post was successfully updated.' }
84
+ format.html { redirect_to @post, :notice => 'Post was successfully updated.' }
85
85
  format.json { head :ok }
86
86
  else
87
- format.html { render action: "edit" }
88
- format.json { render json: @post.errors, status: :unprocessable_entity }
87
+ format.html { render :action => "edit" }
88
+ format.json { render :json => @post.errors, :status => :unprocessable_entity }
89
89
  end
90
90
  end
91
91
  end
@@ -1,4 +1,4 @@
1
- if Module.const_defined? :WillPaginate
1
+ if defined? WillPaginate
2
2
  require 'will_paginate/array'
3
3
  end
4
4
 
@@ -11,7 +11,7 @@ class UsersController < ApplicationController
11
11
 
12
12
  respond_to do |format|
13
13
  format.html # index.html.erb
14
- format.json { render json: @users }
14
+ format.json { render :json => @users }
15
15
  end
16
16
  end
17
17
 
@@ -22,7 +22,7 @@ class UsersController < ApplicationController
22
22
 
23
23
  respond_to do |format|
24
24
  format.html # show.html.erb
25
- format.json { render json: @user }
25
+ format.json { render :json => @user }
26
26
  end
27
27
  end
28
28
 
@@ -33,7 +33,7 @@ class UsersController < ApplicationController
33
33
 
34
34
  respond_to do |format|
35
35
  format.html # new.html.erb
36
- format.json { render json: @user }
36
+ format.json { render :json => @user }
37
37
  end
38
38
  end
39
39
 
@@ -49,11 +49,11 @@ class UsersController < ApplicationController
49
49
 
50
50
  respond_to do |format|
51
51
  if @user.save
52
- format.html { redirect_to @user, notice: 'User was successfully created.' }
53
- format.json { render json: @user, status: :created, location: @user }
52
+ format.html { redirect_to @user, :notice => 'User was successfully created.' }
53
+ format.json { render :json => @user, :status => :created, :location => @user }
54
54
  else
55
- format.html { render action: "new" }
56
- format.json { render json: @user.errors, status: :unprocessable_entity }
55
+ format.html { render :action => "new" }
56
+ format.json { render :json => @user.errors, :status => :unprocessable_entity }
57
57
  end
58
58
  end
59
59
  end
@@ -65,11 +65,11 @@ class UsersController < ApplicationController
65
65
 
66
66
  respond_to do |format|
67
67
  if @user.update_attributes(params[:user])
68
- format.html { redirect_to @user, notice: 'User was successfully updated.' }
68
+ format.html { redirect_to @user, :notice => 'User was successfully updated.' }
69
69
  format.json { head :ok }
70
70
  else
71
- format.html { render action: "edit" }
72
- format.json { render json: @user.errors, status: :unprocessable_entity }
71
+ format.html { render :action => "edit" }
72
+ format.json { render :json => @user.errors, :status => :unprocessable_entity }
73
73
  end
74
74
  end
75
75
  end
@@ -9,7 +9,7 @@
9
9
  :to_s => Proc.new { |post| %>
10
10
  <%= link_to 'Show', post %>
11
11
  <%= link_to 'Edit', edit_post_path(post) %>
12
- <%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %>
12
+ <%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %>
13
13
  <% }
14
14
  }
15
15
  ],
@@ -18,7 +18,7 @@
18
18
  :to_s => Proc.new { |post| %>
19
19
  <%= link_to 'Show', post %>
20
20
  <%= link_to 'Edit', edit_post_path(post) %>
21
- <%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %>
21
+ <%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %>
22
22
  <% }
23
23
  }
24
24
  ],
@@ -32,7 +32,7 @@
32
32
  },
33
33
  :searcher_size => 42,
34
34
  :id => 1,
35
- :remote => true,
35
+ :remote => true
36
36
  ) %>
37
37
 
38
38
  <h3>Basic grid with built-in search</h3>
@@ -45,7 +45,7 @@
45
45
  :to_s => Proc.new { |post| %>
46
46
  <%= link_to 'Show', post %>
47
47
  <%= link_to 'Edit', edit_post_path(post) %>
48
- <%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %>
48
+ <%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %>
49
49
  <% }
50
50
  }
51
51
  ],
@@ -68,7 +68,7 @@
68
68
  <td>
69
69
  <%= link_to 'Show', post %>
70
70
  <%= link_to 'Edit', edit_post_path(post) %>
71
- <%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %>
71
+ <%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %>
72
72
  </td>
73
73
  </tr>
74
74
  <% end %>
@@ -10,7 +10,7 @@
10
10
  <td>
11
11
  <%= link_to 'Show', user %>
12
12
  <%= link_to 'Edit', edit_user_path(user) %>
13
- <%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %>
13
+ <%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
14
14
  </td>
15
15
  </tr>
16
16
  <% end %>
@@ -33,7 +33,7 @@
33
33
  <td>
34
34
  <%= link_to 'Show', user %>
35
35
  <%= link_to 'Edit', edit_user_path(user) %>
36
- <%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %>
36
+ <%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
37
37
  </td>
38
38
  </tr>
39
39
  <% end %>
@@ -1,6 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
4
 
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
@@ -5,7 +5,7 @@
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
8
+ wrap_parameters :format => [:json]
9
9
  end
10
10
 
11
11
  # Disable root element in JSON by default.
@@ -16,7 +16,7 @@ two:
16
16
  <% story = 'It was a dark and stormy night and the Captain said, "Tell me a story, son". So I began. ' * 100 %>
17
17
  <% 500.times do |i| %>
18
18
  post_<%= i %>:
19
- title: <%= title.split.rotate(i).join " " %>
19
+ title: <%= "#{title}, part #{i}" %>
20
20
  body: <%= story %>
21
21
  published: <%= i.even? %>
22
22
  user: user_<%= i % 100 %>
@@ -18,30 +18,30 @@ class PostsControllerTest < ActionController::TestCase
18
18
 
19
19
  test "should create post" do
20
20
  assert_difference('Post.count') do
21
- post :create, post: @post.attributes
21
+ post :create, :post => @post.attributes
22
22
  end
23
23
 
24
24
  assert_redirected_to post_path(assigns(:post))
25
25
  end
26
26
 
27
27
  test "should show post" do
28
- get :show, id: @post.to_param
28
+ get :show, :id => @post.to_param
29
29
  assert_response :success
30
30
  end
31
31
 
32
32
  test "should get edit" do
33
- get :edit, id: @post.to_param
33
+ get :edit, :id => @post.to_param
34
34
  assert_response :success
35
35
  end
36
36
 
37
37
  test "should update post" do
38
- put :update, id: @post.to_param, post: @post.attributes
38
+ put :update, :id => @post.to_param, :post => @post.attributes
39
39
  assert_redirected_to post_path(assigns(:post))
40
40
  end
41
41
 
42
42
  test "should destroy post" do
43
43
  assert_difference('Post.count', -1) do
44
- delete :destroy, id: @post.to_param
44
+ delete :destroy, :id => @post.to_param
45
45
  end
46
46
 
47
47
  assert_redirected_to posts_path
@@ -19,30 +19,30 @@ class UsersControllerTest < ActionController::TestCase
19
19
 
20
20
  test "should create user" do
21
21
  assert_difference('User.count') do
22
- post :create, user: @user.attributes
22
+ post :create, :user => @user.attributes
23
23
  end
24
24
 
25
25
  assert_redirected_to user_path(assigns(:user))
26
26
  end
27
27
 
28
28
  test "should show user" do
29
- get :show, id: @user.to_param
29
+ get :show, :id => @user.to_param
30
30
  assert_response :success
31
31
  end
32
32
 
33
33
  test "should get edit" do
34
- get :edit, id: @user.to_param
34
+ get :edit, :id => @user.to_param
35
35
  assert_response :success
36
36
  end
37
37
 
38
38
  test "should update user" do
39
- put :update, id: @user.to_param, user: @user.attributes
39
+ put :update, :id => @user.to_param, :user => @user.attributes
40
40
  assert_redirected_to user_path(assigns(:user))
41
41
  end
42
42
 
43
43
  test "should destroy user" do
44
44
  assert_difference('User.count', -1) do
45
- delete :destroy, id: @user.to_param
45
+ delete :destroy, :id => @user.to_param
46
46
  end
47
47
 
48
48
  assert_redirected_to users_path
metadata CHANGED
@@ -1,96 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.3
5
4
  prerelease:
5
+ version: 0.12.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan Graham
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-30 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
17
16
  none: false
18
17
  requirements:
19
18
  - - ! '>='
20
19
  - !ruby/object:Gem::Version
21
20
  version: '3.1'
22
- type: :runtime
23
21
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
22
+ name: rails
23
+ requirement: !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ! '>='
28
27
  - !ruby/object:Gem::Version
29
28
  version: '3.1'
29
+ type: :runtime
30
30
  - !ruby/object:Gem::Dependency
31
- name: jquery-rails
32
- requirement: !ruby/object:Gem::Requirement
31
+ version_requirements: !ruby/object:Gem::Requirement
33
32
  none: false
34
33
  requirements:
35
34
  - - ! '>='
36
35
  - !ruby/object:Gem::Version
37
36
  version: 1.0.17
38
- type: :runtime
39
37
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
38
+ name: jquery-rails
39
+ requirement: !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
43
42
  - - ! '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: 1.0.17
45
+ type: :runtime
46
46
  - !ruby/object:Gem::Dependency
47
- name: rake
48
- requirement: !ruby/object:Gem::Requirement
47
+ version_requirements: !ruby/object:Gem::Requirement
49
48
  none: false
50
49
  requirements:
51
50
  - - ! '>='
52
51
  - !ruby/object:Gem::Version
53
52
  version: 0.9.2
54
- type: :development
55
53
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
54
+ name: rake
55
+ requirement: !ruby/object:Gem::Requirement
57
56
  none: false
58
57
  requirements:
59
58
  - - ! '>='
60
59
  - !ruby/object:Gem::Version
61
60
  version: 0.9.2
61
+ type: :development
62
62
  - !ruby/object:Gem::Dependency
63
- name: tarantula
64
- requirement: !ruby/object:Gem::Requirement
63
+ version_requirements: !ruby/object:Gem::Requirement
65
64
  none: false
66
65
  requirements:
67
66
  - - ~>
68
67
  - !ruby/object:Gem::Version
69
68
  version: 0.4.0
70
- type: :development
71
69
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
70
+ name: tarantula
71
+ requirement: !ruby/object:Gem::Requirement
73
72
  none: false
74
73
  requirements:
75
74
  - - ~>
76
75
  - !ruby/object:Gem::Version
77
76
  version: 0.4.0
77
+ type: :development
78
78
  - !ruby/object:Gem::Dependency
79
- name: rspec
80
- requirement: !ruby/object:Gem::Requirement
79
+ version_requirements: !ruby/object:Gem::Requirement
81
80
  none: false
82
81
  requirements:
83
82
  - - ~>
84
83
  - !ruby/object:Gem::Version
85
84
  version: 2.11.0
86
- type: :development
87
85
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
86
+ name: rspec
87
+ requirement: !ruby/object:Gem::Requirement
89
88
  none: false
90
89
  requirements:
91
90
  - - ~>
92
91
  - !ruby/object:Gem::Version
93
92
  version: 2.11.0
93
+ type: :development
94
94
  description: ! " Displays a collection (ActiveRelation or Array-like object) wrapped
95
95
  in an\n html table with server side column sorting, filtering hooks, and search\n
96
96
  \ bar. Large collections can be paginated with either the will_paginate gem\n
@@ -212,19 +212,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ! '>='
214
214
  - !ruby/object:Gem::Version
215
- version: '0'
216
215
  segments:
217
216
  - 0
218
- hash: 1658296312752844098
217
+ hash: -4357182830719738575
218
+ version: '0'
219
219
  required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  none: false
221
221
  requirements:
222
222
  - - ! '>='
223
223
  - !ruby/object:Gem::Version
224
- version: '0'
225
224
  segments:
226
225
  - 0
227
- hash: 1658296312752844098
226
+ hash: -4357182830719738575
227
+ version: '0'
228
228
  requirements: []
229
229
  rubyforge_project:
230
230
  rubygems_version: 1.8.23