Switch to official couch_potato version
This commit is contained in:
@@ -53,7 +53,7 @@ end
|
|||||||
# gem 'couchbase-docstore'
|
# gem 'couchbase-docstore'
|
||||||
# gem 'couchbase-structures', github: 'bterkuile/couchbase-structures'
|
# gem 'couchbase-structures', github: 'bterkuile/couchbase-structures'
|
||||||
|
|
||||||
gem 'couch_potato' , github: 'bterkuile/couch_potato'
|
gem 'couch_potato', '~> 1.4.0' #, github: 'bterkuile/couch_potato'
|
||||||
#gem 'simply_stored', path: './../components/simply_stored' #, github: 'bterkuile/simply_stored'
|
#gem 'simply_stored', path: './../components/simply_stored' #, github: 'bterkuile/simply_stored'
|
||||||
gem 'simply_stored', github: 'bterkuile/simply_stored'
|
gem 'simply_stored', github: 'bterkuile/simply_stored'
|
||||||
#gem 'orm_adapter', github: 'bterkuile/orm_adapter'
|
#gem 'orm_adapter', github: 'bterkuile/orm_adapter'
|
||||||
@@ -120,8 +120,9 @@ end
|
|||||||
group :test do
|
group :test do
|
||||||
#gem 'capybara-webkit' #, '~>0.14.2' # version 1.1.0 does not yet compile in mavericks
|
#gem 'capybara-webkit' #, '~>0.14.2' # version 1.1.0 does not yet compile in mavericks
|
||||||
#gem 'selenium-webdriver', '~> 2.45.0.dev3'
|
#gem 'selenium-webdriver', '~> 2.45.0.dev3'
|
||||||
|
gem 'selenium-webdriver'
|
||||||
#gem 'poltergeist'
|
#gem 'poltergeist'
|
||||||
gem 'capybara-webkit'
|
#gem 'capybara-webkit'
|
||||||
gem 'capybara-screenshot'
|
gem 'capybara-screenshot'
|
||||||
gem 'turnip'
|
gem 'turnip'
|
||||||
gem 'rspec-its'
|
gem 'rspec-its'
|
||||||
|
|||||||
+37
-27
@@ -10,15 +10,6 @@ GIT
|
|||||||
slim-rails
|
slim-rails
|
||||||
tinymce-rails
|
tinymce-rails
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: git://github.com/bterkuile/couch_potato.git
|
|
||||||
revision: 8929326ee855e964a441a8ede941b52c0ee88a16
|
|
||||||
specs:
|
|
||||||
couch_potato (0.7.1)
|
|
||||||
activemodel
|
|
||||||
couchrest (>= 1.0.1)
|
|
||||||
json (~> 1.6)
|
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/bterkuile/devise_simply_stored.git
|
remote: git://github.com/bterkuile/devise_simply_stored.git
|
||||||
revision: 86f93782c607958e7f99a6fdbae5566e17047273
|
revision: 86f93782c607958e7f99a6fdbae5566e17047273
|
||||||
@@ -28,7 +19,7 @@ GIT
|
|||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/bterkuile/simply_stored.git
|
remote: git://github.com/bterkuile/simply_stored.git
|
||||||
revision: 652caf8c2cfe4f828477f8b76d0cd201851cd53d
|
revision: 4f3d144096a7deb457a9e6b92c3ced0f4a9eeff0
|
||||||
specs:
|
specs:
|
||||||
simply_stored (1.0.0)
|
simply_stored (1.0.0)
|
||||||
activesupport
|
activesupport
|
||||||
@@ -134,11 +125,10 @@ GEM
|
|||||||
capybara (>= 1.0, < 3)
|
capybara (>= 1.0, < 3)
|
||||||
colored
|
colored
|
||||||
launchy
|
launchy
|
||||||
capybara-webkit (1.6.0)
|
|
||||||
capybara (>= 2.3.0, < 2.5.0)
|
|
||||||
json
|
|
||||||
celluloid (0.16.0)
|
celluloid (0.16.0)
|
||||||
timers (~> 4.0.0)
|
timers (~> 4.0.0)
|
||||||
|
childprocess (0.5.6)
|
||||||
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
climate_control (0.0.3)
|
climate_control (0.0.3)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
cocaine (0.5.7)
|
cocaine (0.5.7)
|
||||||
@@ -154,10 +144,14 @@ GEM
|
|||||||
colored (1.2)
|
colored (1.2)
|
||||||
colorize (0.7.7)
|
colorize (0.7.7)
|
||||||
cookiejar (0.3.2)
|
cookiejar (0.3.2)
|
||||||
couchrest (1.2.0)
|
couch_potato (1.4.0)
|
||||||
mime-types (~> 1.15)
|
activemodel
|
||||||
multi_json (~> 1.0)
|
couchrest (~> 1.2.0)
|
||||||
rest-client (~> 1.6.1)
|
json (~> 1.6)
|
||||||
|
couchrest (1.2.1)
|
||||||
|
mime-types (>= 1.15)
|
||||||
|
multi_json (~> 1.7, ~> 1.0)
|
||||||
|
rest-client (~> 1.8.0)
|
||||||
crack (0.4.2)
|
crack (0.4.2)
|
||||||
safe_yaml (~> 1.0.0)
|
safe_yaml (~> 1.0.0)
|
||||||
debug_inspector (0.0.2)
|
debug_inspector (0.0.2)
|
||||||
@@ -171,6 +165,8 @@ GEM
|
|||||||
devise-i18n (0.11.4)
|
devise-i18n (0.11.4)
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
docile (1.1.5)
|
docile (1.1.5)
|
||||||
|
domain_name (0.5.24)
|
||||||
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
dotenv (1.0.2)
|
dotenv (1.0.2)
|
||||||
em-http-request (1.1.2)
|
em-http-request (1.1.2)
|
||||||
addressable (>= 2.3.4)
|
addressable (>= 2.3.4)
|
||||||
@@ -227,6 +223,7 @@ GEM
|
|||||||
faye-websocket (0.9.2)
|
faye-websocket (0.9.2)
|
||||||
eventmachine (>= 0.12.0)
|
eventmachine (>= 0.12.0)
|
||||||
websocket-driver (>= 0.5.1)
|
websocket-driver (>= 0.5.1)
|
||||||
|
ffi (1.9.10)
|
||||||
font-awesome-rails (4.3.0.0)
|
font-awesome-rails (4.3.0.0)
|
||||||
railties (>= 3.2, < 5.0)
|
railties (>= 3.2, < 5.0)
|
||||||
foreman (0.77.0)
|
foreman (0.77.0)
|
||||||
@@ -246,6 +243,8 @@ GEM
|
|||||||
hashie (3.4.0)
|
hashie (3.4.0)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
hitimes (1.2.2)
|
hitimes (1.2.2)
|
||||||
|
http-cookie (1.0.2)
|
||||||
|
domain_name (~> 0.5)
|
||||||
http_parser.rb (0.6.0)
|
http_parser.rb (0.6.0)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
iso_country_codes (0.6.1)
|
iso_country_codes (0.6.1)
|
||||||
@@ -258,7 +257,7 @@ GEM
|
|||||||
js-routes (1.0.0)
|
js-routes (1.0.0)
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
json (1.8.2)
|
json (1.8.3)
|
||||||
jwt (1.3.0)
|
jwt (1.3.0)
|
||||||
kaminari (0.16.3)
|
kaminari (0.16.3)
|
||||||
actionpack (>= 3.0.0)
|
actionpack (>= 3.0.0)
|
||||||
@@ -272,17 +271,18 @@ GEM
|
|||||||
mail (2.6.3)
|
mail (2.6.3)
|
||||||
mime-types (>= 1.16, < 3)
|
mime-types (>= 1.16, < 3)
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
mime-types (1.25.1)
|
mime-types (2.6.1)
|
||||||
mini_magick (4.1.0)
|
mini_magick (4.1.0)
|
||||||
mini_portile (0.6.2)
|
mini_portile (0.6.2)
|
||||||
minitest (5.5.1)
|
minitest (5.7.0)
|
||||||
multi_json (1.11.0)
|
multi_json (1.11.2)
|
||||||
multi_xml (0.5.5)
|
multi_xml (0.5.5)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
naught (1.0.0)
|
naught (1.0.0)
|
||||||
net-scp (1.2.1)
|
net-scp (1.2.1)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (2.9.2)
|
net-ssh (2.9.2)
|
||||||
|
netrc (0.10.3)
|
||||||
nokogiri (1.6.6.2)
|
nokogiri (1.6.6.2)
|
||||||
mini_portile (~> 0.6.0)
|
mini_portile (~> 0.6.0)
|
||||||
oauth2 (1.0.0)
|
oauth2 (1.0.0)
|
||||||
@@ -351,12 +351,12 @@ GEM
|
|||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rake (10.4.2)
|
rake (10.4.2)
|
||||||
rdoc (4.2.0)
|
|
||||||
responders (2.1.0)
|
responders (2.1.0)
|
||||||
railties (>= 4.2.0, < 5)
|
railties (>= 4.2.0, < 5)
|
||||||
rest-client (1.6.8)
|
rest-client (1.8.0)
|
||||||
mime-types (~> 1.16)
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
rdoc (>= 2.4.2)
|
mime-types (>= 1.16, < 3.0)
|
||||||
|
netrc (~> 0.7)
|
||||||
rqrcode (0.4.2)
|
rqrcode (0.4.2)
|
||||||
rspec (3.2.0)
|
rspec (3.2.0)
|
||||||
rspec-core (~> 3.2.0)
|
rspec-core (~> 3.2.0)
|
||||||
@@ -383,6 +383,7 @@ GEM
|
|||||||
rspec-support (~> 3.2.0)
|
rspec-support (~> 3.2.0)
|
||||||
rspec-support (3.2.2)
|
rspec-support (3.2.2)
|
||||||
ruby-progressbar (1.7.1)
|
ruby-progressbar (1.7.1)
|
||||||
|
rubyzip (1.1.7)
|
||||||
safe_yaml (1.0.4)
|
safe_yaml (1.0.4)
|
||||||
sass (3.4.13)
|
sass (3.4.13)
|
||||||
sass-rails (5.0.1)
|
sass-rails (5.0.1)
|
||||||
@@ -391,6 +392,11 @@ GEM
|
|||||||
sprockets (>= 2.8, < 4.0)
|
sprockets (>= 2.8, < 4.0)
|
||||||
sprockets-rails (>= 2.0, < 4.0)
|
sprockets-rails (>= 2.0, < 4.0)
|
||||||
tilt (~> 1.1)
|
tilt (~> 1.1)
|
||||||
|
selenium-webdriver (2.46.2)
|
||||||
|
childprocess (~> 0.5)
|
||||||
|
multi_json (~> 1.0)
|
||||||
|
rubyzip (~> 1.0)
|
||||||
|
websocket (~> 1.0)
|
||||||
simplecov (0.9.2)
|
simplecov (0.9.2)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
@@ -442,6 +448,9 @@ GEM
|
|||||||
uglifier (2.7.1)
|
uglifier (2.7.1)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
|
unf (0.1.4)
|
||||||
|
unf_ext
|
||||||
|
unf_ext (0.0.7.1)
|
||||||
warden (1.2.3)
|
warden (1.2.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
web-console (2.0.0)
|
web-console (2.0.0)
|
||||||
@@ -452,6 +461,7 @@ GEM
|
|||||||
webmock (1.20.4)
|
webmock (1.20.4)
|
||||||
addressable (>= 2.3.6)
|
addressable (>= 2.3.6)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
|
websocket (1.2.2)
|
||||||
websocket-driver (0.5.3)
|
websocket-driver (0.5.3)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.2)
|
websocket-extensions (0.1.2)
|
||||||
@@ -475,10 +485,9 @@ DEPENDENCIES
|
|||||||
capistrano-rvm
|
capistrano-rvm
|
||||||
capistrano3-puma
|
capistrano3-puma
|
||||||
capybara-screenshot
|
capybara-screenshot
|
||||||
capybara-webkit
|
|
||||||
cmtool!
|
cmtool!
|
||||||
coffee-rails
|
coffee-rails
|
||||||
couch_potato!
|
couch_potato (~> 1.4.0)
|
||||||
devise
|
devise
|
||||||
devise-i18n
|
devise-i18n
|
||||||
devise_simply_stored!
|
devise_simply_stored!
|
||||||
@@ -517,6 +526,7 @@ DEPENDENCIES
|
|||||||
rspec-its
|
rspec-its
|
||||||
rspec-rails
|
rspec-rails
|
||||||
sass-rails (~> 5.0.0)
|
sass-rails (~> 5.0.0)
|
||||||
|
selenium-webdriver
|
||||||
simplecov
|
simplecov
|
||||||
simply_stored!
|
simply_stored!
|
||||||
slim-rails
|
slim-rails
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ class Section
|
|||||||
has_many :section_elements
|
has_many :section_elements
|
||||||
has_many :section_areas
|
has_many :section_areas
|
||||||
|
|
||||||
attr_protected :supplier_id
|
|
||||||
|
|
||||||
validates :title, presence: true
|
validates :title, presence: true
|
||||||
validates :supplier_id, presence: true
|
validates :supplier_id, presence: true
|
||||||
|
|
||||||
|
|||||||
@@ -66,13 +66,18 @@ class Supplier
|
|||||||
|
|
||||||
def reset_order_counters_with_spec(spec)
|
def reset_order_counters_with_spec(spec)
|
||||||
# taken from the couch_potato source since we want a model/custom mix here (hmmmm, something that should be fixed in the couchbase version)
|
# taken from the couch_potato source since we want a model/custom mix here (hmmmm, something that should be fixed in the couchbase version)
|
||||||
results = CouchPotato::View::ViewQuery.new(
|
view_spec = {spec.view_name => { map: spec.map_function, reduce: spec.reduce_function} }
|
||||||
|
list_spec = spec.list_name.nil? ? nil : {spec.list_name => spec.list_function}
|
||||||
|
lib_spec = nil # do not yet know meaning of this param
|
||||||
|
query_view = CouchPotato::View::ViewQuery.new(
|
||||||
database.couchrest_database,
|
database.couchrest_database,
|
||||||
spec.design_document,
|
spec.design_document,
|
||||||
{spec.view_name => { map: spec.map_function, reduce: spec.reduce_function} },
|
view_spec,
|
||||||
({spec.list_name => spec.list_function} unless spec.list_name.nil?),
|
list_spec,
|
||||||
|
lib_spec,
|
||||||
spec.language
|
spec.language
|
||||||
).query_view!(spec.view_parameters)
|
)
|
||||||
|
results = query_view.query_view!(spec.view_parameters)
|
||||||
Array.wrap(results['rows']).each do |result|
|
Array.wrap(results['rows']).each do |result|
|
||||||
supplier_id, state = result['key']
|
supplier_id, state = result['key']
|
||||||
case state
|
case state
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ step "the supplier main board list total should be updated" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
step "the supplier placed orders counter should be reduced" do
|
step "the supplier placed orders counter should be reduced" do
|
||||||
sleep 0.5
|
sleep 0.8
|
||||||
find('.supplier-orders-placed-count-number').text.should == "10"
|
find('.supplier-orders-placed-count-number').text.should == "10"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ describe :section do
|
|||||||
@section = build :section, path: [[10, 30], [20,30], [20,40], [10, 40]]
|
@section = build :section, path: [[10, 30], [20,30], [20,40], [10, 40]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "creates without problem" do
|
||||||
|
expect{ @section.save }.not_to raise_error
|
||||||
|
end
|
||||||
|
|
||||||
describe :path do
|
describe :path do
|
||||||
describe :width do
|
describe :width do
|
||||||
it "should have 20 width when initialized" do
|
it "should have 20 width when initialized" do
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Supplier::Counters do
|
||||||
|
describe '.reset_counters!' do
|
||||||
|
it 'sets the counters to the right values for all suppliers' do
|
||||||
|
supplier1 = create :supplier
|
||||||
|
supplier2 = create :supplier
|
||||||
|
create_list :order, 2, :placed, supplier: supplier1
|
||||||
|
create_list :order, 7, :active, supplier: supplier1
|
||||||
|
create_list :order, 3, :placed, supplier: supplier2
|
||||||
|
Supplier.reset_counters!
|
||||||
|
supplier1.orders_placed_count.should == 2
|
||||||
|
supplier1.orders_in_process_count.should == 7
|
||||||
|
supplier2.orders_placed_count.should == 3
|
||||||
|
end
|
||||||
|
|
||||||
|
# it 'cleans counter values if orders are no longer available', broken: defined?($cb) do
|
||||||
|
# old_connection = Qwaiter::Counter.connection
|
||||||
|
# # this spec should run on the couchbase database
|
||||||
|
# Qwaiter::Counter.connection = $cb
|
||||||
|
# supplier = create :supplier
|
||||||
|
# Qwaiter::Counter.set "supplier_counter:#{supplier.id}:orders_placed", 9
|
||||||
|
# supplier.orders_placed_count.should == 9
|
||||||
|
# Supplier.reset_counters!
|
||||||
|
# sleep 1
|
||||||
|
# supplier.orders_placed_count.should == 0
|
||||||
|
# Qwaiter::Counter.connection = old_connection
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
it 'sets the counters to the right values for one supplier' do
|
||||||
|
supplier = create :supplier
|
||||||
|
create_list :order, 5, :placed, supplier: supplier
|
||||||
|
create_list :order, 9, :active, supplier: supplier
|
||||||
|
supplier.reset_counters!
|
||||||
|
supplier.orders_placed_count.should == 5
|
||||||
|
supplier.orders_in_process_count.should == 9
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -3,41 +3,19 @@ require 'spec_helper'
|
|||||||
describe Supplier do
|
describe Supplier do
|
||||||
let(:supplier){ build :supplier }
|
let(:supplier){ build :supplier }
|
||||||
|
|
||||||
describe '.reset_counters!' do
|
describe '#add_section_on_create through create' do
|
||||||
it 'sets the counters to the right values' do
|
it 'calls add_section_on_create only for create' do
|
||||||
supplier1 = create :supplier
|
supplier = build :supplier
|
||||||
supplier2 = create :supplier
|
expect( supplier ).to receive(:add_section_on_create).once
|
||||||
create_list :order, 2, :placed, supplier: supplier1
|
supplier.save
|
||||||
create_list :order, 7, :active, supplier: supplier1
|
supplier.name = "OtherSupplierName7"
|
||||||
create_list :order, 3, :placed, supplier: supplier2
|
expect( supplier ).not_to receive(:add_section_on_create)
|
||||||
Supplier.reset_counters!
|
supplier.save
|
||||||
supplier1.orders_placed_count.should == 2
|
|
||||||
supplier1.orders_in_process_count.should == 7
|
|
||||||
supplier2.orders_placed_count.should == 3
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# it 'cleans counter values if orders are no longer available', broken: defined?($cb) do
|
it "creates a default section" do
|
||||||
# old_connection = Qwaiter::Counter.connection
|
|
||||||
# # this spec should run on the couchbase database
|
|
||||||
# Qwaiter::Counter.connection = $cb
|
|
||||||
# supplier = create :supplier
|
|
||||||
# Qwaiter::Counter.set "supplier_counter:#{supplier.id}:orders_placed", 9
|
|
||||||
# supplier.orders_placed_count.should == 9
|
|
||||||
# Supplier.reset_counters!
|
|
||||||
# sleep 1
|
|
||||||
# supplier.orders_placed_count.should == 0
|
|
||||||
# Qwaiter::Counter.connection = old_connection
|
|
||||||
# end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#reset_counters!' do
|
|
||||||
it 'sets the counters to the right values' do
|
|
||||||
supplier = create :supplier
|
supplier = create :supplier
|
||||||
create_list :order, 5, :placed, supplier: supplier
|
supplier.sections.size.should be 1
|
||||||
create_list :order, 9, :active, supplier: supplier
|
|
||||||
supplier.reset_counters!
|
|
||||||
supplier.orders_placed_count.should == 5
|
|
||||||
supplier.orders_in_process_count.should == 9
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -20,9 +20,9 @@ Dir.glob("spec/acceptance_steps/**/*steps.rb") { |f| load f, true }
|
|||||||
|
|
||||||
I18n.locale =I18n.default_locale
|
I18n.locale =I18n.default_locale
|
||||||
Devise.stretches = 1
|
Devise.stretches = 1
|
||||||
Capybara.javascript_driver = :webkit
|
#Capybara.javascript_driver = :webkit
|
||||||
#Capybara.javascript_driver = :poltergeist
|
#Capybara.javascript_driver = :poltergeist
|
||||||
#Capybara.javascript_driver = :selenium
|
Capybara.javascript_driver = :selenium
|
||||||
Capybara.default_wait_time = 3 # ember needs more time than the default of 2
|
Capybara.default_wait_time = 3 # ember needs more time than the default of 2
|
||||||
Capybara::Screenshot.webkit_options = { width: 1024, height: 768 }
|
Capybara::Screenshot.webkit_options = { width: 1024, height: 768 }
|
||||||
WebMock.disable_net_connect!(allow_localhost: true)
|
WebMock.disable_net_connect!(allow_localhost: true)
|
||||||
|
|||||||
Reference in New Issue
Block a user