mighty_grid 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -1
  3. data/.travis.yml +10 -3
  4. data/Appraisals +6 -3
  5. data/Gemfile +8 -3
  6. data/Rakefile +5 -6
  7. data/features/filtering.feature +14 -13
  8. data/features/step_definitions/steps.rb +4 -4
  9. data/features/support/capybara.rb +8 -0
  10. data/features/support/database_cleaner.rb +2 -2
  11. data/features/support/env.rb +4 -3
  12. data/features/support/paths.rb +4 -4
  13. data/gemfiles/rails_32.gemfile +9 -4
  14. data/gemfiles/rails_40.gemfile +7 -2
  15. data/gemfiles/rails_41.gemfile +7 -2
  16. data/lib/generators/mighty_grid/install_generator.rb +4 -2
  17. data/lib/generators/mighty_grid/templates/mighty_grid_config.rb +1 -1
  18. data/lib/mighty_grid/base.rb +30 -33
  19. data/lib/mighty_grid/column.rb +16 -18
  20. data/lib/mighty_grid/config.rb +1 -1
  21. data/lib/mighty_grid/engine.rb +1 -3
  22. data/lib/mighty_grid/filter_renderer.rb +24 -24
  23. data/lib/mighty_grid/grid_renderer.rb +8 -6
  24. data/lib/mighty_grid/helpers/mighty_grid_view_helpers.rb +71 -74
  25. data/lib/mighty_grid/kaminari_monkey_patching.rb +1 -1
  26. data/lib/mighty_grid/mighty_grid_controller.rb +4 -6
  27. data/lib/mighty_grid/mighty_grid_ext.rb +2 -2
  28. data/lib/mighty_grid/mighty_grid_misc.rb +2 -4
  29. data/lib/mighty_grid/version.rb +1 -1
  30. data/lib/mighty_grid.rb +1 -1
  31. data/mighty_grid.gemspec +11 -11
  32. data/spec/config_spec.rb +27 -27
  33. data/spec/dummy/Rakefile +6 -0
  34. data/spec/dummy/app/assets/images/.keep +0 -0
  35. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  36. data/spec/dummy/app/assets/stylesheets/application.css +16 -0
  37. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  38. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  39. data/spec/dummy/app/controllers/users_controller.rb +5 -0
  40. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  41. data/spec/dummy/app/mailers/.keep +0 -0
  42. data/spec/dummy/app/models/.keep +0 -0
  43. data/spec/dummy/app/models/company.rb +3 -0
  44. data/spec/dummy/app/models/concerns/.keep +0 -0
  45. data/spec/dummy/app/models/user.rb +3 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  47. data/spec/{fake_app/views/index.html.erb → dummy/app/views/users/index.html} +0 -6
  48. data/spec/dummy/bin/bundle +3 -0
  49. data/spec/dummy/bin/rails +4 -0
  50. data/spec/dummy/bin/rake +4 -0
  51. data/spec/dummy/config/application.rb +31 -0
  52. data/spec/dummy/config/boot.rb +5 -0
  53. data/spec/dummy/config/database.yml.travis +28 -0
  54. data/spec/dummy/config/environment.rb +9 -0
  55. data/spec/dummy/config/environments/development.rb +38 -0
  56. data/spec/dummy/config/environments/production.rb +83 -0
  57. data/spec/dummy/config/environments/test.rb +39 -0
  58. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  59. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  60. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  61. data/spec/dummy/config/initializers/inflections.rb +16 -0
  62. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  63. data/spec/dummy/config/initializers/secret_token.rb +16 -0
  64. data/spec/dummy/config/initializers/session_store.rb +3 -0
  65. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  66. data/spec/dummy/config/locales/en.yml +23 -0
  67. data/spec/dummy/config/routes.rb +10 -0
  68. data/spec/dummy/config/secrets.yml +22 -0
  69. data/spec/dummy/config.ru +4 -0
  70. data/spec/dummy/db/migrate/20140727125647_create_users.rb +12 -0
  71. data/spec/dummy/db/migrate/20140727141742_create_companies.rb +9 -0
  72. data/spec/dummy/db/schema.rb +31 -0
  73. data/spec/dummy/lib/assets/.keep +0 -0
  74. data/spec/dummy/public/404.html +67 -0
  75. data/spec/dummy/public/422.html +67 -0
  76. data/spec/dummy/public/500.html +66 -0
  77. data/spec/dummy/public/favicon.ico +0 -0
  78. data/spec/lib/base_spec.rb +31 -54
  79. data/spec/lib/column_spec.rb +13 -13
  80. data/spec/lib/generators/install_generator_spec.rb +7 -7
  81. data/spec/spec_helper.rb +5 -3
  82. data/spec/support/capybara.rb +0 -4
  83. data/spec/support/database_cleaner.rb +1 -5
  84. metadata +94 -12
  85. data/spec/fake_app/config/database.yml.example +0 -14
  86. data/spec/fake_app/models/active_record.rb +0 -25
  87. data/spec/fake_app/models/config.rb +0 -5
  88. data/spec/fake_app/rails_app.rb +0 -39
@@ -1,7 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe MightyGrid::Base do
4
-
4
+ DIRECTIONS = ['asc', 'desc']
5
+
5
6
  before(:all) do
6
7
  @controller = ActionView::TestCase::TestController.new
7
8
 
@@ -9,7 +10,7 @@ describe MightyGrid::Base do
9
10
  page: 1,
10
11
  per_page: 15,
11
12
  name: 'grid',
12
- :include => nil,
13
+ include: nil,
13
14
  joins: nil,
14
15
  conditions: nil,
15
16
  group: nil
@@ -41,93 +42,69 @@ describe MightyGrid::Base do
41
42
  end
42
43
 
43
44
  context 'with custom' do
44
- before(:all){ @controller.params = {'grid' => {page: 5, per_page: 30, name: 'grid2'}} }
45
+ before(:all) { @controller.params = { 'grid' => { page: 5, per_page: 30, name: 'grid2' } } }
45
46
  subject { MightyGrid::Base.new(User, @controller) }
46
47
  its(:params) { should == @controller.params }
47
48
  its(:mg_params) { should == @default_options.merge(page: 5, per_page: 30, name: 'grid2') }
48
- after(:all){ @controller.params = {} }
49
+ after(:all) { @controller.params = {} }
49
50
  end
50
51
 
51
52
  context 'with bad options' do
52
- it { expect{MightyGrid::Base.new(User, @controller, bad_option: 123)}.to raise_error(ArgumentError) }
53
+ it { expect { MightyGrid::Base.new(User, @controller, bad_option: 123) }.to raise_error(ArgumentError) }
53
54
  end
54
55
  end
55
56
 
56
57
  describe '#get_current_grid_param' do
57
- before(:all){ @controller.params = {'grid'=>{per_page: 30}} }
58
+ before(:all) { @controller.params = { 'grid' => { per_page: 30 } } }
58
59
  subject { MightyGrid::Base.new(User, @controller).get_current_grid_param(:per_page) }
59
60
  it { should == 30 }
60
- after(:all){ @controller.params = {} }
61
+ after(:all) { @controller.params = {} }
61
62
  end
62
63
 
63
64
  describe '#current_order_direction' do
64
- context 'with ASC controller param' do
65
- before(:all){ @controller.params = {'grid'=>{'order_direction' => 'asc'}} }
66
- subject { MightyGrid::Base.new(User, @controller) }
67
- its(:current_order_direction) { should == 'asc' }
68
- after(:all){ @controller.params = {} }
69
- end
70
-
71
- context 'with DESC controller param' do
72
- before(:all){ @controller.params = {'grid'=>{'order_direction' => 'desc'}} }
73
- subject { MightyGrid::Base.new(User, @controller) }
74
- its(:current_order_direction) { should == 'desc' }
75
- after(:all){ @controller.params = {} }
76
- end
77
-
78
- context 'with BAD controller param' do
79
- before(:all){ @controller.params = {'grid'=>{'order_direction' => 'bad'}} }
80
- subject { MightyGrid::Base.new(User, @controller) }
81
- its(:current_order_direction) { should == nil }
82
- after(:all){ @controller.params = {} }
65
+ (DIRECTIONS + ['bad']).each do |direction|
66
+ context "with #{ direction.upcase } controller param" do
67
+ before(:all) { @controller.params = { 'grid' => { 'order_direction' => direction } } }
68
+ subject { MightyGrid::Base.new(User, @controller) }
69
+ its(:current_order_direction) { should == (direction.in?(DIRECTIONS) ? direction : nil) }
70
+ after(:all) { @controller.params = {} }
71
+ end
83
72
  end
84
73
  end
85
74
 
86
75
  describe '#another_order_direction' do
87
- context 'with ASC controller param' do
88
- before(:all){ @controller.params = {'grid'=>{'order_direction' => 'asc'}} }
89
- subject { MightyGrid::Base.new(User, @controller) }
90
- its(:another_order_direction) { should == 'desc' }
91
- after(:all){ @controller.params = {} }
92
- end
93
-
94
- context 'with DESC controller param' do
95
- before(:all){ @controller.params = {'grid'=>{'order_direction' => 'desc'}} }
96
- subject { MightyGrid::Base.new(User, @controller) }
97
- its(:another_order_direction) { should == 'asc' }
98
- after(:all){ @controller.params = {} }
99
- end
100
-
101
- context 'with BAD controller param' do
102
- before(:all){ @controller.params = {'grid'=>{'order_direction' => 'bad'}} }
103
- subject { MightyGrid::Base.new(User, @controller) }
104
- its(:another_order_direction) { should == 'asc' }
105
- after(:all){ @controller.params = {} }
76
+ (DIRECTIONS + ['bad']).each do |direction|
77
+ context "with #{ direction.upcase } controller param" do
78
+ before(:all) { @controller.params = { 'grid' => { 'order_direction' => direction } } }
79
+ subject { MightyGrid::Base.new(User, @controller) }
80
+ its(:another_order_direction) { should == (direction == 'asc' ? 'desc' : 'asc') }
81
+ after(:all) { @controller.params = {} }
82
+ end
106
83
  end
107
84
  end
108
85
 
109
86
  describe '#order_params' do
110
- before(:all){ @controller.params = {'grid'=>{'order' => 'name', 'order_direction' => 'asc'}} }
87
+ before(:all) { @controller.params = { 'grid' => { 'order' => 'name', 'order_direction' => 'asc' } } }
111
88
  subject { MightyGrid::Base.new(User, @controller) }
112
89
  context 'with current order attribute' do
113
- it { subject.order_params(:name).should == {'grid'=>{order: 'name', order_direction: 'desc'}} }
90
+ it { subject.order_params(:name).should == { 'grid' => { order: 'name', order_direction: 'desc' } } }
114
91
  end
115
92
  context 'with other order attribute' do
116
- it { subject.order_params(:description).should == {'grid'=>{order: 'description', order_direction: 'asc'}} }
93
+ it { subject.order_params(:description).should == { 'grid' => { order: 'description', order_direction: 'asc' } } }
117
94
  end
118
- after(:all){ @controller.params = {} }
95
+ after(:all) { @controller.params = {} }
119
96
  end
120
97
 
121
98
  describe '#like_operator' do
122
99
  subject { MightyGrid::Base.new(User, @controller) }
123
100
  context "when DB is #{ENV['DB']}" do
124
101
  case ENV['DB']
125
- when 'postgresql'
126
- it{ subject.like_operator.should == 'ILIKE' }
127
- when 'sqlite', 'mysql'
128
- it{ subject.like_operator.should == 'LIKE' }
102
+ when 'postgresql'
103
+ it { subject.like_operator.should == 'ILIKE' }
104
+ when 'sqlite', 'mysql'
105
+ it { subject.like_operator.should == 'LIKE' }
129
106
  end
130
107
  end
131
108
  end
132
109
 
133
- end
110
+ end
@@ -5,7 +5,7 @@ describe MightyGrid::Column do
5
5
  describe '#new' do
6
6
  describe 'with attribute' do
7
7
  context 'without options' do
8
- subject { MightyGrid::Column.new({attribute: :name}) }
8
+ subject { MightyGrid::Column.new(attribute: :name) }
9
9
  context 'parameters' do
10
10
  its(:attribute) { should == :name }
11
11
  its(:render_value) { should == :name }
@@ -16,30 +16,30 @@ describe MightyGrid::Column do
16
16
  end
17
17
 
18
18
  context 'with html option' do
19
- let(:options) { {html: {class: 'column'}} }
20
- subject { MightyGrid::Column.new({attribute: :name}.merge(options)) }
19
+ let(:options) { { html: { class: 'column' } } }
20
+ subject { MightyGrid::Column.new({ attribute: :name }.merge(options)) }
21
21
  its(:options) { should == options }
22
22
  its(:attrs) { should == options[:html] }
23
23
  end
24
24
 
25
25
  context 'with title option' do
26
- let(:options) { {title: 'Name'} }
27
- subject { MightyGrid::Column.new({attribute: :name}.merge(options)) }
26
+ let(:options) { { title: 'Name' } }
27
+ subject { MightyGrid::Column.new({ attribute: :name }.merge(options)) }
28
28
  its(:options) { should == options }
29
29
  its(:title) { should == options[:title] }
30
30
  end
31
31
 
32
32
  context 'with th_html option' do
33
- let(:options) { {th_html: {class: 'active'}} }
34
- subject { MightyGrid::Column.new({attribute: :name}.merge(options)) }
33
+ let(:options) { { th_html: { class: 'active' } } }
34
+ subject { MightyGrid::Column.new({ attribute: :name }.merge(options)) }
35
35
  its(:options) { should == options }
36
- its(:th_attrs) { should == {class: 'active'} }
36
+ its(:th_attrs) { should == { class: 'active' } }
37
37
  end
38
38
  end
39
39
 
40
40
  describe 'with block' do
41
41
  context 'without options' do
42
- subject { MightyGrid::Column.new {:test} }
42
+ subject { MightyGrid::Column.new { :test } }
43
43
  context 'parameters' do
44
44
  its(:attribute) { should == nil }
45
45
  its(:title) { should == '' }
@@ -52,21 +52,21 @@ describe MightyGrid::Column do
52
52
  end
53
53
 
54
54
  describe '.render' do
55
- let(:user){ User.create(name: 'user name') }
55
+ let(:user) { User.create(name: 'user name') }
56
56
 
57
57
  describe 'with attribute' do
58
- subject(:column){ MightyGrid::Column.new({attribute: :name}) }
58
+ subject(:column) { MightyGrid::Column.new(attribute: :name) }
59
59
  it 'should return attribute value' do
60
60
  column.render(user).should == user[:name]
61
61
  end
62
62
  end
63
63
 
64
64
  describe 'with block' do
65
- subject(:column){ MightyGrid::Column.new { "#{user.name} 1" } }
65
+ subject(:column) { MightyGrid::Column.new { "#{user.name} 1" } }
66
66
  it 'should return attribute value' do
67
67
  column.render(user).should == "#{user[:name]} 1"
68
68
  end
69
69
  end
70
70
  end
71
71
 
72
- end
72
+ end
@@ -1,21 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
- require "generator_spec"
3
+ require 'generator_spec'
4
4
 
5
5
  describe MightyGrid::Generators::InstallGenerator do
6
- destination File.expand_path("../../tmp", __FILE__)
6
+ destination File.expand_path('../../tmp', __FILE__)
7
7
 
8
8
  before(:all) do
9
9
  prepare_destination
10
10
  run_generator
11
11
  end
12
12
 
13
- it "creates config initializer" do
14
- assert_file "config/initializers/mighty_grid_config.rb"
13
+ it 'creates config initializer' do
14
+ assert_file 'config/initializers/mighty_grid_config.rb'
15
15
  end
16
16
 
17
- it "creates locale file" do
18
- assert_file "config/locales/mighty_grid.en.yml"
17
+ it 'creates locale file' do
18
+ assert_file 'config/locales/mighty_grid.en.yml'
19
19
  end
20
20
 
21
- end
21
+ end
data/spec/spec_helper.rb CHANGED
@@ -10,18 +10,20 @@ end
10
10
  require 'bundler/setup'
11
11
  Bundler.require
12
12
 
13
+ require 'capybara/rspec'
14
+
13
15
  require 'coveralls'
14
16
  Coveralls.wear!
15
17
 
16
- require "codeclimate-test-reporter"
18
+ require 'codeclimate-test-reporter'
17
19
  CodeClimate::TestReporter.start
18
20
 
19
21
  if defined? Rails
20
- require 'fake_app/rails_app'
22
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
21
23
  require 'rspec-rails'
22
24
  end
23
25
 
24
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
26
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
25
27
 
26
28
  RSpec.configure do |config|
27
29
  config.treat_symbols_as_metadata_keys_with_true_values = true
@@ -4,7 +4,3 @@ require 'capybara/dsl'
4
4
  RSpec.configure do |config|
5
5
  config.include Capybara::DSL
6
6
  end
7
-
8
- Capybara.configure do |config|
9
- config.run_server = false
10
- end
@@ -10,8 +10,4 @@ RSpec.configure do |config|
10
10
  config.after :each do
11
11
  DatabaseCleaner.clean
12
12
  end
13
-
14
- config.after :suite do
15
- CreateAllTables.down
16
- end
17
- end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mighty_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jurrick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-29 00:00:00.000000000 Z
11
+ date: 2014-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,6 +106,7 @@ files:
106
106
  - config/locales/en.yml
107
107
  - features/filtering.feature
108
108
  - features/step_definitions/steps.rb
109
+ - features/support/capybara.rb
109
110
  - features/support/database_cleaner.rb
110
111
  - features/support/env.rb
111
112
  - features/support/paths.rb
@@ -129,11 +130,51 @@ files:
129
130
  - lib/mighty_grid/version.rb
130
131
  - mighty_grid.gemspec
131
132
  - spec/config_spec.rb
132
- - spec/fake_app/config/database.yml.example
133
- - spec/fake_app/models/active_record.rb
134
- - spec/fake_app/models/config.rb
135
- - spec/fake_app/rails_app.rb
136
- - spec/fake_app/views/index.html.erb
133
+ - spec/dummy/Rakefile
134
+ - spec/dummy/app/assets/images/.keep
135
+ - spec/dummy/app/assets/javascripts/application.js
136
+ - spec/dummy/app/assets/stylesheets/application.css
137
+ - spec/dummy/app/controllers/application_controller.rb
138
+ - spec/dummy/app/controllers/concerns/.keep
139
+ - spec/dummy/app/controllers/users_controller.rb
140
+ - spec/dummy/app/helpers/application_helper.rb
141
+ - spec/dummy/app/mailers/.keep
142
+ - spec/dummy/app/models/.keep
143
+ - spec/dummy/app/models/company.rb
144
+ - spec/dummy/app/models/concerns/.keep
145
+ - spec/dummy/app/models/user.rb
146
+ - spec/dummy/app/views/layouts/application.html.erb
147
+ - spec/dummy/app/views/users/index.html
148
+ - spec/dummy/bin/bundle
149
+ - spec/dummy/bin/rails
150
+ - spec/dummy/bin/rake
151
+ - spec/dummy/config.ru
152
+ - spec/dummy/config/application.rb
153
+ - spec/dummy/config/boot.rb
154
+ - spec/dummy/config/database.yml.travis
155
+ - spec/dummy/config/environment.rb
156
+ - spec/dummy/config/environments/development.rb
157
+ - spec/dummy/config/environments/production.rb
158
+ - spec/dummy/config/environments/test.rb
159
+ - spec/dummy/config/initializers/backtrace_silencers.rb
160
+ - spec/dummy/config/initializers/cookies_serializer.rb
161
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
162
+ - spec/dummy/config/initializers/inflections.rb
163
+ - spec/dummy/config/initializers/mime_types.rb
164
+ - spec/dummy/config/initializers/secret_token.rb
165
+ - spec/dummy/config/initializers/session_store.rb
166
+ - spec/dummy/config/initializers/wrap_parameters.rb
167
+ - spec/dummy/config/locales/en.yml
168
+ - spec/dummy/config/routes.rb
169
+ - spec/dummy/config/secrets.yml
170
+ - spec/dummy/db/migrate/20140727125647_create_users.rb
171
+ - spec/dummy/db/migrate/20140727141742_create_companies.rb
172
+ - spec/dummy/db/schema.rb
173
+ - spec/dummy/lib/assets/.keep
174
+ - spec/dummy/public/404.html
175
+ - spec/dummy/public/422.html
176
+ - spec/dummy/public/500.html
177
+ - spec/dummy/public/favicon.ico
137
178
  - spec/lib/base_spec.rb
138
179
  - spec/lib/column_spec.rb
139
180
  - spec/lib/generators/install_generator_spec.rb
@@ -169,15 +210,56 @@ summary: Flexible grid for Rails
169
210
  test_files:
170
211
  - features/filtering.feature
171
212
  - features/step_definitions/steps.rb
213
+ - features/support/capybara.rb
172
214
  - features/support/database_cleaner.rb
173
215
  - features/support/env.rb
174
216
  - features/support/paths.rb
175
217
  - spec/config_spec.rb
176
- - spec/fake_app/config/database.yml.example
177
- - spec/fake_app/models/active_record.rb
178
- - spec/fake_app/models/config.rb
179
- - spec/fake_app/rails_app.rb
180
- - spec/fake_app/views/index.html.erb
218
+ - spec/dummy/Rakefile
219
+ - spec/dummy/app/assets/images/.keep
220
+ - spec/dummy/app/assets/javascripts/application.js
221
+ - spec/dummy/app/assets/stylesheets/application.css
222
+ - spec/dummy/app/controllers/application_controller.rb
223
+ - spec/dummy/app/controllers/concerns/.keep
224
+ - spec/dummy/app/controllers/users_controller.rb
225
+ - spec/dummy/app/helpers/application_helper.rb
226
+ - spec/dummy/app/mailers/.keep
227
+ - spec/dummy/app/models/.keep
228
+ - spec/dummy/app/models/company.rb
229
+ - spec/dummy/app/models/concerns/.keep
230
+ - spec/dummy/app/models/user.rb
231
+ - spec/dummy/app/views/layouts/application.html.erb
232
+ - spec/dummy/app/views/users/index.html
233
+ - spec/dummy/bin/bundle
234
+ - spec/dummy/bin/rails
235
+ - spec/dummy/bin/rake
236
+ - spec/dummy/config.ru
237
+ - spec/dummy/config/application.rb
238
+ - spec/dummy/config/boot.rb
239
+ - spec/dummy/config/database.yml.travis
240
+ - spec/dummy/config/environment.rb
241
+ - spec/dummy/config/environments/development.rb
242
+ - spec/dummy/config/environments/production.rb
243
+ - spec/dummy/config/environments/test.rb
244
+ - spec/dummy/config/initializers/backtrace_silencers.rb
245
+ - spec/dummy/config/initializers/cookies_serializer.rb
246
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
247
+ - spec/dummy/config/initializers/inflections.rb
248
+ - spec/dummy/config/initializers/mime_types.rb
249
+ - spec/dummy/config/initializers/secret_token.rb
250
+ - spec/dummy/config/initializers/session_store.rb
251
+ - spec/dummy/config/initializers/wrap_parameters.rb
252
+ - spec/dummy/config/locales/en.yml
253
+ - spec/dummy/config/routes.rb
254
+ - spec/dummy/config/secrets.yml
255
+ - spec/dummy/db/migrate/20140727125647_create_users.rb
256
+ - spec/dummy/db/migrate/20140727141742_create_companies.rb
257
+ - spec/dummy/db/schema.rb
258
+ - spec/dummy/lib/assets/.keep
259
+ - spec/dummy/public/404.html
260
+ - spec/dummy/public/422.html
261
+ - spec/dummy/public/500.html
262
+ - spec/dummy/public/favicon.ico
181
263
  - spec/lib/base_spec.rb
182
264
  - spec/lib/column_spec.rb
183
265
  - spec/lib/generators/install_generator_spec.rb
@@ -1,14 +0,0 @@
1
- sqlite:
2
- adapter: sqlite3
3
- database: ':memory:'
4
- timeout: 500
5
-
6
- mysql:
7
- adapter: mysql2
8
- database: 'mg_test'
9
- username: root
10
-
11
- postgresql:
12
- adapter: postgresql
13
- database: 'mg_test'
14
- username: postgres
@@ -1,25 +0,0 @@
1
- # MODELS
2
- class User < ActiveRecord::Base
3
- belongs_to :company
4
- end
5
-
6
- class Company < ActiveRecord::Base
7
- has_many :users
8
- end
9
-
10
- # MIGRATIONS
11
- class CreateAllTables < ActiveRecord::Migration
12
- def self.up
13
- create_table(:users) { |t| t.string :name; t.string :role; t.integer :company_id; t.boolean :is_banned, default: false, null: false }
14
- create_table(:companies) { |t| t.string :name; }
15
- end
16
-
17
- def self.down
18
- drop_table :users
19
- drop_table :companies
20
- end
21
- end
22
-
23
- CreateAllTables.down if User.table_exists? || Company.table_exists?
24
- ActiveRecord::Migration.verbose = false
25
- CreateAllTables.up
@@ -1,5 +0,0 @@
1
- configs = YAML.load_file('spec/fake_app/config/database.yml')
2
- ActiveRecord::Base.configurations = configs
3
-
4
- db_name = ENV['DB'] || 'sqlite'
5
- ActiveRecord::Base.establish_connection(db_name)
@@ -1,39 +0,0 @@
1
- require 'action_controller/railtie'
2
- require 'action_view/railtie'
3
-
4
- require 'capybara/rspec'
5
-
6
- require_relative 'models/config'
7
-
8
- app = Class.new(Rails::Application)
9
- app.config.secret_token = '7295e7f2718c940f459e5062f575cd92'
10
- app.config.session_store :cookie_store, :key => '_myapp_session'
11
- app.config.active_support.deprecation = :log
12
- app.config.eager_load = false
13
-
14
- # Rais.root
15
- app.config.root = File.dirname(__FILE__)
16
- Rails.backtrace_cleaner.remove_silencers!
17
- app.initialize!
18
-
19
- # ROUTES
20
- app.routes.draw do
21
- resources :users
22
- end
23
-
24
- # MODELS
25
- require_relative 'models/active_record'
26
-
27
- # CONTROLLERS
28
- class ApplicationController < ActionController::Base; end
29
- class UsersController < ApplicationController
30
- def index
31
- @users_grid = init_grid(User)
32
- render 'spec/fake_app/views/index', layout: false
33
- end
34
- end
35
-
36
- # HELPERS
37
- Object.const_set(:ApplicationHelper, Module.new)
38
-
39
- Capybara.app = app