Merge remote-tracking branch 'origin/master' into rails_3_1
Conflicts: Gemfile Gemfile.lock app/cells/locomotive/menu_cell.rb app/helpers/admin/content_types_helper.rb app/models/content_instance.rb app/models/page.rb app/views/admin/shared/menu/_contents.html.haml config/initializers/locomotive.rb config/locales/admin_ui.de.yml config/locales/admin_ui.en.yml config/locales/admin_ui.es.yml config/locales/admin_ui.fr.yml config/locales/admin_ui.it.yml config/locales/admin_ui.nl.yml config/locales/admin_ui.no.yml config/locales/admin_ui.pt-BR.yml config/locales/admin_ui.ru.yml lib/generators/locomotive/install/templates/locomotive.rb lib/locomotive/configuration.rb locomotive_cms.gemspec spec/models/locomotive/account_spec.rb
This commit is contained in:
commit
840609cbce
6
Gemfile
6
Gemfile
@ -13,8 +13,8 @@ gem 'mongo', '~> 1.5.2'
|
||||
gem 'bson_ext', '~> 1.5.2'
|
||||
gem 'mongoid', '~> 2.4.0'
|
||||
gem 'locomotive_mongoid_acts_as_tree', '~> 0.1.5.8'
|
||||
gem 'custom_fields', :path => '../gems/custom_fields' # DEV
|
||||
# gem 'custom_fields', :git => 'git://github.com/locomotivecms/custom_fields.git', :branch => 'experimental'
|
||||
# gem 'custom_fields', :path => '../gems/custom_fields' # DEV
|
||||
gem 'custom_fields', :git => 'git://github.com/locomotivecms/custom_fields.git', :ref => '472101ade7b4815ec977ee121442cfe28f4db285'
|
||||
gem 'kaminari'
|
||||
|
||||
gem 'haml', '~> 3.1.3'
|
||||
@ -44,7 +44,6 @@ gem 'dragonfly', '~> 0.9.8'
|
||||
gem 'rack-cache', '~> 1.1', :require => 'rack/cache'
|
||||
gem 'mimetype-fu', '~> 0.1.2'
|
||||
gem 'rubyzip'
|
||||
|
||||
gem 'actionmailer-with-request', '~> 0.3.0', :require => 'actionmailer_with_request'
|
||||
gem 'httparty', '~> 0.8.1'
|
||||
gem 'delayed_job_mongoid', '~> 1.0.8'
|
||||
@ -69,6 +68,7 @@ group :test do
|
||||
gem 'xpath', '~> 0.1.4'
|
||||
gem 'capybara'
|
||||
gem 'database_cleaner'
|
||||
gem 'shoulda-matchers'
|
||||
|
||||
gem 'launchy'
|
||||
gem 'mocha', '0.9.12' # :git => 'git://github.com/floehopper/mocha.git'
|
||||
|
52
Gemfile.lock
52
Gemfile.lock
@ -1,23 +1,13 @@
|
||||
PATH
|
||||
remote: ../gems/aloha-rails
|
||||
specs:
|
||||
locomotive-aloha-rails (0.20.1)
|
||||
actionpack (~> 3.1.3)
|
||||
|
||||
PATH
|
||||
remote: ../gems/custom_fields
|
||||
GIT
|
||||
remote: git://github.com/locomotivecms/custom_fields.git
|
||||
revision: 472101ade7b4815ec977ee121442cfe28f4db285
|
||||
ref: 472101ade7b4815ec977ee121442cfe28f4db285
|
||||
specs:
|
||||
custom_fields (2.0.0.rc1)
|
||||
activesupport (~> 3.1.3)
|
||||
carrierwave-mongoid (~> 0.1.3)
|
||||
mongoid (~> 2.4.0)
|
||||
|
||||
PATH
|
||||
remote: ../gems/tinymce-rails
|
||||
specs:
|
||||
locomotive-tinymce-rails (3.4.7)
|
||||
actionpack (~> 3.1.3)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
@ -103,12 +93,12 @@ GEM
|
||||
gherkin (~> 2.7.1)
|
||||
json (>= 1.4.6)
|
||||
term-ansicolor (>= 1.0.6)
|
||||
cucumber-rails (1.2.0)
|
||||
capybara (>= 1.1.1)
|
||||
cucumber (>= 1.1.1)
|
||||
cucumber-rails (1.2.1)
|
||||
capybara (>= 1.1.2)
|
||||
cucumber (>= 1.1.3)
|
||||
nokogiri (>= 1.5.0)
|
||||
database_cleaner (0.7.0)
|
||||
delayed_job (3.0.0)
|
||||
database_cleaner (0.7.1)
|
||||
delayed_job (3.0.1)
|
||||
activesupport (~> 3.0)
|
||||
delayed_job_mongoid (1.0.8)
|
||||
delayed_job (~> 3.0.0)
|
||||
@ -123,7 +113,7 @@ GEM
|
||||
ejs (1.0.0)
|
||||
erubis (2.7.0)
|
||||
excon (0.7.12)
|
||||
execjs (1.2.13)
|
||||
execjs (1.3.0)
|
||||
multi_json (~> 1.0)
|
||||
factory_girl (2.2.0)
|
||||
activesupport
|
||||
@ -147,11 +137,11 @@ GEM
|
||||
formtastic (2.0.2)
|
||||
rails (~> 3.0)
|
||||
fssm (0.2.8.1)
|
||||
gherkin (2.7.3)
|
||||
gherkin (2.7.4)
|
||||
json (>= 1.4.6)
|
||||
growl-glue (1.0.7)
|
||||
haml (3.1.4)
|
||||
highline (1.6.9)
|
||||
highline (1.6.11)
|
||||
hike (1.2.1)
|
||||
httparty (0.8.1)
|
||||
multi_json
|
||||
@ -160,7 +150,7 @@ GEM
|
||||
jquery-rails (1.0.19)
|
||||
railties (~> 3.0)
|
||||
thor (~> 0.14)
|
||||
json (1.6.4)
|
||||
json (1.6.5)
|
||||
kaminari (0.13.0)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
@ -168,6 +158,10 @@ GEM
|
||||
kgio (2.7.2)
|
||||
launchy (2.0.5)
|
||||
addressable (~> 2.2.6)
|
||||
locomotive-aloha-rails (0.20.1)
|
||||
actionpack (~> 3.1.3)
|
||||
locomotive-tinymce-rails (3.4.7)
|
||||
actionpack (~> 3.1.3)
|
||||
locomotive_liquid (2.2.2)
|
||||
locomotive_mongoid_acts_as_tree (0.1.5.8)
|
||||
mail (2.3.0)
|
||||
@ -179,7 +173,7 @@ GEM
|
||||
mocha (0.9.12)
|
||||
mongo (1.5.2)
|
||||
bson (= 1.5.2)
|
||||
mongoid (2.4.0)
|
||||
mongoid (2.4.2)
|
||||
activemodel (~> 3.1)
|
||||
mongo (~> 1.3)
|
||||
tzinfo (~> 0.3.22)
|
||||
@ -226,7 +220,7 @@ GEM
|
||||
rake (0.9.2)
|
||||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
responders (0.6.4)
|
||||
responders (0.6.5)
|
||||
rest-client (1.6.7)
|
||||
mime-types (>= 1.16)
|
||||
rmagick (2.12.2)
|
||||
@ -256,11 +250,12 @@ GEM
|
||||
railties (~> 3.1.0)
|
||||
sass (~> 3.1.10)
|
||||
tilt (~> 1.3.2)
|
||||
selenium-webdriver (2.16.0)
|
||||
selenium-webdriver (2.17.0)
|
||||
childprocess (>= 0.2.5)
|
||||
ffi (~> 1.0.9)
|
||||
multi_json (~> 1.0.4)
|
||||
rubyzip
|
||||
shoulda-matchers (1.0.0)
|
||||
sprockets (2.0.3)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
@ -319,8 +314,8 @@ DEPENDENCIES
|
||||
jquery-rails (~> 1.0.16)
|
||||
kaminari
|
||||
launchy
|
||||
locomotive-aloha-rails!
|
||||
locomotive-tinymce-rails!
|
||||
locomotive-aloha-rails (~> 0.20.1)
|
||||
locomotive-tinymce-rails (~> 3.4.7)
|
||||
locomotive_liquid (= 2.2.2)
|
||||
locomotive_mongoid_acts_as_tree (~> 0.1.5.8)
|
||||
mimetype-fu (~> 0.1.2)
|
||||
@ -339,6 +334,7 @@ DEPENDENCIES
|
||||
rubyzip
|
||||
sanitize (~> 2.0.3)
|
||||
sass-rails (~> 3.1.4)
|
||||
shoulda-matchers
|
||||
uglifier (~> 1.0.4)
|
||||
unicorn
|
||||
xpath (~> 0.1.4)
|
||||
|
@ -1,5 +1,4 @@
|
||||
class Locomotive::MenuCell < Cell::Base
|
||||
|
||||
include ::Locomotive::Engine.routes.url_helpers
|
||||
|
||||
delegate :sections, :to => :parent_controller
|
||||
@ -97,4 +96,4 @@ class Locomotive::MenuCell < Cell::Base
|
||||
I18n.t("locomotive.shared.menu.#{label}")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -27,7 +27,7 @@ module Locomotive
|
||||
|
||||
## named scopes ##
|
||||
scope :visible, :where => { :_visible => true }
|
||||
scope :latest_updated, :order_by => :updated_at.desc, :limit => Locomotive.config.ui.lastest_entries_nb
|
||||
scope :latest_updated, :order_by => :updated_at.desc, :limit => Locomotive.config.ui.latest_entries_nb
|
||||
|
||||
## methods ##
|
||||
|
||||
|
@ -41,7 +41,7 @@ module Locomotive
|
||||
validates_exclusion_of :slug, :in => Locomotive.config.reserved_slugs, :if => Proc.new { |p| p.depth == 0 }
|
||||
|
||||
## named scopes ##
|
||||
scope :latest_updated, :order_by => [[:updated_at, :desc]], :limit => Locomotive.config.ui.lastest_entries_nb
|
||||
scope :latest_updated, :order_by => [[:updated_at, :desc]], :limit => Locomotive.config.ui.latest_entries_nb
|
||||
scope :root, :where => { :slug => 'index', :depth => 0 }
|
||||
scope :not_found, :where => { :slug => '404', :depth => 0 }
|
||||
scope :published, :where => { :published => true }
|
||||
@ -114,4 +114,4 @@ module Locomotive
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,7 @@
|
||||
.header
|
||||
%p= link_to t('locomotive.pages.index.new'), new_page_url
|
||||
.inner
|
||||
%h2!= t('locomotive.pages.index.lastest_entries')
|
||||
%h2!= t('locomotive.pages.index.latest_entries')
|
||||
%ul
|
||||
- current_site.pages.latest_updated.minimal_attributes.each do |page|
|
||||
%li
|
||||
@ -32,9 +32,9 @@
|
||||
%p.edit= link_to t('locomotive.content_types.index.edit'), edit_content_type_url(content_type)
|
||||
|
||||
.inner
|
||||
%h2!= t('locomotive.content_entries.index.lastest_entries')
|
||||
%h2!= t('locomotive.content_entries.index.latest_entries')
|
||||
%ul
|
||||
- content_type.entries.latest_updated.each do |entry|
|
||||
%li
|
||||
= link_to truncate(entry._label(content_type), :length => 20), edit_content_entry_url(content_type.slug, entry)
|
||||
%span= time_ago_in_words(entry.updated_at)
|
||||
%span= time_ago_in_words(entry.updated_at)
|
||||
|
@ -93,7 +93,7 @@ de:
|
||||
help: "Seiten sind als Baum organisiert. Du kannst die Seiten also wie Ordner sortieren und verschachteln."
|
||||
no_items: "Momentan gibt es keine Seiten. Klicke einfach <a href='%{url}'>hier</a>, um die erste Seite zu erstellen."
|
||||
new: neue Seite
|
||||
lastest_entries: Neueste Seiten
|
||||
latest_entries: Neueste Seiten
|
||||
new:
|
||||
title: Neue Seite
|
||||
help: "Fülle das folgende Formular aus, um eine neue Seite zu erstellen. Nur zur Info: Die Seite wird nicht standardmäßig publiziert!"
|
||||
@ -252,7 +252,7 @@ de:
|
||||
download: Elemente herunterladen
|
||||
new: neues Element
|
||||
category_noname: "Kein Name"
|
||||
lastest_entries: "Neueste Elemente"
|
||||
latest_entries: "Neueste Elemente"
|
||||
updated_at: "Aktualisiert am"
|
||||
list:
|
||||
no_entries: "Momentan gibt es keine Elemente. Klicke einfach <a href='%{url}'>hier</a>, um das erste Element zu erstellen."
|
||||
|
@ -101,7 +101,7 @@ en:
|
||||
help: "Pages are organized as a tree. You can order pages as well as folders"
|
||||
no_items: "There are no pages for now. Just click <a href=\"%{url}\">here</a> to create the first one."
|
||||
new: new page
|
||||
lastest_entries: Lastest pages
|
||||
latest_entries: Lastest pages
|
||||
new:
|
||||
title: New page
|
||||
help: "Please fill in the below form to create your page. Be careful, by default, the page is not published."
|
||||
@ -249,7 +249,7 @@ en:
|
||||
download: download entries
|
||||
new: new entry
|
||||
category_noname: "No name"
|
||||
lastest_entries: "Lastest entries"
|
||||
latest_entries: "Lastest entries"
|
||||
updated_at: "Updated at"
|
||||
list:
|
||||
no_items: "There are no entries for now. Just click <a href=\"%{url}\">here</a> to create the first one."
|
||||
|
@ -91,7 +91,7 @@ es:
|
||||
no_items: "No se ha creado ninguna página aún. Pulse <a href=\"%{url}\">aquí</a> to para crear la primera."
|
||||
|
||||
new: Nueva página
|
||||
lastest_entries: Últimas páginas
|
||||
latest_entries: Últimas páginas
|
||||
new:
|
||||
title: Nueva página
|
||||
help: "Por favor rellene el formulario de más abajo para crear su página. ¡Atención! Las páginas, por defecto, están 'no publicadas'."
|
||||
@ -236,7 +236,7 @@ es:
|
||||
download: descargar elementos
|
||||
new: nuevo elemento
|
||||
category_noname: "Sin nombre"
|
||||
lastest_entries: "Últimos elementos"
|
||||
latest_entries: "Últimos elementos"
|
||||
updated_at: "Última actualización"
|
||||
list:
|
||||
no_entries: "No hay ningún elemento. Haga click <a href=\"%{url}\">aquí</a> para crear el primero."
|
||||
|
@ -93,7 +93,7 @@ fr:
|
||||
help: "Les pages sont organisées sous forme d'un arbre. Vous pouvez classes les pages ainsi que les dossiers."
|
||||
no_items: "Il n'existe pas de page. Vous pouvez commencer par créer une <a href='%{url}'>ici</a>."
|
||||
new: nouvelle page
|
||||
lastest_entries: Dernières pages
|
||||
latest_entries: Dernières pages
|
||||
new:
|
||||
title: Nouvelle page
|
||||
help: "Remplissez le formulaire ci-dessous pour créer votre page. Attention, par défaut, la page n'est pas publiée."
|
||||
@ -240,7 +240,7 @@ fr:
|
||||
download: télécharger éléments
|
||||
new: nouvel élément
|
||||
category_noname: "Pas de nom"
|
||||
lastest_entries: "Eléments récents"
|
||||
latest_entries: "Eléments récents"
|
||||
updated_at: "Mis à jour le"
|
||||
list:
|
||||
no_entries: "Il n'existe pas d'éléments. Vous pouvez commencer par créer un <a href='%{url}'>ici</a>"
|
||||
|
@ -91,7 +91,7 @@ it:
|
||||
help: "Le pagine sono organizzate ad albero. Puoi ordinarle come se fossero delle cartelle"
|
||||
no_items: "Per ora non ci sono pagine. Clicca <a href=\"%{url}\">qui</a> per creare la prima pagina."
|
||||
new: nuova pagina
|
||||
lastest_entries: Ultime pagine
|
||||
latest_entries: Ultime pagine
|
||||
new:
|
||||
title: Nuova pagina
|
||||
help: "Prego, compila il seguente modulo per creare la tua pagina. Fai attenzione, per default, la pagina non è pubblicata."
|
||||
@ -235,7 +235,7 @@ it:
|
||||
download: scarica elementi
|
||||
new: nuovo elemento
|
||||
category_noname: "Senza nome"
|
||||
lastest_entries: "Ultimi elementi"
|
||||
latest_entries: "Ultimi elementi"
|
||||
updated_at: "modificato il"
|
||||
list:
|
||||
no_entries: "Per ora non ci sono elementi. Clicca <a href=\"%{url}\">qui</a> per creare il primo."
|
||||
|
@ -84,7 +84,7 @@ nl:
|
||||
help: "Pagina's zijn georganiseerd als een boom. U kunt zowel pagina's als mappen ordenen"
|
||||
no_items: "Er zijn momenteel geen pagina's. Klik <a href=\"%{url}\">hier</a> om de eerste pagina te maken."
|
||||
new: Nieuwe pagina
|
||||
lastest_entries: Laatste pagina's
|
||||
latest_entries: Laatste pagina's
|
||||
new:
|
||||
title: Nieuwe pagina
|
||||
help: "Voer onderstaande formulier in om uw pagina te maken. Opgelet, de pagina is niet gepubliseerd"
|
||||
@ -220,7 +220,7 @@ nl:
|
||||
download: download items
|
||||
new: nieuw item
|
||||
category_noname: "Geen naam"
|
||||
lastest_entries: "Laatste items"
|
||||
latest_entries: "Laatste items"
|
||||
updated_at: "Gewijzigd op"
|
||||
list:
|
||||
no_entries: "Er zijn momenteel geen items. Klik hier <a href=\"%{url}\">here</a> om de eerste te maken."
|
||||
|
@ -93,7 +93,7 @@
|
||||
help: "Sidene er organisert i en trestruktur. Du kan sortere både sider og mapper."
|
||||
no_items: "Det har ikke blitt opprettet noen sider ennå. Klikk <a href=\"%{url}\">her</a> for lage den første."
|
||||
new: ny side
|
||||
lastest_entries: Siste sider
|
||||
latest_entries: Siste sider
|
||||
new:
|
||||
title: Ny side
|
||||
help: "Fyll ut skjemaet nedenfor for å opprette en ny side. Publisering er skrudd av som standard."
|
||||
@ -237,7 +237,7 @@
|
||||
download: last ned elementer
|
||||
new: nytt element
|
||||
category_noname: "Navn mangler"
|
||||
lastest_entries: "Siste elementer"
|
||||
latest_entries: "Siste elementer"
|
||||
updated_at: "Sist oppdatert"
|
||||
list:
|
||||
no_entries: "Det har ikke blitt opprettet noen elementer her ennå. Klikk <a href=\"%{url}\">her</a> for å opprette det første."
|
||||
|
@ -82,7 +82,7 @@ pt-BR:
|
||||
help: "As páginas são organizadas como uma árvore. Você pode reordenar as páginas como se fossem pastas"
|
||||
no_items: "Não existe nenhuma página ainda. Clique <a href=\"%{url}\">aqui</a> para criar a primeira."
|
||||
new: nova página
|
||||
lastest_entries: Últmas páginas
|
||||
latest_entries: Últmas páginas
|
||||
new:
|
||||
title: Nova página
|
||||
help: "Por favor, preencha o formulário a seguir para criar sua página. Atenção: Por padrão a página não é publicada."
|
||||
@ -215,7 +215,7 @@ pt-BR:
|
||||
download: download dos itens
|
||||
new: novo item
|
||||
category_noname: "Sem nome"
|
||||
lastest_entries: "Últimos itens"
|
||||
latest_entries: "Últimos itens"
|
||||
updated_at: "Atualizado em"
|
||||
list:
|
||||
no_entries: "Não existem itens ainda. Clique <a href=\"%{url}\">aqui</a> para criar o primeiro."
|
||||
|
@ -93,7 +93,7 @@ ru:
|
||||
help: "Страницы организованы в виде дерева. Вы можете сортировать как страницы, так и папки"
|
||||
no_items: "There are no pages for now. Just click <a href=\"%{url}\">here</a> to create the first one."
|
||||
new: новая страница
|
||||
lastest_entries: Страницы за последнее время
|
||||
latest_entries: Страницы за последнее время
|
||||
new:
|
||||
title: Новая страница
|
||||
help: "Заполните форму, приведенную ниже, для создания страницы. Будьте осторожны, по умолчанию, страница не опубликована."
|
||||
@ -236,7 +236,7 @@ ru:
|
||||
download: скачать элементы
|
||||
new: новый элемент
|
||||
category_noname: "Без имени"
|
||||
lastest_entries: "Элементы за последнее время"
|
||||
latest_entries: "Элементы за последнее время"
|
||||
updated_at: "Обновлено"
|
||||
list:
|
||||
no_entries: "На данный момент нет ни одного элемента. Нажмите <a href=\"%{url}\">здесь</a> для создания первого элемента."
|
||||
|
@ -45,7 +45,7 @@ Locomotive.configure do |config|
|
||||
|
||||
# configure how many items we display in sub menu in the "Contents" section.
|
||||
# config.ui = {
|
||||
# :lastest_entries_nb => 5,
|
||||
# :latest_entries_nb => 5,
|
||||
# :max_content_types => 4
|
||||
# }
|
||||
|
||||
@ -83,4 +83,4 @@ Locomotive.configure do |config|
|
||||
#
|
||||
# Note: by default, rack/cache is disabled in the Heroku platform
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ module Locomotive
|
||||
:manage_subdomain => false,
|
||||
:manage_manage_domains => false,
|
||||
:ui => {
|
||||
:lastest_entries_nb => 5,
|
||||
:latest_entries_nb => 5,
|
||||
:max_content_types => 2
|
||||
},
|
||||
:rack_cache => {
|
||||
|
@ -31,7 +31,7 @@ namespace :locomotive do
|
||||
|
||||
desc 'Import a remote template described by its URL -- 2 options: SITE=name or id, RESET=by default false'
|
||||
task :import => :environment do
|
||||
url, site_name_or_id, reset = ENV['URL'], ENV['SITE'], Boolean.set(ENV['RESET']) || false
|
||||
url, site_name_or_id, samples, reset = ENV['URL'], ENV['SITE'], (Boolean.set(ENV['SAMPLES']) || false), (Boolean.set(ENV['RESET']) || false)
|
||||
|
||||
if url.blank? || (url =~ /https?:\/\//).nil?
|
||||
raise "URL is missing or it is not a valid http url."
|
||||
@ -43,9 +43,10 @@ namespace :locomotive do
|
||||
raise "No site found. Please give a correct value (name or id) for the SITE env variable."
|
||||
end
|
||||
|
||||
::Locomotive::Import::Job.run!(url, site, { :samples => true, :reset => reset })
|
||||
::Locomotive::Import::Job.run!(url, site, { :samples => samples, :reset => reset })
|
||||
end
|
||||
|
||||
|
||||
desc 'Add a new admin user (NOTE: currently only supports adding user to first site)'
|
||||
task :add_admin => :environment do
|
||||
name = ask('Display name: ') { |q| q.echo = true }
|
||||
|
@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency 'locomotive_liquid', '2.2.2'
|
||||
s.add_dependency 'formtastic', '~> 2.0.2'
|
||||
s.add_dependency 'responders', '~> 0.6.4'
|
||||
s.add_dependency 'cells', '~> 3.7.1'
|
||||
s.add_dependency 'cells', '~> 3.8.0'
|
||||
s.add_dependency 'RedCloth', '~> 4.2.8'
|
||||
s.add_dependency 'sanitize', '~> 2.0.3'
|
||||
s.add_dependency 'highline', '~> 1.6.2'
|
||||
|
@ -1,20 +1,20 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Locomotive::Account do
|
||||
let!(:existing_account) { Factory(:account, :email => 'another@email.com') }
|
||||
|
||||
it 'should have a valid factory' do
|
||||
FactoryGirl.build(:account).should be_valid
|
||||
end
|
||||
|
||||
## Validations ##
|
||||
|
||||
%w{name email password}.each do |attr|
|
||||
it "should validate presence of #{attr}" do
|
||||
account = FactoryGirl.build(:account, attr.to_sym => nil)
|
||||
account.should_not be_valid
|
||||
account.errors[attr.to_sym].should include("can't be blank")
|
||||
end
|
||||
end
|
||||
it { should validate_presence_of :name }
|
||||
it { should validate_presence_of :email }
|
||||
it { should validate_presence_of :password }
|
||||
it { should validate_uniqueness_of(:email).with_message(/is already taken/) }
|
||||
it { should allow_value('valid@email.com').for(:email) }
|
||||
it { should allow_value('prefix+suffix@email.com').for(:email) }
|
||||
it { should_not allow_value('not-an-email').for(:email) }
|
||||
|
||||
it "should have a default locale" do
|
||||
account = Locomotive::Account.new
|
||||
|
Loading…
Reference in New Issue
Block a user