rows_controller 1.1.7 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -13
- data/app/controllers/rows_ext_controller.rb +1 -1
- data/app/controllers/rows_ext_controller.rb.bak +18 -0
- data/app/views/rows/show.slim +4 -4
- data/lib/rows_controller/version.rb +1 -1
- data/lib/rows_controller/version.rb.bak +3 -0
- metadata +4 -58
- data/.rspec +0 -2
- data/.travis.yml +0 -14
- data/.watchr +0 -52
- data/Gemfile +0 -20
- data/Gemfile.lock +0 -133
- data/SNIPPETS +0 -12
- data/rows_controller.gemspec +0 -26
- data/spec/controllers/orders_spec.rb +0 -92
- data/spec/controllers/rows_ext_spec.rb +0 -6
- data/spec/controllers/rows_spec.rb +0 -24
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/controllers/orders_controller.rb +0 -12
- data/spec/dummy/app/models/order.rb +0 -11
- data/spec/dummy/app/views/layouts/application.html.erb +0 -13
- data/spec/dummy/app/views/orders/_form.html.erb +0 -12
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config/application.rb +0 -23
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -78
- data/spec/dummy/config/environments/test.rb +0 -39
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/secret_token.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/routes.rb +0 -7
- data/spec/dummy/config/secrets.yml +0 -10
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/001_create_orders.rb +0 -10
- data/spec/dummy/db/schema.rb +0 -23
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/features/order_spec.rb +0 -54
- data/spec/models/order_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93f715b348e2399eaa011180ec14a6243cd763df
|
4
|
+
data.tar.gz: 98dbeaa2ff0af947ca08bd4e4a65ffdd0921055d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960b5fe48bea5173276f620aaf5edf071b951ca2317e10681613d9f20859f0b48d4dfdce40f24fce362fdc1ad1f85c2928e9973b18c578143024fbdade3a67f7
|
7
|
+
data.tar.gz: 69fb060f123c9bc6f12b34c4b82269aacd83d5e6e11165ab491afc902d8289aa83c0e641b94685535af5e8b808ec30cacce433de3a7b5ae2745cf6485ef3d061
|
data/Rakefile
CHANGED
@@ -1,18 +1,7 @@
|
|
1
|
-
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
6
|
-
|
7
|
-
|
8
|
-
require 'rspec/core'
|
9
|
-
require 'rspec/core/rake_task'
|
1
|
+
require File.expand_path('../test/dummy/config/application', __FILE__)
|
10
2
|
|
3
|
+
Rails.application.load_tasks
|
11
4
|
Bundler::GemHelper.install_tasks
|
12
|
-
RSpec::Core::RakeTask.new(:spec)
|
13
|
-
|
14
|
-
task default: :spec
|
15
|
-
|
16
5
|
|
17
6
|
desc "Clean automatically generated files"
|
18
7
|
task :clean do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class RowsExtController < RowsController
|
2
|
+
|
3
|
+
def copy
|
4
|
+
set_resource resource.dup
|
5
|
+
resource.id = nil
|
6
|
+
respond_to do |format|
|
7
|
+
format.html { render :action => :new }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def multi_deletion
|
12
|
+
items = params[:multi_tick] || []
|
13
|
+
items -= ['']
|
14
|
+
items.map { |id| model_class.find_by_id(id.to_i).destroy }
|
15
|
+
redirect_to action: :index
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/app/views/rows/show.slim
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
ruby:
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
# Template for RowsController (show)
|
3
|
+
# Requires resource model_name model_symbol
|
4
|
+
# partial 'form' template
|
5
5
|
|
6
6
|
content_for(:submit_left) {
|
7
7
|
link_to t('button.back').html_safe, url_for(action: :index), class: 'button' }
|
@@ -12,6 +12,6 @@ fieldset.show class="wide mask" id=model_symbol
|
|
12
12
|
legend = t('ui.showing', model: model_name).html_safe
|
13
13
|
= render '/shared/error_explanation'
|
14
14
|
|
15
|
-
= form_for resource do |f|
|
15
|
+
= form_for resource, url: {action: :show}, method: :get do |f|
|
16
16
|
= render 'form', f: f
|
17
17
|
= render '/rows/submit'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rows_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec-rails
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: capybara
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,18 +45,13 @@ executables: []
|
|
59
45
|
extensions: []
|
60
46
|
extra_rdoc_files: []
|
61
47
|
files:
|
62
|
-
- ".rspec"
|
63
|
-
- ".travis.yml"
|
64
|
-
- ".watchr"
|
65
|
-
- Gemfile
|
66
|
-
- Gemfile.lock
|
67
48
|
- MIT-LICENSE
|
68
49
|
- README.md
|
69
50
|
- Rakefile
|
70
|
-
- SNIPPETS
|
71
51
|
- app/controllers/rows_controller.rb
|
72
52
|
- app/controllers/rows_controller/helpers.rb
|
73
53
|
- app/controllers/rows_ext_controller.rb
|
54
|
+
- app/controllers/rows_ext_controller.rb.bak
|
74
55
|
- app/views/rows/_form.slim
|
75
56
|
- app/views/rows/_list.slim
|
76
57
|
- app/views/rows/_list_footer.slim
|
@@ -91,42 +72,7 @@ files:
|
|
91
72
|
- lib/rows_controller/locales/de.yml
|
92
73
|
- lib/rows_controller/locales/en.yml
|
93
74
|
- lib/rows_controller/version.rb
|
94
|
-
- rows_controller.
|
95
|
-
- spec/controllers/orders_spec.rb
|
96
|
-
- spec/controllers/rows_ext_spec.rb
|
97
|
-
- spec/controllers/rows_spec.rb
|
98
|
-
- spec/dummy/Rakefile
|
99
|
-
- spec/dummy/app/assets/javascripts/application.js
|
100
|
-
- spec/dummy/app/controllers/application_controller.rb
|
101
|
-
- spec/dummy/app/controllers/orders_controller.rb
|
102
|
-
- spec/dummy/app/models/order.rb
|
103
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
104
|
-
- spec/dummy/app/views/orders/_form.html.erb
|
105
|
-
- spec/dummy/bin/bundle
|
106
|
-
- spec/dummy/bin/rails
|
107
|
-
- spec/dummy/bin/rake
|
108
|
-
- spec/dummy/config.ru
|
109
|
-
- spec/dummy/config/application.rb
|
110
|
-
- spec/dummy/config/boot.rb
|
111
|
-
- spec/dummy/config/database.yml
|
112
|
-
- spec/dummy/config/environment.rb
|
113
|
-
- spec/dummy/config/environments/development.rb
|
114
|
-
- spec/dummy/config/environments/production.rb
|
115
|
-
- spec/dummy/config/environments/test.rb
|
116
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
117
|
-
- spec/dummy/config/initializers/secret_token.rb
|
118
|
-
- spec/dummy/config/initializers/session_store.rb
|
119
|
-
- spec/dummy/config/routes.rb
|
120
|
-
- spec/dummy/config/secrets.yml
|
121
|
-
- spec/dummy/db/migrate/001_create_orders.rb
|
122
|
-
- spec/dummy/db/schema.rb
|
123
|
-
- spec/dummy/db/test.sqlite3
|
124
|
-
- spec/dummy/log/.keep
|
125
|
-
- spec/dummy/public/favicon.ico
|
126
|
-
- spec/dummy/script/rails
|
127
|
-
- spec/features/order_spec.rb
|
128
|
-
- spec/models/order_spec.rb
|
129
|
-
- spec/spec_helper.rb
|
75
|
+
- lib/rows_controller/version.rb.bak
|
130
76
|
homepage: http://matique.de
|
131
77
|
licenses:
|
132
78
|
- MIT
|
data/.rspec
DELETED
data/.travis.yml
DELETED
data/.watchr
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
HH = '#' * 22 unless defined?(HH)
|
2
|
-
H = '#' * 5 unless defined?(H)
|
3
|
-
|
4
|
-
def usage
|
5
|
-
puts <<-EOS
|
6
|
-
Ctrl-\\ or ctrl-4 Running all tests
|
7
|
-
Ctrl-C Exit
|
8
|
-
EOS
|
9
|
-
end
|
10
|
-
|
11
|
-
def run(cmd)
|
12
|
-
puts "#{HH} #{Time.now} #{HH}"
|
13
|
-
puts "#{H} #{cmd}"
|
14
|
-
system "/usr/bin/time --format '#{HH} Elapsed time %E' #{cmd}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def run_it(type, file)
|
18
|
-
case type
|
19
|
-
when 'test'; run %Q{ruby -I"lib:test" -rubygems #{file}}
|
20
|
-
when 'spec'; run %Q{rspec -X #{file}}
|
21
|
-
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def run_all_tests
|
26
|
-
puts "\n#{HH} Running all tests #{HH}\n"
|
27
|
-
%w{test spec}.each { |dir| run "rake #{dir} RAILS_ENV=test" if File.exists?(dir) }
|
28
|
-
end
|
29
|
-
|
30
|
-
def run_matching_files(base)
|
31
|
-
base = base.split('_').first
|
32
|
-
%w{test spec}.each { |type|
|
33
|
-
files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ }
|
34
|
-
run_it type, files.join(' ') unless files.empty?
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
%w{test spec}.each { |type|
|
39
|
-
watch("#{type}/#{type}_helper\.rb") { run_all_tests }
|
40
|
-
watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] }
|
41
|
-
}
|
42
|
-
%w{rb erb haml slim}.each { |type|
|
43
|
-
watch("app/.*/.*\.#{type}") { |m|
|
44
|
-
run_matching_files("#{m[0].split('/').at(2).split('.').first}")
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
# Ctrl-\ or ctrl-4
|
49
|
-
Signal.trap('QUIT') { run_all_tests }
|
50
|
-
# Ctrl-C
|
51
|
-
Signal.trap('INT') { abort("Interrupted\n") }
|
52
|
-
usage
|
data/Gemfile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
version = ENV["RAILS_VERSION"]
|
4
|
-
gem 'rails', version ? "~> #{version}" : '>= 4.1'
|
5
|
-
|
6
|
-
gem 'slim'
|
7
|
-
|
8
|
-
group :test do
|
9
|
-
gem 'capybara'
|
10
|
-
gem 'rspec-rails', '>= 3.1'
|
11
|
-
end
|
12
|
-
|
13
|
-
group :development, :test do
|
14
|
-
gem 'sqlite3'
|
15
|
-
gem 'watchr'
|
16
|
-
gem 'spork'
|
17
|
-
gem 'simplecov', require: false
|
18
|
-
end
|
19
|
-
|
20
|
-
gemspec
|
data/Gemfile.lock
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
rows_controller (1.1.7)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
actionmailer (4.1.6)
|
10
|
-
actionpack (= 4.1.6)
|
11
|
-
actionview (= 4.1.6)
|
12
|
-
mail (~> 2.5, >= 2.5.4)
|
13
|
-
actionpack (4.1.6)
|
14
|
-
actionview (= 4.1.6)
|
15
|
-
activesupport (= 4.1.6)
|
16
|
-
rack (~> 1.5.2)
|
17
|
-
rack-test (~> 0.6.2)
|
18
|
-
actionview (4.1.6)
|
19
|
-
activesupport (= 4.1.6)
|
20
|
-
builder (~> 3.1)
|
21
|
-
erubis (~> 2.7.0)
|
22
|
-
activemodel (4.1.6)
|
23
|
-
activesupport (= 4.1.6)
|
24
|
-
builder (~> 3.1)
|
25
|
-
activerecord (4.1.6)
|
26
|
-
activemodel (= 4.1.6)
|
27
|
-
activesupport (= 4.1.6)
|
28
|
-
arel (~> 5.0.0)
|
29
|
-
activesupport (4.1.6)
|
30
|
-
i18n (~> 0.6, >= 0.6.9)
|
31
|
-
json (~> 1.7, >= 1.7.7)
|
32
|
-
minitest (~> 5.1)
|
33
|
-
thread_safe (~> 0.1)
|
34
|
-
tzinfo (~> 1.1)
|
35
|
-
arel (5.0.1.20140414130214)
|
36
|
-
builder (3.2.2)
|
37
|
-
capybara (2.4.4)
|
38
|
-
mime-types (>= 1.16)
|
39
|
-
nokogiri (>= 1.3.3)
|
40
|
-
rack (>= 1.0.0)
|
41
|
-
rack-test (>= 0.5.4)
|
42
|
-
xpath (~> 2.0)
|
43
|
-
diff-lcs (1.2.5)
|
44
|
-
docile (1.1.5)
|
45
|
-
erubis (2.7.0)
|
46
|
-
hike (1.2.3)
|
47
|
-
i18n (0.6.11)
|
48
|
-
json (1.8.1)
|
49
|
-
mail (2.6.1)
|
50
|
-
mime-types (>= 1.16, < 3)
|
51
|
-
mime-types (2.4.1)
|
52
|
-
mini_portile (0.6.0)
|
53
|
-
minitest (5.4.2)
|
54
|
-
multi_json (1.10.1)
|
55
|
-
nokogiri (1.6.3.1)
|
56
|
-
mini_portile (= 0.6.0)
|
57
|
-
rack (1.5.2)
|
58
|
-
rack-test (0.6.2)
|
59
|
-
rack (>= 1.0)
|
60
|
-
rails (4.1.6)
|
61
|
-
actionmailer (= 4.1.6)
|
62
|
-
actionpack (= 4.1.6)
|
63
|
-
actionview (= 4.1.6)
|
64
|
-
activemodel (= 4.1.6)
|
65
|
-
activerecord (= 4.1.6)
|
66
|
-
activesupport (= 4.1.6)
|
67
|
-
bundler (>= 1.3.0, < 2.0)
|
68
|
-
railties (= 4.1.6)
|
69
|
-
sprockets-rails (~> 2.0)
|
70
|
-
railties (4.1.6)
|
71
|
-
actionpack (= 4.1.6)
|
72
|
-
activesupport (= 4.1.6)
|
73
|
-
rake (>= 0.8.7)
|
74
|
-
thor (>= 0.18.1, < 2.0)
|
75
|
-
rake (10.3.2)
|
76
|
-
rspec-core (3.1.7)
|
77
|
-
rspec-support (~> 3.1.0)
|
78
|
-
rspec-expectations (3.1.2)
|
79
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
-
rspec-support (~> 3.1.0)
|
81
|
-
rspec-mocks (3.1.3)
|
82
|
-
rspec-support (~> 3.1.0)
|
83
|
-
rspec-rails (3.1.0)
|
84
|
-
actionpack (>= 3.0)
|
85
|
-
activesupport (>= 3.0)
|
86
|
-
railties (>= 3.0)
|
87
|
-
rspec-core (~> 3.1.0)
|
88
|
-
rspec-expectations (~> 3.1.0)
|
89
|
-
rspec-mocks (~> 3.1.0)
|
90
|
-
rspec-support (~> 3.1.0)
|
91
|
-
rspec-support (3.1.2)
|
92
|
-
simplecov (0.9.1)
|
93
|
-
docile (~> 1.1.0)
|
94
|
-
multi_json (~> 1.0)
|
95
|
-
simplecov-html (~> 0.8.0)
|
96
|
-
simplecov-html (0.8.0)
|
97
|
-
slim (2.1.0)
|
98
|
-
temple (~> 0.6.9)
|
99
|
-
tilt (>= 1.3.3, < 2.1)
|
100
|
-
spork (0.9.2)
|
101
|
-
sprockets (2.12.2)
|
102
|
-
hike (~> 1.2)
|
103
|
-
multi_json (~> 1.0)
|
104
|
-
rack (~> 1.0)
|
105
|
-
tilt (~> 1.1, != 1.3.0)
|
106
|
-
sprockets-rails (2.2.0)
|
107
|
-
actionpack (>= 3.0)
|
108
|
-
activesupport (>= 3.0)
|
109
|
-
sprockets (>= 2.8, < 4.0)
|
110
|
-
sqlite3 (1.3.9)
|
111
|
-
temple (0.6.9)
|
112
|
-
thor (0.19.1)
|
113
|
-
thread_safe (0.3.4)
|
114
|
-
tilt (1.4.1)
|
115
|
-
tzinfo (1.2.2)
|
116
|
-
thread_safe (~> 0.1)
|
117
|
-
watchr (0.7)
|
118
|
-
xpath (2.0.0)
|
119
|
-
nokogiri (~> 1.3)
|
120
|
-
|
121
|
-
PLATFORMS
|
122
|
-
ruby
|
123
|
-
|
124
|
-
DEPENDENCIES
|
125
|
-
capybara
|
126
|
-
rails (>= 4.1)
|
127
|
-
rows_controller!
|
128
|
-
rspec-rails (>= 3.1)
|
129
|
-
simplecov
|
130
|
-
slim
|
131
|
-
spork
|
132
|
-
sqlite3
|
133
|
-
watchr
|
data/SNIPPETS
DELETED
data/rows_controller.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
lib = File.expand_path('../lib/', __FILE__)
|
2
|
-
$:.unshift lib unless $:.include?(lib)
|
3
|
-
|
4
|
-
require 'rows_controller/version'
|
5
|
-
|
6
|
-
# Describe your gem and declare its dependencies:
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = 'rows_controller'
|
9
|
-
s.version = Rows::VERSION
|
10
|
-
s.licenses = ['MIT']
|
11
|
-
s.platform = Gem::Platform::RUBY
|
12
|
-
s.summary = 'RowsController DRYs your controllers.'
|
13
|
-
s.description = 'YourController < RowsController ( < ApplicationController).'
|
14
|
-
s.authors = ['Dittmar Krall']
|
15
|
-
s.email = ['dittmar.krall@matique.de']
|
16
|
-
s.homepage = 'http://matique.de'
|
17
|
-
|
18
|
-
s.files = `git ls-files`.split("\n")
|
19
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
-
s.require_paths = ['lib']
|
22
|
-
|
23
|
-
s.add_development_dependency 'sqlite3', '~> 0' # for testing
|
24
|
-
s.add_development_dependency 'rspec-rails', '~> 0'
|
25
|
-
s.add_development_dependency 'capybara', '~> 0'
|
26
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe OrdersController, ':' do
|
4
|
-
Order.delete_all
|
5
|
-
Order.create :name => 'name', :qty => 123
|
6
|
-
let(:order) {Order.all.first}
|
7
|
-
|
8
|
-
%w{index new}.each do |action|
|
9
|
-
describe "#{action}" do
|
10
|
-
it "renders the '#{action}' template" do
|
11
|
-
get action.to_sym
|
12
|
-
expect(response.code).to eq('200')
|
13
|
-
expect(response).to render_template("rows/#{action}")
|
14
|
-
expect(response.body).to eq('')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
%w{edit show}.each do |action|
|
20
|
-
describe "#{action}" do
|
21
|
-
it "renders the '#{action}' template" do
|
22
|
-
get action.to_sym, :id => order.id
|
23
|
-
expect(response.code).to eq('200')
|
24
|
-
expect(response).to render_template("rows/#{action}")
|
25
|
-
expect(response.body).to eq('')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'checking resource' do
|
31
|
-
get :show, :id => order.id
|
32
|
-
expect(subject.send(:resource)).to eq(order)
|
33
|
-
expect(assigns(:order)).to eq(order)
|
34
|
-
expect(assigns(:row)).to eq(order)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'checking resources' do
|
38
|
-
get :index
|
39
|
-
expect(subject.send(:resources).to_a).to be_a_kind_of(Array)
|
40
|
-
expect(assigns(:orders).to_a).to be_a_kind_of(Array)
|
41
|
-
expect(assigns(:orders)).to eq(Order.all)
|
42
|
-
expect(assigns(:rows)).to eq(Order.all)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'checking model_class' do
|
46
|
-
get :show, :id => order.id
|
47
|
-
expect(subject.send(:model_class)).to eq(Order)
|
48
|
-
expect(subject.send(:model_name)).to eq('Order')
|
49
|
-
expect(subject.send(:model_symbol)).to eq('order')
|
50
|
-
expect(subject.send(:model_symbol_plural)).to eq('orders')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should update' do
|
54
|
-
put :update, { id: order.id, order: {name: 'name'} }
|
55
|
-
expect(response).to be_truthy
|
56
|
-
expect(response).to redirect_to(action: :edit)
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should update #2' do
|
60
|
-
put :update, { id: order.id, commit: 'OK', order: {name: 'name'} }
|
61
|
-
expect(response).to be_truthy
|
62
|
-
expect(response).to redirect_to(action: :index)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'should not update' do
|
66
|
-
put :update, { id: order.id, order: {name: 'error'} }
|
67
|
-
expect(response).to be_success
|
68
|
-
expect(response).to render_template('rows/edit')
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'should not create' do
|
72
|
-
post :create, { id: order.id, order: {name: 'error'} }
|
73
|
-
expect(response).to be_success
|
74
|
-
expect(response).to render_template('rows/new')
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
|
80
|
-
class CategoriesController < RowsController
|
81
|
-
model_class Order
|
82
|
-
end
|
83
|
-
|
84
|
-
describe CategoriesController do
|
85
|
-
it 'checking model_class' do
|
86
|
-
get :index
|
87
|
-
expect(subject.send(:model_class)).to eq(Order)
|
88
|
-
expect(subject.send(:model_name)).to eq('Order')
|
89
|
-
expect(subject.send(:model_symbol)).to eq('order')
|
90
|
-
expect(subject.send(:model_symbol_plural)).to eq('orders')
|
91
|
-
end
|
92
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe RowsController do
|
4
|
-
specify { should respond_to(:resource) }
|
5
|
-
specify { should respond_to(:resources) }
|
6
|
-
specify { should respond_to(:model_class) }
|
7
|
-
specify { should respond_to(:model_name) }
|
8
|
-
specify { should respond_to(:model_symbol) }
|
9
|
-
specify { should respond_to(:model_symbol_plural) }
|
10
|
-
specify { should respond_to(:resource_format) }
|
11
|
-
|
12
|
-
specify { should respond_to(:index) }
|
13
|
-
specify { should respond_to(:show) }
|
14
|
-
specify { should respond_to(:new) }
|
15
|
-
specify { should respond_to(:edit) }
|
16
|
-
specify { should respond_to(:create) }
|
17
|
-
specify { should respond_to(:update) }
|
18
|
-
specify { should respond_to(:destroy) }
|
19
|
-
|
20
|
-
it 'coverage resource_format' do
|
21
|
-
expect(subject.send(:resource_format, 'abc')).to eq('abc')
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
data/spec/dummy/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require_tree .
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Dummy</title>
|
5
|
-
<%#= stylesheet_link_tag "application" %>
|
6
|
-
<%= javascript_include_tag "application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<%= render '/shared/show_flash' %>
|
11
|
-
<%= yield %>
|
12
|
-
</body>
|
13
|
-
</html>
|
data/spec/dummy/bin/bundle
DELETED
data/spec/dummy/bin/rails
DELETED
data/spec/dummy/bin/rake
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
Bundler.require(*Rails.groups)
|
6
|
-
require "rows_controller"
|
7
|
-
|
8
|
-
module Dummy
|
9
|
-
class Application < Rails::Application
|
10
|
-
# Settings in config/environments/* take precedence over those specified here.
|
11
|
-
# Application configuration should go into files in config/initializers
|
12
|
-
# -- all .rb files in that directory are automatically loaded.
|
13
|
-
|
14
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
-
|
18
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
-
# config.i18n.default_locale = :de
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
data/spec/dummy/config/boot.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
development:
|
7
|
-
adapter: sqlite3
|
8
|
-
database: db/development.sqlite3
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
11
|
-
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
13
|
-
# re-generated from your development database when you run "rake".
|
14
|
-
# Do not set this db to the same as development or production.
|
15
|
-
test:
|
16
|
-
adapter: sqlite3
|
17
|
-
database: db/test.sqlite3
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
@@ -1,37 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Do not eager load code on boot.
|
10
|
-
config.eager_load = false
|
11
|
-
|
12
|
-
# Show full error reports and disable caching.
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send.
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger.
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Raise an error on page load if there are pending migrations.
|
23
|
-
config.active_record.migration_error = :page_load
|
24
|
-
|
25
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
-
# This option may cause significant delays in view rendering with a large
|
27
|
-
# number of complex assets.
|
28
|
-
config.assets.debug = true
|
29
|
-
|
30
|
-
# Adds additional error checking when serving assets at runtime.
|
31
|
-
# Checks for improperly declared sprockets dependencies.
|
32
|
-
# Raises helpful error messages.
|
33
|
-
config.assets.raise_runtime_errors = true
|
34
|
-
|
35
|
-
# Raises error for missing translations
|
36
|
-
# config.action_view.raise_on_missing_translations = true
|
37
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# Code is not reloaded between requests.
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Eager load code on boot. This eager loads most of Rails and
|
8
|
-
# your application in memory, allowing both threaded web servers
|
9
|
-
# and those relying on copy on write to perform better.
|
10
|
-
# Rake tasks automatically ignore this option for performance.
|
11
|
-
config.eager_load = true
|
12
|
-
|
13
|
-
# Full error reports are disabled and caching is turned on.
|
14
|
-
config.consider_all_requests_local = false
|
15
|
-
config.action_controller.perform_caching = true
|
16
|
-
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
-
# config.action_dispatch.rack_cache = true
|
21
|
-
|
22
|
-
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
-
config.serve_static_assets = false
|
24
|
-
|
25
|
-
# Compress JavaScripts and CSS.
|
26
|
-
config.assets.js_compressor = :uglifier
|
27
|
-
# config.assets.css_compressor = :sass
|
28
|
-
|
29
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
-
config.assets.compile = false
|
31
|
-
|
32
|
-
# Generate digests for assets URLs.
|
33
|
-
config.assets.digest = true
|
34
|
-
|
35
|
-
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
36
|
-
|
37
|
-
# Specifies the header that your server uses for sending files.
|
38
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
39
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
40
|
-
|
41
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
42
|
-
# config.force_ssl = true
|
43
|
-
|
44
|
-
# Set to :debug to see everything in the log.
|
45
|
-
config.log_level = :info
|
46
|
-
|
47
|
-
# Prepend all log lines with the following tags.
|
48
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
49
|
-
|
50
|
-
# Use a different logger for distributed setups.
|
51
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
52
|
-
|
53
|
-
# Use a different cache store in production.
|
54
|
-
# config.cache_store = :mem_cache_store
|
55
|
-
|
56
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
57
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
58
|
-
|
59
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
60
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
61
|
-
# config.action_mailer.raise_delivery_errors = false
|
62
|
-
|
63
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
64
|
-
# the I18n.default_locale when a translation cannot be found).
|
65
|
-
config.i18n.fallbacks = true
|
66
|
-
|
67
|
-
# Send deprecation notices to registered listeners.
|
68
|
-
config.active_support.deprecation = :notify
|
69
|
-
|
70
|
-
# Disable automatic flushing of the log to improve performance.
|
71
|
-
# config.autoflush_log = false
|
72
|
-
|
73
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
74
|
-
config.log_formatter = ::Logger::Formatter.new
|
75
|
-
|
76
|
-
# Do not dump schema after migrations.
|
77
|
-
config.active_record.dump_schema_after_migration = false
|
78
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
-
# just for the purpose of running a single test. If you are using a tool that
|
12
|
-
# preloads Rails for running tests, you may have to set it to true.
|
13
|
-
config.eager_load = false
|
14
|
-
|
15
|
-
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
-
config.serve_static_assets = true
|
17
|
-
config.static_cache_control = 'public, max-age=3600'
|
18
|
-
|
19
|
-
# Show full error reports and disable caching.
|
20
|
-
config.consider_all_requests_local = true
|
21
|
-
config.action_controller.perform_caching = false
|
22
|
-
|
23
|
-
# Raise exceptions instead of rendering exception templates.
|
24
|
-
config.action_dispatch.show_exceptions = false
|
25
|
-
|
26
|
-
# Disable request forgery protection in test environment.
|
27
|
-
config.action_controller.allow_forgery_protection = false
|
28
|
-
|
29
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
-
# The :test delivery method accumulates sent emails in the
|
31
|
-
# ActionMailer::Base.deliveries array.
|
32
|
-
config.action_mailer.delivery_method = :test
|
33
|
-
|
34
|
-
# Print deprecation notices to the stderr.
|
35
|
-
config.active_support.deprecation = :stderr
|
36
|
-
|
37
|
-
# Raises error for missing translations
|
38
|
-
# config.action_view.raise_on_missing_translations = true
|
39
|
-
end
|
@@ -1,4 +0,0 @@
|
|
1
|
-
# Make sure your secret_key_base is kept private
|
2
|
-
# if you're sharing your code publicly.
|
3
|
-
Dummy::Application.config.secret_token = '937a92d6932bff76ce073df95330b64d1df95bb11505bc24ebda6f103ca567a0fedf45811d459ac97b24901f0650da5280cdf82e7de21e86ebfc35586bb06f32'
|
4
|
-
Dummy::Application.config.secret_key_base = '37421d339a6f4537257761951a3849a456e4d0f3ac8eac2ae1363bef2b412de777bbf4eb5783deab111020664014e00224a81d3b018306601992593e2dfed803'
|
data/spec/dummy/config/routes.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
development:
|
2
|
-
secret_key_base: d61c1f2b3e62e0a361915489159b199d7ee5326f280f08c5351f947aaeee33a6687e5219bb995147450a7a2905d6340e290de04fecbc10663743271183b7a2d6
|
3
|
-
|
4
|
-
test:
|
5
|
-
secret_key_base: 0844f902ca7927b7b59e7944e0771b8089ac87717750395210051fcf8b1eff849b8e6a9d3a8bd2f41a07fbae0c24c8c37cf0b76d96f6ab33be0ec2b433ddca85
|
6
|
-
|
7
|
-
# Do not keep production secrets in the repository,
|
8
|
-
# instead read values from the environment.
|
9
|
-
production:
|
10
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/spec/dummy/config.ru
DELETED
data/spec/dummy/db/schema.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended that you check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(version: 1) do
|
15
|
-
|
16
|
-
create_table "orders", force: true do |t|
|
17
|
-
t.string "name"
|
18
|
-
t.string "qty"
|
19
|
-
t.datetime "created_at"
|
20
|
-
t.datetime "updated_at"
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
data/spec/dummy/db/test.sqlite3
DELETED
Binary file
|
data/spec/dummy/log/.keep
DELETED
File without changes
|
File without changes
|
data/spec/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
data/spec/features/order_spec.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Order" do
|
4
|
-
before do
|
5
|
-
Order.delete_all
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'should be created' do
|
9
|
-
visit "/orders"
|
10
|
-
expect(page).to have_content("is empty")
|
11
|
-
|
12
|
-
click_link "Create"
|
13
|
-
fill_in "Name", :with => "a name"
|
14
|
-
click_button "Create"
|
15
|
-
expect(page).to have_content("Order created.")
|
16
|
-
expect(page).to have_content("Editing Order")
|
17
|
-
|
18
|
-
expect(Order.all.first.name).to eq("a name")
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should be deleted' do
|
22
|
-
Order.create
|
23
|
-
n = Order.all.length
|
24
|
-
visit "/orders"
|
25
|
-
expect(page).to have_content("Listing Order")
|
26
|
-
|
27
|
-
click_link "Delete"
|
28
|
-
expect(page).to have_content("Order deleted.")
|
29
|
-
expect(Order.all.length).to eq((n - 1))
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'index should have check_box for multi_selection' do
|
33
|
-
Order.create :name => 'name', :qty => 123
|
34
|
-
visit "/orders"
|
35
|
-
expect(page).to have_css('table tr input[name="multi_selection[]"]')
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should be copied' do
|
39
|
-
Order.create :name => 'name', :qty => 123
|
40
|
-
order = Order.all.first
|
41
|
-
n = Order.all.length
|
42
|
-
visit "/orders/#{order.id}/copy"
|
43
|
-
|
44
|
-
expect(page).to have_content("New")
|
45
|
-
fill_in "Name", :with => "a name"
|
46
|
-
click_button "OK"
|
47
|
-
|
48
|
-
expect(Order.all.length).to eq(n + 1)
|
49
|
-
order2 = Order.find(order.id + 1)
|
50
|
-
expect(order2.name).to_not eq(order.name)
|
51
|
-
expect(order2.qty).to eq(order.qty)
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
data/spec/models/order_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
SimpleCov.start "rails" do
|
3
|
-
# add_filter '/application_controller.rb/'
|
4
|
-
end
|
5
|
-
|
6
|
-
require 'spork'
|
7
|
-
require 'bundler'
|
8
|
-
Bundler.setup :default, :development, :test
|
9
|
-
|
10
|
-
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
11
|
-
|
12
|
-
Spork.prefork do
|
13
|
-
ENV["RAILS_ENV"] ||= 'test'
|
14
|
-
# require File.expand_path("../../config/environment", __FILE__)
|
15
|
-
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
|
16
|
-
require 'rspec/rails'
|
17
|
-
|
18
|
-
RSpec.configure do |config|
|
19
|
-
config.mock_with :rspec
|
20
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
21
|
-
# config.use_transactional_fixtures = false
|
22
|
-
# increases speed; not sure why
|
23
|
-
config.use_transactional_fixtures = true
|
24
|
-
|
25
|
-
config.include(Capybara::DSL)
|
26
|
-
config.infer_spec_type_from_file_location!
|
27
|
-
ActiveSupport::Dependencies.clear
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Spork.each_run do
|
32
|
-
load "#{Rails.root}/config/routes.rb"
|
33
|
-
Dir["#{Rails.root}/app/**/*.rb"].each { |f| load f }
|
34
|
-
end
|