Upgrade to rails 4.1
This commit is contained in:
parent
6188567931
commit
6e990fed4c
|
@ -1,6 +1,6 @@
|
||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 2.0.0
|
- 2.1
|
||||||
services:
|
services:
|
||||||
- redis-server
|
- redis-server
|
||||||
env: COVERALLS=1
|
env: COVERALLS=1
|
||||||
|
|
17
Gemfile
17
Gemfile
|
@ -1,12 +1,11 @@
|
||||||
# A sample Gemfile
|
# A sample Gemfile
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
ruby "2.0.0"
|
|
||||||
|
|
||||||
gem "rails", '~> 4.0.0'
|
gem "rails", '~> 4.1'
|
||||||
|
|
||||||
|
|
||||||
gem 'sass-rails', '~> 4.0.0'
|
gem 'sass-rails', '>= 4.0' # version to avoid bundle getting confused
|
||||||
gem 'coffee-rails', '~> 4.0.0'
|
gem 'coffee-rails'
|
||||||
gem 'less-rails'
|
gem 'less-rails'
|
||||||
gem 'uglifier', '>= 1.0.3'
|
gem 'uglifier', '>= 1.0.3'
|
||||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||||
|
@ -27,12 +26,10 @@ gem 'prawn-table'
|
||||||
gem 'haml-rails'
|
gem 'haml-rails'
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'simple_form'
|
gem 'simple_form'
|
||||||
gem 'client_side_validations', git: 'git://github.com/bcardarella/client_side_validations.git', branch: '4-0-beta'
|
|
||||||
gem 'client_side_validations-simple_form', git: 'git://github.com/saveritemedical/client_side_validations-simple_form.git'
|
|
||||||
gem 'inherited_resources'
|
gem 'inherited_resources'
|
||||||
gem 'localize_input', git: "git://github.com/bennibu/localize_input.git"
|
gem 'localize_input', git: "git://github.com/bennibu/localize_input.git"
|
||||||
gem 'daemons'
|
gem 'daemons'
|
||||||
gem 'twitter-bootstrap-rails'
|
gem 'twitter-bootstrap-rails', '~> 2.2.8'
|
||||||
gem 'simple-navigation'
|
gem 'simple-navigation'
|
||||||
gem 'simple-navigation-bootstrap'
|
gem 'simple-navigation-bootstrap'
|
||||||
gem 'ransack'
|
gem 'ransack'
|
||||||
|
@ -56,6 +53,10 @@ end
|
||||||
group :development do
|
group :development do
|
||||||
gem 'sqlite3'
|
gem 'sqlite3'
|
||||||
gem 'mailcatcher'
|
gem 'mailcatcher'
|
||||||
|
|
||||||
|
# allow to use `debugger` https://github.com/conradirwin/pry-rescue
|
||||||
|
gem 'pry-rescue'
|
||||||
|
gem 'pry-stack_explorer'
|
||||||
|
|
||||||
# Better error output
|
# Better error output
|
||||||
gem 'better_errors'
|
gem 'better_errors'
|
||||||
|
@ -85,7 +86,7 @@ end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
gem 'factory_girl_rails', '~> 4.0'
|
gem 'factory_girl_rails'
|
||||||
gem 'faker'
|
gem 'faker'
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
# webkit and poltergeist don't seem to work yet
|
# webkit and poltergeist don't seem to work yet
|
||||||
|
|
173
Gemfile.lock
173
Gemfile.lock
|
@ -1,24 +1,9 @@
|
||||||
GIT
|
|
||||||
remote: git://github.com/bcardarella/client_side_validations.git
|
|
||||||
revision: 9461cb92e1dfb64895d590c6d435cdf48fcede45
|
|
||||||
branch: 4-0-beta
|
|
||||||
specs:
|
|
||||||
client_side_validations (3.2.2)
|
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/bennibu/localize_input.git
|
remote: git://github.com/bennibu/localize_input.git
|
||||||
revision: 5eb188d2525a073d09e142cf8b0b04e6ace6e7b0
|
revision: 5eb188d2525a073d09e142cf8b0b04e6ace6e7b0
|
||||||
specs:
|
specs:
|
||||||
localize_input (0.1.0)
|
localize_input (0.1.0)
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: git://github.com/saveritemedical/client_side_validations-simple_form.git
|
|
||||||
revision: b97c938be745de1134169026425aa0c990b8b072
|
|
||||||
specs:
|
|
||||||
client_side_validations-simple_form (2.1.0)
|
|
||||||
client_side_validations (~> 3.2.1)
|
|
||||||
simple_form (>= 2.1.0, < 4.0)
|
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/technoweenie/acts_as_versioned.git
|
remote: git://github.com/technoweenie/acts_as_versioned.git
|
||||||
revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b
|
revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b
|
||||||
|
@ -46,33 +31,35 @@ PATH
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (4.0.10)
|
actionmailer (4.1.8)
|
||||||
actionpack (= 4.0.10)
|
actionpack (= 4.1.8)
|
||||||
|
actionview (= 4.1.8)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
actionpack (4.0.10)
|
actionpack (4.1.8)
|
||||||
activesupport (= 4.0.10)
|
actionview (= 4.1.8)
|
||||||
builder (~> 3.1.0)
|
activesupport (= 4.1.8)
|
||||||
erubis (~> 2.7.0)
|
|
||||||
rack (~> 1.5.2)
|
rack (~> 1.5.2)
|
||||||
rack-test (~> 0.6.2)
|
rack-test (~> 0.6.2)
|
||||||
activemodel (4.0.10)
|
actionview (4.1.8)
|
||||||
activesupport (= 4.0.10)
|
activesupport (= 4.1.8)
|
||||||
builder (~> 3.1.0)
|
builder (~> 3.1)
|
||||||
activerecord (4.0.10)
|
erubis (~> 2.7.0)
|
||||||
activemodel (= 4.0.10)
|
activemodel (4.1.8)
|
||||||
activerecord-deprecated_finders (~> 1.0.2)
|
activesupport (= 4.1.8)
|
||||||
activesupport (= 4.0.10)
|
builder (~> 3.1)
|
||||||
arel (~> 4.0.0)
|
activerecord (4.1.8)
|
||||||
activerecord-deprecated_finders (1.0.3)
|
activemodel (= 4.1.8)
|
||||||
activesupport (4.0.10)
|
activesupport (= 4.1.8)
|
||||||
|
arel (~> 5.0.0)
|
||||||
|
activesupport (4.1.8)
|
||||||
i18n (~> 0.6, >= 0.6.9)
|
i18n (~> 0.6, >= 0.6.9)
|
||||||
minitest (~> 4.2)
|
json (~> 1.7, >= 1.7.7)
|
||||||
multi_json (~> 1.3)
|
minitest (~> 5.1)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
tzinfo (~> 0.3.37)
|
tzinfo (~> 1.1)
|
||||||
acts_as_tree (2.1.0)
|
acts_as_tree (2.1.0)
|
||||||
activerecord (>= 3.0.0)
|
activerecord (>= 3.0.0)
|
||||||
arel (4.0.2)
|
arel (5.0.1.20140414130214)
|
||||||
attribute_normalizer (1.2.0)
|
attribute_normalizer (1.2.0)
|
||||||
better_errors (2.0.0)
|
better_errors (2.0.0)
|
||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
|
@ -82,7 +69,7 @@ GEM
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
bootstrap-datepicker-rails (1.3.0.2)
|
bootstrap-datepicker-rails (1.3.0.2)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
builder (3.1.4)
|
builder (3.2.2)
|
||||||
bullet (4.14.0)
|
bullet (4.14.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (>= 1.6.0)
|
uniform_notifier (>= 1.6.0)
|
||||||
|
@ -110,7 +97,7 @@ GEM
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
coffee-rails (4.0.1)
|
coffee-rails (4.1.0)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
coffee-script (2.3.0)
|
coffee-script (2.3.0)
|
||||||
|
@ -119,7 +106,7 @@ GEM
|
||||||
coffee-script-source (1.8.0)
|
coffee-script-source (1.8.0)
|
||||||
colorize (0.7.3)
|
colorize (0.7.3)
|
||||||
commonjs (0.2.7)
|
commonjs (0.2.7)
|
||||||
connection_pool (2.0.0)
|
connection_pool (2.1.0)
|
||||||
content_for_in_controllers (0.0.2)
|
content_for_in_controllers (0.0.2)
|
||||||
coveralls (0.7.1)
|
coveralls (0.7.1)
|
||||||
multi_json (~> 1.3)
|
multi_json (~> 1.3)
|
||||||
|
@ -147,10 +134,10 @@ GEM
|
||||||
activesupport (>= 3.0.4)
|
activesupport (>= 3.0.4)
|
||||||
execjs (2.2.2)
|
execjs (2.2.2)
|
||||||
expression_parser (0.9.0)
|
expression_parser (0.9.0)
|
||||||
factory_girl (4.4.0)
|
factory_girl (4.5.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
factory_girl_rails (4.4.1)
|
factory_girl_rails (4.5.0)
|
||||||
factory_girl (~> 4.4.0)
|
factory_girl (~> 4.5.0)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
faker (1.4.3)
|
faker (1.4.3)
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
|
@ -167,13 +154,16 @@ GEM
|
||||||
activesupport (>= 3.2, < 5)
|
activesupport (>= 3.2, < 5)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
i18n (0.6.11)
|
i18n (0.6.11)
|
||||||
i18n-js (3.0.0.rc6)
|
i18n-js (3.0.0.rc7)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6)
|
||||||
i18n-spec (0.5.2)
|
i18n-spec (0.6.0)
|
||||||
iso
|
iso
|
||||||
inherited_resources (1.5.0)
|
inherited_resources (1.5.1)
|
||||||
|
actionpack (>= 3.2, < 4.2)
|
||||||
has_scope (~> 0.6.0.rc)
|
has_scope (~> 0.6.0.rc)
|
||||||
|
railties (>= 3.2, < 4.2)
|
||||||
responders (~> 1.0)
|
responders (~> 1.0)
|
||||||
|
interception (0.5)
|
||||||
iso (0.2.1)
|
iso (0.2.1)
|
||||||
i18n
|
i18n
|
||||||
jquery-rails (3.1.2)
|
jquery-rails (3.1.2)
|
||||||
|
@ -183,13 +173,13 @@ GEM
|
||||||
kaminari (0.16.1)
|
kaminari (0.16.1)
|
||||||
actionpack (>= 3.0.0)
|
actionpack (>= 3.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
less (2.5.1)
|
less (2.6.0)
|
||||||
commonjs (~> 0.2.7)
|
commonjs (~> 0.2.7)
|
||||||
less-rails (2.5.0)
|
less-rails (2.6.0)
|
||||||
actionpack (>= 3.1)
|
actionpack (>= 3.1)
|
||||||
less (~> 2.5.0)
|
less (~> 2.6.0)
|
||||||
libv8 (3.16.14.7)
|
libv8 (3.16.14.7)
|
||||||
mail (2.6.1)
|
mail (2.6.3)
|
||||||
mime-types (>= 1.16, < 3)
|
mime-types (>= 1.16, < 3)
|
||||||
mailcatcher (0.2.4)
|
mailcatcher (0.2.4)
|
||||||
eventmachine
|
eventmachine
|
||||||
|
@ -205,18 +195,19 @@ GEM
|
||||||
callsite (~> 0.0, >= 0.0.11)
|
callsite (~> 0.0, >= 0.0.11)
|
||||||
rack-contrib (~> 1.1)
|
rack-contrib (~> 1.1)
|
||||||
railties (>= 3.0.0, < 5.0.0)
|
railties (>= 3.0.0, < 5.0.0)
|
||||||
mime-types (2.4.2)
|
method_source (0.8.2)
|
||||||
mini_portile (0.6.0)
|
mime-types (2.4.3)
|
||||||
minitest (4.7.5)
|
mini_portile (0.6.1)
|
||||||
|
minitest (5.4.3)
|
||||||
mono_logger (1.1.0)
|
mono_logger (1.1.0)
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
mysql2 (0.3.16)
|
mysql2 (0.3.17)
|
||||||
net-scp (1.2.1)
|
net-scp (1.2.1)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (2.9.1)
|
net-ssh (2.9.1)
|
||||||
netrc (0.8.0)
|
netrc (0.8.0)
|
||||||
nokogiri (1.6.3.1)
|
nokogiri (1.6.4.1)
|
||||||
mini_portile (= 0.6.0)
|
mini_portile (~> 0.6.0)
|
||||||
pdf-core (0.4.0)
|
pdf-core (0.4.0)
|
||||||
polyamorous (1.1.0)
|
polyamorous (1.1.0)
|
||||||
activerecord (>= 3.0)
|
activerecord (>= 3.0)
|
||||||
|
@ -224,25 +215,37 @@ GEM
|
||||||
prawn (1.3.0)
|
prawn (1.3.0)
|
||||||
pdf-core (~> 0.4.0)
|
pdf-core (~> 0.4.0)
|
||||||
ttfunk (~> 1.4.0)
|
ttfunk (~> 1.4.0)
|
||||||
prawn-table (0.2.0)
|
prawn-table (0.2.1)
|
||||||
protected_attributes (1.0.8)
|
protected_attributes (1.0.8)
|
||||||
activemodel (>= 4.0.1, < 5.0)
|
activemodel (>= 4.0.1, < 5.0)
|
||||||
|
pry (0.10.1)
|
||||||
|
coderay (~> 1.1.0)
|
||||||
|
method_source (~> 0.8.1)
|
||||||
|
slop (~> 3.4)
|
||||||
|
pry-rescue (1.4.1)
|
||||||
|
interception (>= 0.5)
|
||||||
|
pry
|
||||||
|
pry-stack_explorer (0.4.9.1)
|
||||||
|
binding_of_caller (>= 0.7)
|
||||||
|
pry (>= 0.9.11)
|
||||||
quiet_assets (1.0.3)
|
quiet_assets (1.0.3)
|
||||||
railties (>= 3.1, < 5.0)
|
railties (>= 3.1, < 5.0)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
rack-contrib (1.1.0)
|
rack-contrib (1.2.0)
|
||||||
rack (>= 0.9.1)
|
rack (>= 0.9.1)
|
||||||
rack-protection (1.5.3)
|
rack-protection (1.5.3)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (4.0.10)
|
rails (4.1.8)
|
||||||
actionmailer (= 4.0.10)
|
actionmailer (= 4.1.8)
|
||||||
actionpack (= 4.0.10)
|
actionpack (= 4.1.8)
|
||||||
activerecord (= 4.0.10)
|
actionview (= 4.1.8)
|
||||||
activesupport (= 4.0.10)
|
activemodel (= 4.1.8)
|
||||||
|
activerecord (= 4.1.8)
|
||||||
|
activesupport (= 4.1.8)
|
||||||
bundler (>= 1.3.0, < 2.0)
|
bundler (>= 1.3.0, < 2.0)
|
||||||
railties (= 4.0.10)
|
railties (= 4.1.8)
|
||||||
sprockets-rails (~> 2.0)
|
sprockets-rails (~> 2.0)
|
||||||
rails-assets-listjs (0.2.0.beta.4)
|
rails-assets-listjs (0.2.0.beta.4)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
|
@ -251,13 +254,13 @@ GEM
|
||||||
railties (~> 4.0)
|
railties (~> 4.0)
|
||||||
rails-settings-cached (0.4.1)
|
rails-settings-cached (0.4.1)
|
||||||
rails (>= 4.0.0)
|
rails (>= 4.0.0)
|
||||||
railties (4.0.10)
|
railties (4.1.8)
|
||||||
actionpack (= 4.0.10)
|
actionpack (= 4.1.8)
|
||||||
activesupport (= 4.0.10)
|
activesupport (= 4.1.8)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rake (10.3.2)
|
rake (10.3.2)
|
||||||
ransack (1.4.1)
|
ransack (1.5.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activerecord (>= 3.0)
|
activerecord (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
|
@ -267,7 +270,7 @@ GEM
|
||||||
redis-namespace (1.5.1)
|
redis-namespace (1.5.1)
|
||||||
redis (~> 3.0, >= 3.0.4)
|
redis (~> 3.0, >= 3.0.4)
|
||||||
ref (1.0.5)
|
ref (1.0.5)
|
||||||
responders (1.1.1)
|
responders (1.1.2)
|
||||||
railties (>= 3.2, < 4.2)
|
railties (>= 3.2, < 4.2)
|
||||||
resque (1.25.2)
|
resque (1.25.2)
|
||||||
mono_logger (~> 1.0)
|
mono_logger (~> 1.0)
|
||||||
|
@ -283,7 +286,7 @@ GEM
|
||||||
rspec-core (~> 2.99.0)
|
rspec-core (~> 2.99.0)
|
||||||
rspec-expectations (~> 2.99.0)
|
rspec-expectations (~> 2.99.0)
|
||||||
rspec-mocks (~> 2.99.0)
|
rspec-mocks (~> 2.99.0)
|
||||||
rspec-collection_matchers (1.0.0)
|
rspec-collection_matchers (1.1.2)
|
||||||
rspec-expectations (>= 2.99.0.beta1)
|
rspec-expectations (>= 2.99.0.beta1)
|
||||||
rspec-core (2.99.2)
|
rspec-core (2.99.2)
|
||||||
rspec-expectations (2.99.2)
|
rspec-expectations (2.99.2)
|
||||||
|
@ -300,18 +303,18 @@ GEM
|
||||||
rspec-mocks (~> 2.99.0)
|
rspec-mocks (~> 2.99.0)
|
||||||
rspec-rerun (0.2.0)
|
rspec-rerun (0.2.0)
|
||||||
rspec (>= 2.11.0, < 3)
|
rspec (>= 2.11.0, < 3)
|
||||||
ruby-prof (0.15.1)
|
ruby-prof (0.15.2)
|
||||||
ruby-units (1.4.5)
|
ruby-units (1.4.5)
|
||||||
rubyzip (1.1.6)
|
rubyzip (1.1.6)
|
||||||
sass (3.2.19)
|
sass (3.2.19)
|
||||||
sass-rails (4.0.3)
|
sass-rails (4.0.4)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
sass (~> 3.2.0)
|
sass (~> 3.2.2)
|
||||||
sprockets (~> 2.8, <= 2.11.0)
|
sprockets (~> 2.8, < 2.12)
|
||||||
sprockets-rails (~> 2.0)
|
sprockets-rails (~> 2.0)
|
||||||
select2-rails (3.5.9.1)
|
select2-rails (3.5.9.1)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
selenium-webdriver (2.43.0)
|
selenium-webdriver (2.44.0)
|
||||||
childprocess (~> 0.5)
|
childprocess (~> 0.5)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rubyzip (~> 1.0)
|
rubyzip (~> 1.0)
|
||||||
|
@ -336,7 +339,8 @@ GEM
|
||||||
skinny (0.2.3)
|
skinny (0.2.3)
|
||||||
eventmachine (~> 1.0.0)
|
eventmachine (~> 1.0.0)
|
||||||
thin (~> 1.5.0)
|
thin (~> 1.5.0)
|
||||||
sprockets (2.11.0)
|
slop (3.6.0)
|
||||||
|
sprockets (2.11.3)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
|
@ -345,7 +349,7 @@ GEM
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
sprockets (>= 2.8, < 4.0)
|
sprockets (>= 2.8, < 4.0)
|
||||||
sqlite3 (1.3.9)
|
sqlite3 (1.3.10)
|
||||||
sqlite3-ruby (1.3.3)
|
sqlite3-ruby (1.3.3)
|
||||||
sqlite3 (>= 1.3.3)
|
sqlite3 (>= 1.3.3)
|
||||||
sshkit (1.5.1)
|
sshkit (1.5.1)
|
||||||
|
@ -371,7 +375,8 @@ GEM
|
||||||
execjs
|
execjs
|
||||||
rails (>= 3.1)
|
rails (>= 3.1)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
tzinfo (0.3.41)
|
tzinfo (1.2.2)
|
||||||
|
thread_safe (~> 0.1)
|
||||||
uglifier (2.5.3)
|
uglifier (2.5.3)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
|
@ -379,7 +384,7 @@ GEM
|
||||||
vegas (0.1.11)
|
vegas (0.1.11)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
websocket (1.2.1)
|
websocket (1.2.1)
|
||||||
whenever (0.9.3)
|
whenever (0.9.4)
|
||||||
chronic (>= 0.6.3)
|
chronic (>= 0.6.3)
|
||||||
wikicloth (0.8.1)
|
wikicloth (0.8.1)
|
||||||
builder
|
builder
|
||||||
|
@ -404,16 +409,14 @@ DEPENDENCIES
|
||||||
capistrano-rails
|
capistrano-rails
|
||||||
capistrano-rvm
|
capistrano-rvm
|
||||||
capybara
|
capybara
|
||||||
client_side_validations!
|
coffee-rails
|
||||||
client_side_validations-simple_form!
|
|
||||||
coffee-rails (~> 4.0.0)
|
|
||||||
connection_pool
|
connection_pool
|
||||||
coveralls
|
coveralls
|
||||||
daemons
|
daemons
|
||||||
database_cleaner
|
database_cleaner
|
||||||
date_time_attribute
|
date_time_attribute
|
||||||
exception_notification
|
exception_notification
|
||||||
factory_girl_rails (~> 4.0)
|
factory_girl_rails
|
||||||
faker
|
faker
|
||||||
foodsoft_messages!
|
foodsoft_messages!
|
||||||
foodsoft_wiki!
|
foodsoft_wiki!
|
||||||
|
@ -431,8 +434,10 @@ DEPENDENCIES
|
||||||
prawn
|
prawn
|
||||||
prawn-table
|
prawn-table
|
||||||
protected_attributes
|
protected_attributes
|
||||||
|
pry-rescue
|
||||||
|
pry-stack_explorer
|
||||||
quiet_assets
|
quiet_assets
|
||||||
rails (~> 4.0.0)
|
rails (~> 4.1)
|
||||||
rails-assets-listjs (= 0.2.0.beta.4)
|
rails-assets-listjs (= 0.2.0.beta.4)
|
||||||
rails-i18n
|
rails-i18n
|
||||||
rails-settings-cached
|
rails-settings-cached
|
||||||
|
@ -443,7 +448,7 @@ DEPENDENCIES
|
||||||
rspec-rerun
|
rspec-rerun
|
||||||
ruby-prof
|
ruby-prof
|
||||||
ruby-units
|
ruby-units
|
||||||
sass-rails (~> 4.0.0)
|
sass-rails (>= 4.0)
|
||||||
select2-rails
|
select2-rails
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
simple-navigation
|
simple-navigation
|
||||||
|
@ -453,6 +458,6 @@ DEPENDENCIES
|
||||||
sqlite3
|
sqlite3
|
||||||
therubyracer
|
therubyracer
|
||||||
thin
|
thin
|
||||||
twitter-bootstrap-rails
|
twitter-bootstrap-rails (~> 2.2.8)
|
||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
whenever
|
whenever
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
//= require list.unlist
|
//= require list.unlist
|
||||||
//= require list.delay
|
//= require list.delay
|
||||||
//= require list.reset
|
//= require list.reset
|
||||||
//= require rails.validations
|
|
||||||
//= require rails.validations.simple_form
|
|
||||||
//= require i18n
|
//= require i18n
|
||||||
//= require i18n/translations
|
//= require i18n/translations
|
||||||
//= require_self
|
//= require_self
|
||||||
|
|
|
@ -174,8 +174,8 @@ module ApplicationHelper
|
||||||
def bootstrap_flash_patched
|
def bootstrap_flash_patched
|
||||||
flash_messages = []
|
flash_messages = []
|
||||||
flash.each do |type, message|
|
flash.each do |type, message|
|
||||||
type = :success if type == :notice
|
type = :success if type == 'notice'
|
||||||
type = :error if type == :alert
|
type = :error if type == 'alert'
|
||||||
text = content_tag(:div,
|
text = content_tag(:div,
|
||||||
content_tag(:button, I18n.t('ui.marks.close').html_safe, :class => "close", "data-dismiss" => "alert") +
|
content_tag(:button, I18n.t('ui.marks.close').html_safe, :class => "close", "data-dismiss" => "alert") +
|
||||||
message, :class => "alert fade in alert-#{type}")
|
message, :class => "alert fade in alert-#{type}")
|
||||||
|
|
|
@ -12,7 +12,7 @@ module DeliveriesHelper
|
||||||
|
|
||||||
def articles_for_select2(articles, except = [], &block)
|
def articles_for_select2(articles, except = [], &block)
|
||||||
articles = articles.reorder('articles.name ASC')
|
articles = articles.reorder('articles.name ASC')
|
||||||
articles.reject! {|a| not except.index(a.id).nil? } if except
|
articles = articles.reject {|a| not except.index(a.id).nil? } if except
|
||||||
block_given? or block = Proc.new {|a| "#{a.name} (#{number_to_currency a.price}/#{a.unit})" }
|
block_given? or block = Proc.new {|a| "#{a.name} (#{number_to_currency a.price}/#{a.unit})" }
|
||||||
articles.map do |a|
|
articles.map do |a|
|
||||||
{:id => a.id, :text => block.call(a)}
|
{:id => a.id, :text => block.call(a)}
|
||||||
|
|
|
@ -47,7 +47,6 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
after_save do
|
after_save do
|
||||||
return if settings_attributes.nil?
|
|
||||||
settings_attributes.each do |key, value|
|
settings_attributes.each do |key, value|
|
||||||
value.each do |k, v|
|
value.each do |k, v|
|
||||||
case v
|
case v
|
||||||
|
@ -58,7 +57,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.settings.merge!(key, value)
|
self.settings.merge!(key, value)
|
||||||
end
|
end if settings_attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
# sorted by display name
|
# sorted by display name
|
||||||
|
|
|
@ -2,10 +2,6 @@ require File.expand_path('../boot', __FILE__)
|
||||||
|
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
|
|
||||||
# need to include this before requiring some other gems
|
|
||||||
# http://stackoverflow.com/questions/20361428
|
|
||||||
I18n.enforce_available_locales = true
|
|
||||||
|
|
||||||
# Require the gems listed in Gemfile, including any gems
|
# Require the gems listed in Gemfile, including any gems
|
||||||
# you've limited to :test, :development, or :production.
|
# you've limited to :test, :development, or :production.
|
||||||
Bundler.require(:default, Rails.env)
|
Bundler.require(:default, Rails.env)
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
# ClientSideValidations Initializer
|
|
||||||
|
|
||||||
# DISABLED FOR RAILS4
|
|
||||||
# Uncomment to disable uniqueness validator, possible security issue
|
|
||||||
# Disabled because of possible security issue and because of bug
|
|
||||||
# https://github.com/bcardarella/client_side_validations/pull/532
|
|
||||||
#ClientSideValidations::Config.disabled_validators = [:uniqueness]
|
|
||||||
|
|
||||||
# Uncomment to validate number format with current I18n locale
|
|
||||||
# Foodsoft is currently using localize_input which is activated on certain
|
|
||||||
# fields only, meaning we can't globally turn this on. The non-i18n number
|
|
||||||
# format is still supported - so for now keep false.
|
|
||||||
# ClientSideValidations::Config.number_format_with_locale = true
|
|
||||||
|
|
||||||
# Uncomment the following block if you want each input field to have the validation messages attached.
|
|
||||||
# ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
|
|
||||||
# unless html_tag =~ /^<label/
|
|
||||||
# %{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
|
|
||||||
# else
|
|
||||||
# %{<div class="field_with_errors">#{html_tag}</div>}.html_safe
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
|
@ -7,11 +7,16 @@ class Float
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# allow +to_s+ on bigdecimal without argument too
|
||||||
if defined? BigDecimal
|
if defined? BigDecimal
|
||||||
class BigDecimal
|
class BigDecimal
|
||||||
alias :foodsoft_to_s :to_s
|
alias :foodsoft_to_s :to_s
|
||||||
def to_s(format = DEFAULT_STRING_FORMAT)
|
def to_s(*args)
|
||||||
foodsoft_to_s(format).gsub /(\.0*|(\.[0-9]+?)0+)$/, '\2'
|
if args.present?
|
||||||
|
foodsoft_to_s(*args)
|
||||||
|
else
|
||||||
|
foodsoft_to_s(*args).gsub /(\.0*|(\.[0-9]+?)0+)$/, '\2'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
# Use this setup block to configure all options available in SimpleForm.
|
# Use this setup block to configure all options available in SimpleForm.
|
||||||
require 'simple_form'
|
|
||||||
SimpleForm.setup do |config|
|
SimpleForm.setup do |config|
|
||||||
# Wrappers are used by the form builder to generate a
|
# Wrappers are used by the form builder to generate a
|
||||||
# complete input. You can remove any component from the
|
# complete input. You can remove any component from the
|
||||||
# wrapper, change the order or even add your own to the
|
# wrapper, change the order or even add your own to the
|
||||||
# stack. The options given below are used to wrap the
|
# stack. The options given below are used to wrap the
|
||||||
# whole input.
|
# whole input.
|
||||||
config.wrappers :default, :class => :input,
|
config.wrappers :default, class: :input,
|
||||||
:hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
|
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
||||||
## Extensions enabled by default
|
## Extensions enabled by default
|
||||||
# Any of these extensions can be disabled for a
|
# Any of these extensions can be disabled for a
|
||||||
# given input by passing: `f.input EXTENSION_NAME => false`.
|
# given input by passing: `f.input EXTENSION_NAME => false`.
|
||||||
|
@ -19,7 +18,7 @@ SimpleForm.setup do |config|
|
||||||
b.use :html5
|
b.use :html5
|
||||||
|
|
||||||
# Calculates placeholders automatically from I18n
|
# Calculates placeholders automatically from I18n
|
||||||
# You can also pass a string as f.input :placeholder => "Placeholder"
|
# You can also pass a string as f.input placeholder: "Placeholder"
|
||||||
b.use :placeholder
|
b.use :placeholder
|
||||||
|
|
||||||
## Optional extensions
|
## Optional extensions
|
||||||
|
@ -42,8 +41,8 @@ SimpleForm.setup do |config|
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
b.use :label_input
|
b.use :label_input
|
||||||
b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
|
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
||||||
b.use :error, :wrap_with => { :tag => :span, :class => :error }
|
b.use :error, wrap_with: { tag: :span, class: :error }
|
||||||
end
|
end
|
||||||
|
|
||||||
# The default wrapper to be used by the FormBuilder.
|
# The default wrapper to be used by the FormBuilder.
|
||||||
|
@ -51,8 +50,8 @@ SimpleForm.setup do |config|
|
||||||
|
|
||||||
# Define the way to render check boxes / radio buttons with labels.
|
# Define the way to render check boxes / radio buttons with labels.
|
||||||
# Defaults to :nested for bootstrap config.
|
# Defaults to :nested for bootstrap config.
|
||||||
# :inline => input + label
|
# inline: input + label
|
||||||
# :nested => label > input
|
# nested: label > input
|
||||||
config.boolean_style = :nested
|
config.boolean_style = :nested
|
||||||
|
|
||||||
# Default class for buttons
|
# Default class for buttons
|
||||||
|
@ -107,8 +106,11 @@ SimpleForm.setup do |config|
|
||||||
# Whether attributes are required by default (or not). Default is true.
|
# Whether attributes are required by default (or not). Default is true.
|
||||||
# config.required_by_default = true
|
# config.required_by_default = true
|
||||||
|
|
||||||
# Tell browsers whether to use default HTML5 validations (novalidate option).
|
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
||||||
# Default is enabled.
|
# These validations are enabled in SimpleForm's internal config but disabled by default
|
||||||
|
# in this configuration, which is recommended due to some quirks from different browsers.
|
||||||
|
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
||||||
|
# change this configuration to true.
|
||||||
config.browser_validations = true
|
config.browser_validations = true
|
||||||
|
|
||||||
# Collection of methods to detect if a file type was given.
|
# Collection of methods to detect if a file type was given.
|
||||||
|
@ -121,7 +123,7 @@ SimpleForm.setup do |config|
|
||||||
|
|
||||||
# Custom wrappers for input types. This should be a hash containing an input
|
# Custom wrappers for input types. This should be a hash containing an input
|
||||||
# type as key and the wrapper that will be used for all inputs with specified type.
|
# type as key and the wrapper that will be used for all inputs with specified type.
|
||||||
# config.wrapper_mappings = { :string => :prepend }
|
# config.wrapper_mappings = { string: :prepend }
|
||||||
|
|
||||||
# Default priority for time_zone inputs.
|
# Default priority for time_zone inputs.
|
||||||
# config.time_zone_priority = nil
|
# config.time_zone_priority = nil
|
||||||
|
@ -129,9 +131,6 @@ SimpleForm.setup do |config|
|
||||||
# Default priority for country inputs.
|
# Default priority for country inputs.
|
||||||
# config.country_priority = nil
|
# config.country_priority = nil
|
||||||
|
|
||||||
# Default size for text inputs.
|
|
||||||
# config.default_input_size = 50
|
|
||||||
|
|
||||||
# When false, do not use translations for labels.
|
# When false, do not use translations for labels.
|
||||||
# config.translate_labels = true
|
# config.translate_labels = true
|
||||||
|
|
||||||
|
@ -140,4 +139,7 @@ SimpleForm.setup do |config|
|
||||||
|
|
||||||
# Cache SimpleForm inputs discovery
|
# Cache SimpleForm inputs discovery
|
||||||
# config.cache_discovery = !Rails.env.development?
|
# config.cache_discovery = !Rails.env.development?
|
||||||
|
|
||||||
|
# Default class for inputs
|
||||||
|
# config.input_class = nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,53 +1,53 @@
|
||||||
# Use this setup block to configure all options available in SimpleForm.
|
# Use this setup block to configure all options available in SimpleForm.
|
||||||
SimpleForm.setup do |config|
|
SimpleForm.setup do |config|
|
||||||
config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
|
config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
|
||||||
b.use :html5
|
b.use :html5
|
||||||
b.use :placeholder
|
b.use :placeholder
|
||||||
b.use :label
|
b.use :label
|
||||||
b.wrapper :tag => 'div', :class => 'controls' do |ba|
|
b.wrapper tag: 'div', class: 'controls' do |ba|
|
||||||
ba.use :input
|
ba.use :input
|
||||||
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
||||||
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
|
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
|
config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
||||||
b.use :html5
|
b.use :html5
|
||||||
b.use :placeholder
|
b.use :placeholder
|
||||||
b.use :label
|
b.use :label
|
||||||
b.wrapper :tag => 'div', :class => 'controls' do |input|
|
b.wrapper tag: 'div', class: 'controls' do |input|
|
||||||
input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend|
|
input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
|
||||||
prepend.use :input
|
prepend.use :input
|
||||||
end
|
end
|
||||||
input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
|
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
||||||
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
|
config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
||||||
b.use :html5
|
b.use :html5
|
||||||
b.use :placeholder
|
b.use :placeholder
|
||||||
b.use :label
|
b.use :label
|
||||||
b.wrapper :tag => 'div', :class => 'controls' do |input|
|
b.wrapper tag: 'div', class: 'controls' do |input|
|
||||||
input.wrapper :tag => 'div', :class => 'input-append' do |append|
|
input.wrapper tag: 'div', class: 'input-append' do |append|
|
||||||
append.use :input
|
append.use :input
|
||||||
end
|
end
|
||||||
input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
|
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
||||||
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Do not use the label in tables
|
# Do not use the label in tables
|
||||||
config.wrappers :intable, :tag => 'div', :class => 'control-group control-group-intable', :error_class => 'error' do |b|
|
config.wrappers :intable, tag: 'div', class: 'control-group control-group-intable', error_class: 'error' do |b|
|
||||||
b.use :html5
|
b.use :html5
|
||||||
b.use :placeholder
|
b.use :placeholder
|
||||||
b.wrapper :tag => 'div', :class => 'controls controls-intable' do |ba|
|
b.wrapper tag: 'div', class: 'controls controls-intable' do |ba|
|
||||||
ba.use :input
|
ba.use :input
|
||||||
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
||||||
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
|
ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
||||||
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
||||||
# to learn about the different styles for forms and inputs,
|
# to learn about the different styles for forms and inputs,
|
||||||
|
|
|
@ -237,7 +237,7 @@ class FoodsoftConfig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# allow engines to easily add to this
|
# allow engines to easily add to this
|
||||||
engines = Rails::Engine::Railties.engines.select { |e| e.respond_to?(:default_foodsoft_config) }
|
engines = Rails::Engine.subclasses.map(&:instance).select { |e| e.respond_to?(:default_foodsoft_config) }
|
||||||
engines.each { |e| e.default_foodsoft_config(cfg) }
|
engines.each { |e| e.default_foodsoft_config(cfg) }
|
||||||
cfg
|
cfg
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class MessagesController < ApplicationController
|
||||||
|
|
||||||
# Renders the "inbox" action.
|
# Renders the "inbox" action.
|
||||||
def index
|
def index
|
||||||
@messages = Message.public.page(params[:page]).per(@per_page).order('created_at DESC').includes(:sender)
|
@messages = Message.pub.page(params[:page]).per(@per_page).order('created_at DESC').includes(:sender)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Creates a new message object.
|
# Creates a new message object.
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Message < ActiveRecord::Base
|
||||||
|
|
||||||
scope :pending, -> { where(:email_state => 0) }
|
scope :pending, -> { where(:email_state => 0) }
|
||||||
scope :sent, -> { where(:email_state => 1) }
|
scope :sent, -> { where(:email_state => 1) }
|
||||||
scope :public, -> { where(:private => false) }
|
scope :pub, -> { where(:private => false) }
|
||||||
|
|
||||||
# Values for the email_state attribute: :none, :pending, :sent, :failed
|
# Values for the email_state attribute: :none, :pending, :sent, :failed
|
||||||
EMAIL_STATE = {
|
EMAIL_STATE = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/ insert_after 'erb[silent]:contains("<dashboard_middle_mark>")'
|
/ insert_after 'erb[silent]:contains("<dashboard_middle_mark>")'
|
||||||
- if FoodsoftMessages.enabled?
|
- if FoodsoftMessages.enabled?
|
||||||
- unless Message.public.empty?
|
- unless Message.pub.empty?
|
||||||
%section#messages
|
%section#messages
|
||||||
%h2= t '.messages.title'
|
%h2= t '.messages.title'
|
||||||
= render 'messages/messages', messages: Message.public.order('created_at DESC').limit(5), pagination: false
|
= render 'messages/messages', messages: Message.pub.order('created_at DESC').limit(5), pagination: false
|
||||||
%p= link_to t('.messages.view_all'), messages_path
|
%p= link_to t('.messages.view_all'), messages_path
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
- if pagination
|
- if pagination
|
||||||
- if Message.public.count > 20
|
- if Message.pub.count > 20
|
||||||
= items_per_page
|
= items_per_page
|
||||||
= pagination_links_remote messages
|
= pagination_links_remote messages
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Generic token verifier with foodcoop scope
|
||||||
|
# @todo use +Rails.application.message_verifier+ when possible
|
||||||
class TokenVerifier < ActiveSupport::MessageVerifier
|
class TokenVerifier < ActiveSupport::MessageVerifier
|
||||||
|
|
||||||
def initialize(prefix)
|
def initialize(prefix)
|
||||||
|
|
|
@ -2,15 +2,24 @@ require 'factory_girl'
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
|
|
||||||
factory :article do
|
factory :_article do
|
||||||
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " ##{n}" }
|
|
||||||
unit { Faker::Unit.unit }
|
unit { Faker::Unit.unit }
|
||||||
price { rand(2600) / 100 }
|
price { rand(2600) / 100 }
|
||||||
tax { [6, 21].sample }
|
tax { [6, 21].sample }
|
||||||
deposit { rand(10) < 8 ? 0 : [0.0, 0.80, 1.20, 12.00].sample }
|
deposit { rand(10) < 8 ? 0 : [0.0, 0.80, 1.20, 12.00].sample }
|
||||||
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }
|
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }
|
||||||
supplier { create :supplier }
|
|
||||||
article_category { create :article_category }
|
factory :article do
|
||||||
|
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " ##{n}" }
|
||||||
|
supplier { create :supplier }
|
||||||
|
article_category { create :article_category }
|
||||||
|
end
|
||||||
|
|
||||||
|
factory :shared_article, class: SharedArticle do
|
||||||
|
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " s##{n}" }
|
||||||
|
order_number { Faker::Lorem.characters(rand(1..12)) }
|
||||||
|
supplier { create :shared_supplier }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :article_category do
|
factory :article_category do
|
||||||
|
|
|
@ -7,7 +7,7 @@ FactoryGirl.define do
|
||||||
supplier { create :supplier, article_count: (article_count.nil? ? true : article_count) }
|
supplier { create :supplier, article_count: (article_count.nil? ? true : article_count) }
|
||||||
article_ids { supplier.articles.map(&:id) unless supplier.nil? }
|
article_ids { supplier.articles.map(&:id) unless supplier.nil? }
|
||||||
|
|
||||||
ignore do
|
transient do
|
||||||
article_count true
|
article_count true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ FactoryGirl.define do
|
||||||
phone { Faker::PhoneNumber.phone_number }
|
phone { Faker::PhoneNumber.phone_number }
|
||||||
address { Faker::Address.street_address }
|
address { Faker::Address.street_address }
|
||||||
|
|
||||||
ignore do
|
transient do
|
||||||
article_count 0
|
article_count 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ FactoryGirl.define do
|
||||||
article_count = rand(1..99) if article_count == true
|
article_count = rand(1..99) if article_count == true
|
||||||
create_list :article, article_count, supplier: supplier
|
create_list :article, article_count, supplier: supplier
|
||||||
end
|
end
|
||||||
|
|
||||||
|
factory :shared_supplier, class: SharedSupplier
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -59,9 +59,8 @@ describe Article do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'connected to a shared database', :type => :feature do
|
describe 'connected to a shared database', :type => :feature do
|
||||||
let(:shared_supplier) { create(:supplier) }
|
let(:shared_article) { create :shared_article }
|
||||||
let(:shared_article) { create :article, supplier: shared_supplier, order_number: Faker::Lorem.characters(rand(1..12)) }
|
let(:supplier) { create :supplier, shared_supplier_id: shared_article.supplier_id }
|
||||||
let(:supplier) { create :supplier, shared_supplier_id: shared_supplier.id }
|
|
||||||
let(:article) { create :article, supplier: supplier, order_number: shared_article.order_number }
|
let(:article) { create :article, supplier: supplier, order_number: shared_article.order_number }
|
||||||
|
|
||||||
it 'can be found in the shared database' do
|
it 'can be found in the shared database' do
|
||||||
|
@ -85,7 +84,7 @@ describe Article do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not need to synchronise an imported article' do
|
it 'does not need to synchronise an imported article' do
|
||||||
article = SharedArticle.find(shared_article.id).build_new_article(supplier)
|
article = shared_article.build_new_article(supplier)
|
||||||
expect(article.shared_article_changed?).to be_falsey
|
expect(article.shared_article_changed?).to be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ describe Article do
|
||||||
shared_article.unit = '1kg'
|
shared_article.unit = '1kg'
|
||||||
shared_article.unit_quantity = 1
|
shared_article.unit_quantity = 1
|
||||||
shared_article.save!
|
shared_article.save!
|
||||||
article = SharedArticle.find(shared_article.id).build_new_article(supplier)
|
article = shared_article.build_new_article(supplier)
|
||||||
article.article_category = create :article_category
|
article.article_category = create :article_category
|
||||||
article.unit = '200g'
|
article.unit = '200g'
|
||||||
article.shared_updated_on -= 1 # to make update do something
|
article.shared_updated_on -= 1 # to make update do something
|
||||||
|
|
|
@ -1,29 +1,16 @@
|
||||||
# http://stackoverflow.com/questions/8774227
|
|
||||||
# http://blog.plataformatec.com.br/2011/12/three-tips-to-improve-the-performance-of-your-test-suite
|
|
||||||
class ActiveRecord::Base
|
|
||||||
mattr_accessor :shared_connection
|
|
||||||
@@shared_connection = nil
|
|
||||||
|
|
||||||
def self.connection
|
|
||||||
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# Forces all threads to share the same connection. This works on
|
|
||||||
# Capybara because it starts the web server in a thread.
|
|
||||||
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
|
||||||
|
|
||||||
ActiveSupport.on_load(:after_initialize) do
|
ActiveSupport.on_load(:after_initialize) do
|
||||||
# We simulate the shared database by pointing to our own database.
|
# We simulate the shared database by pointing to our own database.
|
||||||
# This allows running tests without additional database setup.
|
# This allows running tests without additional database setup.
|
||||||
# But take care when designing tests using the shared database.
|
# But take care when designing tests using the shared database.
|
||||||
SharedSupplier.establish_connection Rails.env
|
SharedSupplier.establish_connection Rails.env.to_sym
|
||||||
SharedArticle.establish_connection Rails.env
|
SharedArticle.establish_connection Rails.env.to_sym
|
||||||
# hack for different structure of shared database
|
# hack for different structure of shared database
|
||||||
SharedArticle.class_eval do
|
SharedArticle.class_eval do
|
||||||
|
belongs_to :supplier, class_name: 'SharedSupplier'
|
||||||
alias_attribute :number, :order_number
|
alias_attribute :number, :order_number
|
||||||
alias_attribute :updated_on, :updated_at
|
alias_attribute :updated_on, :updated_at
|
||||||
def category
|
def category
|
||||||
ArticleCategory.find(article_category_id).name
|
ArticleCategory.where(id: article_category_id).first
|
||||||
end
|
end
|
||||||
def self.find_by_number(n)
|
def self.find_by_number(n)
|
||||||
find_by_order_number(n)
|
find_by_order_number(n)
|
||||||
|
|
Loading…
Reference in New Issue