Sync with latest simply_stored
This commit is contained in:
@@ -20,7 +20,6 @@ group :assets do
|
|||||||
gem 'pickadate-rails'
|
gem 'pickadate-rails'
|
||||||
end
|
end
|
||||||
|
|
||||||
gem 'couch_potato' , github: 'bterkuile/couch_potato'
|
|
||||||
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'
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
@@ -42,6 +41,7 @@ end
|
|||||||
group :test do
|
group :test do
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_girl_rails'
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
|
gem 'poltergeist'
|
||||||
gem 'rspec-its'
|
gem 'rspec-its'
|
||||||
gem 'launchy'
|
gem 'launchy'
|
||||||
end
|
end
|
||||||
|
|||||||
+20
-16
@@ -1,12 +1,3 @@
|
|||||||
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
|
||||||
@@ -22,7 +13,7 @@ GIT
|
|||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/bterkuile/simply_stored.git
|
remote: git://github.com/bterkuile/simply_stored.git
|
||||||
revision: 8e8288b20ab64d62f1da7516731cd936f81b1f19
|
revision: 05cb3a06a9d4a3588efd4491db42fac84276befb
|
||||||
specs:
|
specs:
|
||||||
simply_stored (1.0.0)
|
simply_stored (1.0.0)
|
||||||
activesupport
|
activesupport
|
||||||
@@ -100,6 +91,7 @@ GEM
|
|||||||
xpath (~> 2.0)
|
xpath (~> 2.0)
|
||||||
climate_control (0.0.3)
|
climate_control (0.0.3)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
|
cliver (0.3.2)
|
||||||
cocaine (0.5.7)
|
cocaine (0.5.7)
|
||||||
climate_control (>= 0.0.3, < 1.0)
|
climate_control (>= 0.0.3, < 1.0)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
@@ -107,6 +99,10 @@ GEM
|
|||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.9.1.1)
|
coffee-script-source (1.9.1.1)
|
||||||
|
couch_potato (1.4.0)
|
||||||
|
activemodel
|
||||||
|
couchrest (~> 1.2.0)
|
||||||
|
json (~> 1.6)
|
||||||
couchrest (1.2.1)
|
couchrest (1.2.1)
|
||||||
mime-types (>= 1.15)
|
mime-types (>= 1.15)
|
||||||
multi_json (~> 1.7, ~> 1.0)
|
multi_json (~> 1.7, ~> 1.0)
|
||||||
@@ -168,6 +164,11 @@ GEM
|
|||||||
mime-types
|
mime-types
|
||||||
pickadate-rails (3.5.6.0)
|
pickadate-rails (3.5.6.0)
|
||||||
railties (>= 3.1.0)
|
railties (>= 3.1.0)
|
||||||
|
poltergeist (1.6.0)
|
||||||
|
capybara (~> 2.1)
|
||||||
|
cliver (~> 0.3.1)
|
||||||
|
multi_json (~> 1.0)
|
||||||
|
websocket-driver (>= 0.2.0)
|
||||||
pry (0.10.1)
|
pry (0.10.1)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.8.1)
|
method_source (~> 0.8.1)
|
||||||
@@ -208,18 +209,18 @@ GEM
|
|||||||
http-cookie (>= 1.0.2, < 2.0)
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
mime-types (>= 1.16, < 3.0)
|
mime-types (>= 1.16, < 3.0)
|
||||||
netrc (~> 0.7)
|
netrc (~> 0.7)
|
||||||
rspec-core (3.3.1)
|
rspec-core (3.3.2)
|
||||||
rspec-support (~> 3.3.0)
|
rspec-support (~> 3.3.0)
|
||||||
rspec-expectations (3.3.0)
|
rspec-expectations (3.3.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.3.0)
|
rspec-support (~> 3.3.0)
|
||||||
rspec-its (1.2.0)
|
rspec-its (1.2.0)
|
||||||
rspec-core (>= 3.0.0)
|
rspec-core (>= 3.0.0)
|
||||||
rspec-expectations (>= 3.0.0)
|
rspec-expectations (>= 3.0.0)
|
||||||
rspec-mocks (3.3.1)
|
rspec-mocks (3.3.2)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.3.0)
|
rspec-support (~> 3.3.0)
|
||||||
rspec-rails (3.3.2)
|
rspec-rails (3.3.3)
|
||||||
actionpack (>= 3.0, < 4.3)
|
actionpack (>= 3.0, < 4.3)
|
||||||
activesupport (>= 3.0, < 4.3)
|
activesupport (>= 3.0, < 4.3)
|
||||||
railties (>= 3.0, < 4.3)
|
railties (>= 3.0, < 4.3)
|
||||||
@@ -259,7 +260,7 @@ GEM
|
|||||||
thor (0.19.1)
|
thor (0.19.1)
|
||||||
thread_safe (0.3.5)
|
thread_safe (0.3.5)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
tinymce-rails (4.1.6)
|
tinymce-rails (4.2.1)
|
||||||
railties (>= 3.1.1)
|
railties (>= 3.1.1)
|
||||||
tzinfo (1.2.2)
|
tzinfo (1.2.2)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
@@ -268,6 +269,9 @@ GEM
|
|||||||
unf_ext (0.0.7.1)
|
unf_ext (0.0.7.1)
|
||||||
warden (1.2.3)
|
warden (1.2.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
websocket-driver (0.6.2)
|
||||||
|
websocket-extensions (>= 0.1.0)
|
||||||
|
websocket-extensions (0.1.2)
|
||||||
xpath (2.0.0)
|
xpath (2.0.0)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
|
|
||||||
@@ -281,7 +285,6 @@ DEPENDENCIES
|
|||||||
capybara
|
capybara
|
||||||
cmtool!
|
cmtool!
|
||||||
coffee-script
|
coffee-script
|
||||||
couch_potato!
|
|
||||||
devise
|
devise
|
||||||
devise_simply_stored!
|
devise_simply_stored!
|
||||||
email_validator
|
email_validator
|
||||||
@@ -293,6 +296,7 @@ DEPENDENCIES
|
|||||||
orm_adapter!
|
orm_adapter!
|
||||||
paperclip (>= 3.4, != 4.3.0)
|
paperclip (>= 3.4, != 4.3.0)
|
||||||
pickadate-rails
|
pickadate-rails
|
||||||
|
poltergeist
|
||||||
pry-rails
|
pry-rails
|
||||||
rails (~> 4.2.3)
|
rails (~> 4.2.3)
|
||||||
rspec-its
|
rspec-its
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ module Cmtool
|
|||||||
|
|
||||||
# Add extra helper method since cmtool layouts may be used outside the cmtool scope
|
# Add extra helper method since cmtool layouts may be used outside the cmtool scope
|
||||||
def cmtool_user
|
def cmtool_user
|
||||||
controller.send :cmtool_user
|
controller.respond_to?(:cmtool_user) ? controller.send(:cmtool_user) :nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_td(obj)
|
def edit_td(obj)
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
feature 'Page preview' do
|
||||||
|
context 'with logged in user' do
|
||||||
|
background do
|
||||||
|
create_user 'test@example.com'
|
||||||
|
login_as 'test@example.com'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with pages' do
|
||||||
|
background do
|
||||||
|
@page = create :page, name: 'nl1', locale: 'nl'
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'see both languages', js: true do
|
||||||
|
visit "/cmtool/pages/#{@page.id}"
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
+4
-1
@@ -5,6 +5,7 @@ require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
require 'factory_girl'
|
require 'factory_girl'
|
||||||
require 'capybara/rspec'
|
require 'capybara/rspec'
|
||||||
|
require 'capybara/poltergeist'
|
||||||
|
|
||||||
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
@@ -14,7 +15,8 @@ Dir[File.join(ENGINE_RAILS_ROOT, "spec/factories/**/*.rb")].each {|f| require f
|
|||||||
|
|
||||||
I18n.locale = :en
|
I18n.locale = :en
|
||||||
Devise.stretches = 1
|
Devise.stretches = 1
|
||||||
#Capybara.default_driver = :selenium
|
Capybara.javascript_driver = :poltergeist
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.mock_with :rspec
|
config.mock_with :rspec
|
||||||
config.include FactoryGirl::Syntax::Methods
|
config.include FactoryGirl::Syntax::Methods
|
||||||
@@ -23,6 +25,7 @@ RSpec.configure do |config|
|
|||||||
config.include Cmtool::Engine.routes.url_helpers
|
config.include Cmtool::Engine.routes.url_helpers
|
||||||
config.include Devise::TestHelpers, type: :controller
|
config.include Devise::TestHelpers, type: :controller
|
||||||
config.include FeatureHelpers, type: :feature
|
config.include FeatureHelpers, type: :feature
|
||||||
|
config.include JsHelpers, type: :feature
|
||||||
#config.use_transactional_fixtures = true
|
#config.use_transactional_fixtures = true
|
||||||
config.infer_base_class_for_anonymous_controllers = true
|
config.infer_base_class_for_anonymous_controllers = true
|
||||||
config.render_views = true
|
config.render_views = true
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ module FeatureHelpers
|
|||||||
|
|
||||||
def login_as(email)
|
def login_as(email)
|
||||||
visit "/users/sign_in"
|
visit "/users/sign_in"
|
||||||
fill_in "user_email", with: email
|
find("#user_email").set email
|
||||||
fill_in "user_password", with: "secret"
|
find("#user_password").set "secret"
|
||||||
submit_form
|
submit_form
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
module JsHelpers
|
||||||
|
def js_set_date(selector, value = '')
|
||||||
|
js_set_field selector, value
|
||||||
|
end
|
||||||
|
|
||||||
|
def js_set_field(selector, value = '')
|
||||||
|
find selector
|
||||||
|
page.execute_script("$('#{selector}').val('#{value}')")
|
||||||
|
end
|
||||||
|
|
||||||
|
def toggle_optional_input_for(attr)
|
||||||
|
js_click ".optional-input-activator-container.#{attr} .optional-input-activator-toggle"
|
||||||
|
end
|
||||||
|
|
||||||
|
def toggle_optional_text_field_for(attr)
|
||||||
|
js_click ".optional-text-field-activator-container.#{attr} .optional-input-activator-toggle"
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_optional_value(attr, value='')
|
||||||
|
selector = ".optional-attribute-container.#{attr} input"
|
||||||
|
find selector
|
||||||
|
js_set_field selector, value
|
||||||
|
end
|
||||||
|
|
||||||
|
# Activate the boolean checkbox
|
||||||
|
def toggle_optional_boolean_activator_for(attr)
|
||||||
|
js_click ".optional-attribute-container.optional-boolean.#{attr} .optional-boolean-activator-toggle"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check the boolean checkbox
|
||||||
|
def toggle_optional_boolean_for(attr)
|
||||||
|
selector = ".optional-attribute-container.optional-boolean.#{attr} .optional-boolean-toggle"
|
||||||
|
js_click selector
|
||||||
|
end
|
||||||
|
|
||||||
|
# Trigger a click event through javascript. Use this to avoid waiting for
|
||||||
|
# javascript events issues
|
||||||
|
def js_click(selector)
|
||||||
|
find(selector) # wait for the page to contain the selector
|
||||||
|
page.execute_script("$('#{selector}').click()")
|
||||||
|
|
||||||
|
# wait for triggered ajax requests to be finished
|
||||||
|
steps = 0
|
||||||
|
while page.evaluate_script('$.active').to_i > 0 and steps < 25
|
||||||
|
sleep 0.1
|
||||||
|
steps += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def expect_path_bo_be(path)
|
||||||
|
steps = 0
|
||||||
|
while page.current_path != path and steps < 15
|
||||||
|
sleep 0.1
|
||||||
|
steps += 1
|
||||||
|
end
|
||||||
|
expect( page.current_path ).to eq path
|
||||||
|
end
|
||||||
|
|
||||||
|
# Wait for the database to have finished the update stuff, then reload
|
||||||
|
# the models. Threading might give inconsistent data
|
||||||
|
def reload_model(*models)
|
||||||
|
models.each &:reload
|
||||||
|
end
|
||||||
|
alias_method :reload_models, :reload_model
|
||||||
|
end
|
||||||
|
|
||||||
Reference in New Issue
Block a user