spec updates
This commit is contained in:
@@ -11,18 +11,18 @@ group :assets do
|
||||
gem 'coffee-script'
|
||||
#gem 'therubyracer', :platforms => :ruby
|
||||
#gem 'less-rails'
|
||||
gem 'bootstrap-sass'
|
||||
gem 'bootstrap-sass', '~>2.3'
|
||||
end
|
||||
|
||||
gem 'couch_potato' , github: 'bterkuile/couch_potato'
|
||||
gem 'simply_stored' , github: 'bterkuile/simply_stored'
|
||||
gem 'orm_adapter', github: 'bterkuile/orm_adapter'
|
||||
gem 'devise'
|
||||
gem 'devise_simply_stored'
|
||||
gem 'devise_simply_stored', github: 'bterkuile/devise_simply_stored'
|
||||
gem 'tinymce-rails'
|
||||
gem 'haml-rails'
|
||||
gem 'slim-rails'
|
||||
gem 'paperclip'
|
||||
gem 'paperclip', '3.5.2'
|
||||
gem 'email_validator'
|
||||
# Declare any dependencies that are still in development here instead of in
|
||||
# your gemspec. These might include edge Rails or gems from your path or
|
||||
@@ -31,12 +31,15 @@ gem 'email_validator'
|
||||
|
||||
# jquery-rails is used by the dummy application
|
||||
gem "jquery-rails"
|
||||
gem "jquery-ui-rails"
|
||||
# To use debugger
|
||||
group :test do
|
||||
gem 'steak'
|
||||
gem 'pry-rails'
|
||||
gem 'factory_girl_rails'
|
||||
end
|
||||
group :development do
|
||||
gem 'pry-rails'
|
||||
gem 'thin'
|
||||
#gem 'ruby-debug19', :require => 'ruby-debug'
|
||||
end
|
||||
|
||||
+55
-10
@@ -7,6 +7,13 @@ GIT
|
||||
couchrest (>= 1.0.1)
|
||||
json (~> 1.6)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/bterkuile/devise_simply_stored.git
|
||||
revision: 8fdaed396a7e9566fe6cb59b64d950953c8506a6
|
||||
specs:
|
||||
devise_simply_stored (0.1.0)
|
||||
devise
|
||||
|
||||
GIT
|
||||
remote: git://github.com/bterkuile/orm_adapter.git
|
||||
revision: e0b5f652c8d1eda8c0f6636f3b3d17d598603450
|
||||
@@ -25,17 +32,22 @@ GIT
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
cmtool (0.5.0)
|
||||
cmtool (1.0.0)
|
||||
bourbon
|
||||
email_validator
|
||||
haml-rails
|
||||
jquery-rails
|
||||
rails (>= 4.1.0)
|
||||
slim-rails
|
||||
tinymce-rails
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.1.0)
|
||||
actionpack (= 4.1.0)
|
||||
actionview (= 4.1.0)
|
||||
mail (~> 2.5.4)
|
||||
actionpack (4.1.0)
|
||||
actionview (= 4.1.0)
|
||||
activesupport (= 4.1.0)
|
||||
@@ -48,16 +60,21 @@ GEM
|
||||
activemodel (4.1.0)
|
||||
activesupport (= 4.1.0)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.0)
|
||||
activemodel (= 4.1.0)
|
||||
activesupport (= 4.1.0)
|
||||
arel (~> 5.0.0)
|
||||
activesupport (4.1.0)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (5.0.1.20140414130214)
|
||||
bcrypt (3.1.7)
|
||||
bootstrap-sass (3.1.1.1)
|
||||
bootstrap-sass (2.3.2.2)
|
||||
sass (~> 3.2)
|
||||
bourbon (3.2.0)
|
||||
bourbon (3.2.1)
|
||||
sass (~> 3.2)
|
||||
thor
|
||||
builder (3.2.2)
|
||||
@@ -71,6 +88,7 @@ GEM
|
||||
activesupport (>= 3.0)
|
||||
cocaine (0.5.4)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
coderay (1.1.0)
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
@@ -86,8 +104,6 @@ GEM
|
||||
railties (>= 3.2.6, < 5)
|
||||
thread_safe (~> 0.1)
|
||||
warden (~> 1.2.3)
|
||||
devise_simply_stored (0.0.3)
|
||||
devise
|
||||
diff-lcs (1.2.5)
|
||||
email_validator (1.4.0)
|
||||
activemodel
|
||||
@@ -111,21 +127,44 @@ GEM
|
||||
jquery-rails (3.1.0)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (4.2.1)
|
||||
railties (>= 3.2.16)
|
||||
json (1.8.1)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
method_source (0.8.2)
|
||||
mime-types (1.25.1)
|
||||
mini_portile (0.5.3)
|
||||
minitest (5.3.3)
|
||||
multi_json (1.9.2)
|
||||
multi_json (1.9.3)
|
||||
nokogiri (1.6.1)
|
||||
mini_portile (~> 0.5.0)
|
||||
paperclip (4.1.1)
|
||||
paperclip (3.5.2)
|
||||
activemodel (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (~> 0.5.3)
|
||||
mime-types
|
||||
polyglot (0.3.4)
|
||||
pry (0.9.12.6)
|
||||
coderay (~> 1.0)
|
||||
method_source (~> 0.8)
|
||||
slop (~> 3.4)
|
||||
pry-rails (0.3.2)
|
||||
pry (>= 0.9.10)
|
||||
rack (1.5.2)
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rails (4.1.0)
|
||||
actionmailer (= 4.1.0)
|
||||
actionpack (= 4.1.0)
|
||||
actionview (= 4.1.0)
|
||||
activemodel (= 4.1.0)
|
||||
activerecord (= 4.1.0)
|
||||
activesupport (= 4.1.0)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.1.0)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (4.1.0)
|
||||
actionpack (= 4.1.0)
|
||||
activesupport (= 4.1.0)
|
||||
@@ -160,6 +199,7 @@ GEM
|
||||
activesupport (>= 3.0, < 4.2)
|
||||
railties (>= 3.0, < 4.2)
|
||||
slim (~> 2.0)
|
||||
slop (3.5.0)
|
||||
sprockets (2.11.0)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
@@ -182,6 +222,9 @@ GEM
|
||||
tilt (1.4.1)
|
||||
tinymce-rails (4.0.19)
|
||||
railties (>= 3.1.1)
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (1.1.0)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.3)
|
||||
@@ -193,19 +236,21 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bootstrap-sass
|
||||
bootstrap-sass (~> 2.3)
|
||||
bourbon
|
||||
cmtool!
|
||||
coffee-script
|
||||
couch_potato!
|
||||
devise
|
||||
devise_simply_stored
|
||||
devise_simply_stored!
|
||||
email_validator
|
||||
factory_girl_rails
|
||||
haml-rails
|
||||
jquery-rails
|
||||
jquery-ui-rails
|
||||
orm_adapter!
|
||||
paperclip
|
||||
paperclip (= 3.5.2)
|
||||
pry-rails
|
||||
sass-rails
|
||||
simply_stored!
|
||||
slim-rails
|
||||
|
||||
@@ -43,7 +43,7 @@ module Cmtool
|
||||
# POST /contact_forms
|
||||
# POST /contact_forms.xml
|
||||
def create
|
||||
@contact_form = Cmtool::ContactForm.new(params[:contact_form])
|
||||
@contact_form = Cmtool::ContactForm.new(contact_form_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @contact_form.save
|
||||
@@ -62,7 +62,7 @@ module Cmtool
|
||||
@contact_form = Cmtool::ContactForm.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @contact_form.update_attributes(params[:contact_form])
|
||||
if @contact_form.update_attributes(contact_form_params)
|
||||
format.html { redirect_to([cmtool, @contact_form], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::ContactForm.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
@@ -85,12 +85,18 @@ module Cmtool
|
||||
end
|
||||
|
||||
def add
|
||||
@contact_form = Cmtool::ContactForm.new(params[:contact_form])
|
||||
@contact_form = Cmtool::ContactForm.new(contact_form_params)
|
||||
if @contact_form.save
|
||||
redirect_to :back, notice: I18n.t('cmtool.contact_form.submitted')
|
||||
else
|
||||
redirect_to :back, alert: I18n.t('cmtool.contact_form.submission_failed', reason: @contact_form.errors.full_messages.join(', '))
|
||||
redirect_to :back, alert: I18n.t('cmtool.contact_form.submission_failed', reason: @contact_form.errors.full_messages.to_sentence )
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def contact_form_params
|
||||
params.require(:contact_form).permit(:gender, :name, :email, :phone, :body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@ module Cmtool
|
||||
# POST /faqs
|
||||
# POST /faqs.xml
|
||||
def create
|
||||
@faq = Cmtool::Faq.new(params[:faq])
|
||||
@faq = Cmtool::Faq.new(faq_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @faq.save
|
||||
@@ -60,7 +60,7 @@ module Cmtool
|
||||
@faq = Cmtool::Faq.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @faq.update_attributes(params[:faq])
|
||||
if @faq.update_attributes(faq_params)
|
||||
format.html { redirect_to([cmtool, @faq], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Faq.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
@@ -81,5 +81,11 @@ module Cmtool
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def faq_params
|
||||
params.require(:faq).permit(:question, :answer, :active)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,7 +43,7 @@ module Cmtool
|
||||
# POST /newsletter_subscriptions
|
||||
# POST /newsletter_subscriptions.xml
|
||||
def create
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.new(params[:newsletter_subscription])
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.new(newsletter_subscription_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @newsletter_subscription.save
|
||||
@@ -62,7 +62,7 @@ module Cmtool
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @newsletter_subscription.update_attributes(params[:newsletter_subscription])
|
||||
if @newsletter_subscription.update_attributes(newsletter_subscription_params)
|
||||
format.html { redirect_to([cmtool, @newsletter_subscription], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::NewsletterSubscription.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
@@ -85,12 +85,18 @@ module Cmtool
|
||||
end
|
||||
|
||||
def add
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.new(params[:newsletter_subscription])
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.new(newsletter_subscription_params)
|
||||
if @newsletter_subscription.save
|
||||
redirect_to :back, notice: I18n.t('cmtool.newsletter_subscription.subscribed')
|
||||
else
|
||||
redirect_to :back, alert: I18n.t('cmtool.newsletter_subscription.subscription_failed', reason: @newsletter_subscription.errors.full_messages.join(', '))
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def newsletter_subscription_params
|
||||
params.require(:newsletter_subscription).permit(:email)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
module Cmtool
|
||||
class Faq
|
||||
include SimplyStored::Couch
|
||||
|
||||
|
||||
property :question
|
||||
property :answer
|
||||
property :active, type: :boolean, default: true
|
||||
|
||||
|
||||
view :active_view, key: :created_at, conditions: "doc['active']"
|
||||
|
||||
|
||||
def self.active
|
||||
database.view(active_view)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
module Cmtool
|
||||
class NewsletterSubscription
|
||||
include SimplyStored::Couch
|
||||
|
||||
|
||||
# PROPERTIES
|
||||
property :email
|
||||
property :active, :type => :boolean, :default => true
|
||||
property :deactivation_token
|
||||
|
||||
|
||||
# CALLBACKS
|
||||
before_save :set_deactivation_token
|
||||
|
||||
|
||||
validates :email, presence: true, email: true
|
||||
|
||||
def name
|
||||
email
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def set_deactivation_token
|
||||
self.deactivation_token = ((('a'..'z').to_a + ('A'..'Z').to_a)*100).sample(10).join
|
||||
end
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
||||
s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||
s.test_files = Dir["spec/**/*"]
|
||||
|
||||
#s.add_dependency "rails", ">= 4.1.0"
|
||||
s.add_dependency "rails", ">= 4.1.0"
|
||||
s.add_dependency 'email_validator'
|
||||
s.add_dependency 'bourbon'
|
||||
s.add_dependency 'haml-rails'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module ActiveModel
|
||||
class Name
|
||||
def human_plural
|
||||
I18n.t("activemodel.models.plural.#{underscore.gsub('/', '.')}", :default => nil ) || human.pluralize
|
||||
@human_plural ||= (I18n.t("activemodel.models.plural.#{i18n_key.to_s.gsub('/', '.')}", :default => nil ) || human.pluralize)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
en:
|
||||
devise:
|
||||
confirmations:
|
||||
confirmed: "Your account was successfully confirmed. Please sign in."
|
||||
confirmed_and_signed_in: "Your account was successfully confirmed. You are now signed in."
|
||||
confirmed: "Your account was successfully confirmed."
|
||||
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
|
||||
failure:
|
||||
already_authenticated: "You are already signed in."
|
||||
inactive: "Your account is not activated yet."
|
||||
invalid: "Invalid email or password."
|
||||
invalid_token: "Invalid authentication token."
|
||||
locked: "Your account is locked."
|
||||
last_attempt: "You have one more attempt before your account will be locked."
|
||||
not_found_in_database: "Invalid email or password."
|
||||
timeout: "Your session expired. Please sign in again to continue."
|
||||
unauthenticated: "You need to sign in or sign up before continuing."
|
||||
@@ -29,7 +28,7 @@ en:
|
||||
success: "Successfully authenticated from %{kind} account."
|
||||
passwords:
|
||||
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
||||
send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
|
||||
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||
updated: "Your password was changed successfully. You are now signed in."
|
||||
updated_not_active: "Your password was changed successfully."
|
||||
|
||||
@@ -19,9 +19,9 @@ module Cmtool
|
||||
require 'bourbon'
|
||||
require 'slim-rails'
|
||||
require 'haml-rails'
|
||||
require 'paperclip'
|
||||
require 'devise'
|
||||
require 'devise_simply_stored'
|
||||
require 'paperclip'
|
||||
require 'jquery-rails'
|
||||
require 'tinymce-rails'
|
||||
Cmtool::Menu.register do
|
||||
|
||||
@@ -10,8 +10,6 @@ module Cmtool
|
||||
klass.property :is_admin, type: :boolean
|
||||
klass.property :active, type: :boolean, default: true
|
||||
|
||||
klass.devise :database_authenticatable, :recoverable, :rememberable, :trackable
|
||||
|
||||
|
||||
#== VALIDATIONS
|
||||
klass.validates_presence_of :email
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Cmtool
|
||||
VERSION = "0.5.0"
|
||||
VERSION = "1.0.0"
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Cmtool::ContactFormsController do
|
||||
routes { Cmtool::Engine.routes }
|
||||
before :each do
|
||||
sign_in @user
|
||||
end
|
||||
@@ -73,22 +74,6 @@ describe Cmtool::ContactFormsController do
|
||||
response.should redirect_to(Cmtool::ContactForm.last)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with invalid params" do
|
||||
it "assigns a newly created but unsaved contact_form as @contact_form" do
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::ContactForm.any_instance.stub(:save).and_return(false)
|
||||
post :create, :contact_form => {}
|
||||
assigns(:contact_form).should be_a_new(Cmtool::ContactForm)
|
||||
end
|
||||
|
||||
it "re-renders the 'new' template" do
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::ContactForm.any_instance.stub(:save).and_return(false)
|
||||
post :create, :contact_form => {}
|
||||
response.should render_template("new")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "PUT update" do
|
||||
@@ -99,8 +84,8 @@ describe Cmtool::ContactFormsController do
|
||||
# specifies that the Cmtool::ContactForm created on the previous line
|
||||
# receives the :update_attributes message with whatever params are
|
||||
# submitted in the request.
|
||||
Cmtool::ContactForm.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
|
||||
put :update, :id => contact_form.id, :contact_form => {'these' => 'params'}
|
||||
Cmtool::ContactForm.any_instance.should_receive(:update_attributes).with({'name' => 'Zeikurt'})
|
||||
put :update, :id => contact_form.id, :contact_form => {'name' => 'Zeikurt'}
|
||||
end
|
||||
|
||||
it "assigns the requested contact_form as @contact_form" do
|
||||
@@ -116,23 +101,6 @@ describe Cmtool::ContactFormsController do
|
||||
end
|
||||
end
|
||||
|
||||
describe "with invalid params" do
|
||||
it "assigns the contact_form as @contact_form" do
|
||||
contact_form = create(:contact_form)
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::ContactForm.any_instance.stub(:save).and_return(false)
|
||||
put :update, :id => contact_form.id, :contact_form => {}
|
||||
assigns(:contact_form).should eq(contact_form)
|
||||
end
|
||||
|
||||
it "re-renders the 'edit' template" do
|
||||
contact_form = create(:contact_form)
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::ContactForm.any_instance.stub(:save).and_return(false)
|
||||
put :update, :id => contact_form.id, :contact_form => {}
|
||||
response.should render_template("edit")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE destroy" do
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Cmtool::FaqsController do
|
||||
routes { Cmtool::Engine.routes }
|
||||
before :each do
|
||||
sign_in @user
|
||||
end
|
||||
@@ -67,21 +68,6 @@ describe Cmtool::FaqsController do
|
||||
end
|
||||
end
|
||||
|
||||
describe "with invalid params" do
|
||||
it "assigns a newly created but unsaved faq as @faq" do
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::Faq.any_instance.stub(:save).and_return(false)
|
||||
post :create, :faq => {}
|
||||
assigns(:faq).should be_a_new(Cmtool::Faq)
|
||||
end
|
||||
|
||||
it "re-renders the 'new' template" do
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::Faq.any_instance.stub(:save).and_return(false)
|
||||
post :create, :faq => {}
|
||||
response.should render_template("new")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "PUT update" do
|
||||
@@ -92,8 +78,8 @@ describe Cmtool::FaqsController do
|
||||
# specifies that the Cmtool::Faq created on the previous line
|
||||
# receives the :update_attributes message with whatever params are
|
||||
# submitted in the request.
|
||||
Cmtool::Faq.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
|
||||
put :update, :id => faq.id, :faq => {'these' => 'params'}
|
||||
Cmtool::Faq.any_instance.should_receive(:update_attributes).with({'question' => 'meaning of life'})
|
||||
put :update, :id => faq.id, :faq => {'question' => 'meaning of life'}
|
||||
end
|
||||
|
||||
it "assigns the requested faq as @faq" do
|
||||
@@ -109,23 +95,6 @@ describe Cmtool::FaqsController do
|
||||
end
|
||||
end
|
||||
|
||||
describe "with invalid params" do
|
||||
it "assigns the faq as @faq" do
|
||||
faq = create(:faq)
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::Faq.any_instance.stub(:save).and_return(false)
|
||||
put :update, :id => faq.id, :faq => {}
|
||||
assigns(:faq).should eq(faq)
|
||||
end
|
||||
|
||||
it "re-renders the 'edit' template" do
|
||||
faq = create(:faq)
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::Faq.any_instance.stub(:save).and_return(false)
|
||||
put :update, :id => faq.id, :faq => {}
|
||||
response.should render_template("edit")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE destroy" do
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Cmtool::NewsletterSubscriptionsController do
|
||||
routes { Cmtool::Engine.routes }
|
||||
before :each do
|
||||
sign_in @user
|
||||
end
|
||||
@@ -78,14 +79,14 @@ describe Cmtool::NewsletterSubscriptionsController do
|
||||
it "assigns a newly created but unsaved newsletter_subscription as @newsletter_subscription" do
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::NewsletterSubscription.any_instance.stub(:save).and_return(false)
|
||||
post :create, :newsletter_subscription => {}
|
||||
post :create, :newsletter_subscription => {email: ''}
|
||||
assigns(:newsletter_subscription).should be_a_new(Cmtool::NewsletterSubscription)
|
||||
end
|
||||
|
||||
it "re-renders the 'new' template" do
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::NewsletterSubscription.any_instance.stub(:save).and_return(false)
|
||||
post :create, :newsletter_subscription => {}
|
||||
post :create, :newsletter_subscription => {email: ''}
|
||||
response.should render_template("new")
|
||||
end
|
||||
end
|
||||
@@ -99,8 +100,8 @@ describe Cmtool::NewsletterSubscriptionsController do
|
||||
# specifies that the Cmtool::NewsletterSubscription created on the previous line
|
||||
# receives the :update_attributes message with whatever params are
|
||||
# submitted in the request.
|
||||
Cmtool::NewsletterSubscription.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
|
||||
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {'these' => 'params'}
|
||||
Cmtool::NewsletterSubscription.any_instance.should_receive(:update_attributes).with({'email' => 'test44@cmtool.nl'})
|
||||
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {'email' => 'test44@cmtool.nl'}
|
||||
end
|
||||
|
||||
it "assigns the requested newsletter_subscription as @newsletter_subscription" do
|
||||
@@ -121,7 +122,7 @@ describe Cmtool::NewsletterSubscriptionsController do
|
||||
newsletter_subscription = create(:newsletter_subscription)
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::NewsletterSubscription.any_instance.stub(:save).and_return(false)
|
||||
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {}
|
||||
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {email: ''}
|
||||
assigns(:newsletter_subscription).should eq(newsletter_subscription)
|
||||
end
|
||||
|
||||
@@ -129,7 +130,7 @@ describe Cmtool::NewsletterSubscriptionsController do
|
||||
newsletter_subscription = create(:newsletter_subscription)
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Cmtool::NewsletterSubscription.any_instance.stub(:save).and_return(false)
|
||||
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {}
|
||||
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {email: ''}
|
||||
response.should render_template("edit")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Cmtool::PagesController do
|
||||
routes { Cmtool::Engine.routes }
|
||||
describe 'GET index' do
|
||||
it "should render standard view when tree is available" do
|
||||
#binding.pry
|
||||
create_pages_tree
|
||||
->{ get :index }.should_not raise_error
|
||||
expect{ get :index }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
class User
|
||||
include Cmtool::Includes::User
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||
# Many of these configuration options can be set straight in your model.
|
||||
=begin
|
||||
Devise.setup do |config|
|
||||
# The secret key used by Devise. Devise uses this key to generate
|
||||
# random tokens. Changing this key will render invalid all existing
|
||||
# confirmation, reset password and unlock tokens in the database.
|
||||
config.secret_key = 'b7df7d5dde0fa957aa669da50edf28446bb0cd144a534ea2df726ce7553cf3c94e3eb717b3885baba0a4a477bcd4a2cd9dd0c9157dc549d3956eb89ff987aac4'
|
||||
config.secret_key = '0182bf2df57625f0948c148caf0a8c0fdd5dfdf1c611665c1063f5de3e046939bca0f0c213e77da2fe835cdf238d83a38cb6494de9e4b5bf793be32fc711a844'
|
||||
|
||||
# ==> Mailer Configuration
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
@@ -20,7 +19,8 @@ Devise.setup do |config|
|
||||
# Load and configure the ORM. Supports :active_record (default) and
|
||||
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||
# available as additional gems.
|
||||
require 'devise/orm/simply_stored'
|
||||
#require 'devise/orm/simply_stored'
|
||||
require 'orm_adapter/adapters/simply_stored'
|
||||
|
||||
# ==> Configuration for any authentication mechanism
|
||||
# Configure which keys are used when authenticating a user. The default is
|
||||
@@ -57,12 +57,9 @@ Devise.setup do |config|
|
||||
|
||||
# Tell if authentication through HTTP Auth is enabled. False by default.
|
||||
# It can be set to an array that will enable http authentication only for the
|
||||
# given strategies, for example, `config.http_authenticatable = [:token]` will
|
||||
# enable it only for token authentication. The supported strategies are:
|
||||
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
||||
# enable it only for database authentication. The supported strategies are:
|
||||
# :database = Support basic authentication with authentication key + password
|
||||
# :token = Support basic authentication with token authentication key
|
||||
# :token_options = Support token authentication with options as defined in
|
||||
# http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html
|
||||
# config.http_authenticatable = false
|
||||
|
||||
# If http headers should be returned for AJAX requests. True by default.
|
||||
@@ -77,10 +74,10 @@ Devise.setup do |config|
|
||||
# config.paranoid = true
|
||||
|
||||
# By default Devise will store the user in session. You can skip storage for
|
||||
# :http_auth and :token_auth by adding those symbols to the array below.
|
||||
# particular strategies by setting this option.
|
||||
# Notice that if you are skipping storage for all authentication paths, you
|
||||
# may want to disable generating routes to Devise's sessions controller by
|
||||
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
||||
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
||||
config.skip_session_storage = [:http_auth]
|
||||
|
||||
# By default, Devise cleans up the CSRF token on authentication to
|
||||
@@ -95,18 +92,20 @@ Devise.setup do |config|
|
||||
#
|
||||
# Limiting the stretches to just one in testing will increase the performance of
|
||||
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
||||
# a value less than 10 in other environments.
|
||||
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
||||
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
||||
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
||||
config.stretches = Rails.env.test? ? 1 : 10
|
||||
|
||||
# Setup a pepper to generate the encrypted password.
|
||||
# config.pepper = 'c0227c570bd8952ba6b28e1e9d6e7d4836b2b7dc7fcd70fde20dcb4a4f9f9be28a155dee0f2cf0e5f5d6eb7daca7d707329a66c6eed70477dd20edefd1ff20fe'
|
||||
# config.pepper = 'dd02671a3d4beaecd81fa577583d0f3d0218432444e110bb35ee2f8c79ca53a2c4f9ed12aeb345549610439c367ce99dd5a4da13f949d4498ed9f9e4ec38546d'
|
||||
|
||||
# ==> Configuration for :confirmable
|
||||
# A period that the user is allowed to access the website even without
|
||||
# confirming his account. For instance, if set to 2.days, the user will be
|
||||
# able to access the website for two days without confirming his account,
|
||||
# confirming their account. For instance, if set to 2.days, the user will be
|
||||
# able to access the website for two days without confirming their account,
|
||||
# access will be blocked just in the third day. Default is 0.days, meaning
|
||||
# the user cannot access the website without confirming his account.
|
||||
# the user cannot access the website without confirming their account.
|
||||
# config.allow_unconfirmed_access_for = 2.days
|
||||
|
||||
# A period that the user is allowed to confirm their account before their
|
||||
@@ -119,8 +118,8 @@ Devise.setup do |config|
|
||||
|
||||
# If true, requires any email changes to be confirmed (exactly the same way as
|
||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||
# db field (see migrations). Until confirmed new email is stored in
|
||||
# unconfirmed email column, and copied to email column on successful confirmation.
|
||||
# db field (see migrations). Until confirmed, new email is stored in
|
||||
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||
config.reconfirmable = true
|
||||
|
||||
# Defines which key will be used when confirming an account
|
||||
@@ -134,11 +133,11 @@ Devise.setup do |config|
|
||||
# config.extend_remember_period = false
|
||||
|
||||
# Options to be passed to the created cookie. For instance, you can set
|
||||
# :secure => true in order to force SSL only cookies.
|
||||
# secure: true in order to force SSL only cookies.
|
||||
# config.rememberable_options = {}
|
||||
|
||||
# ==> Configuration for :validatable
|
||||
# Range for password length. Default is 8..128.
|
||||
# Range for password length.
|
||||
config.password_length = 8..128
|
||||
|
||||
# Email regex used to validate email formats. It simply asserts that
|
||||
@@ -177,6 +176,9 @@ Devise.setup do |config|
|
||||
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
||||
# config.unlock_in = 1.hour
|
||||
|
||||
# Warn on the last attempt before the account is locked.
|
||||
# config.last_attempt_warning = false
|
||||
|
||||
# ==> Configuration for :recoverable
|
||||
#
|
||||
# Defines which key will be used when recovering the password for an account
|
||||
@@ -197,10 +199,6 @@ Devise.setup do |config|
|
||||
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
||||
# config.encryptor = :sha512
|
||||
|
||||
# ==> Configuration for :token_authenticatable
|
||||
# Defines name of the authentication token params key
|
||||
# config.token_authentication_key = :auth_token
|
||||
|
||||
# ==> Scopes configuration
|
||||
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||
@@ -227,12 +225,12 @@ Devise.setup do |config|
|
||||
# config.navigational_formats = ['*/*', :html]
|
||||
|
||||
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||
config.sign_out_via = :delete
|
||||
config.sign_out_via = [:get, :delete]
|
||||
|
||||
# ==> OmniAuth
|
||||
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||
# up on your models and hooks.
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||
|
||||
# ==> Warden configuration
|
||||
# If you want to use other strategies, that are not supported by Devise, or
|
||||
@@ -240,7 +238,7 @@ Devise.setup do |config|
|
||||
#
|
||||
# config.warden do |manager|
|
||||
# manager.intercept_401 = false
|
||||
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
||||
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||
# end
|
||||
|
||||
# ==> Mountable engine configurations
|
||||
@@ -257,4 +255,3 @@ Devise.setup do |config|
|
||||
# so you need to do it manually. For the users scope, it would be:
|
||||
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
||||
end
|
||||
=end
|
||||
@@ -2,7 +2,7 @@ Rails.application.routes.draw do
|
||||
|
||||
devise_for :users, :controllers => {:sessions => 'cmtool/sessions', :passwords => 'cmtool/passwords'}
|
||||
mount Cmtool::Engine => "/cmtool"
|
||||
match "/:name" => "pages#show"
|
||||
match "/*url" => "pages#not_found"
|
||||
get "/:name" => "pages#show"
|
||||
get "/*url" => "pages#not_found"
|
||||
root :to => 'pages#home'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user