initialize test framenwork and add form handlers for newsletter and contact forms

This commit is contained in:
2012-04-02 18:04:47 +02:00
parent 653275a0f8
commit 2ef63f0517
29 changed files with 993 additions and 55 deletions
+2
View File
@@ -30,6 +30,8 @@ end
group :test do
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'capybara'
end
group :development do
gem 'ruby-debug19', :require => 'ruby-debug'
+62 -35
View File
@@ -1,15 +1,15 @@
GIT
remote: git://github.com/bterkuile/couch_potato.git
revision: 11a7c6edf216a2460e2f8775d52e799662b3d9d1
revision: 2f0252bc1b93675ccc4f0ff6a193c2acff59bc2e
specs:
couch_potato (0.5.7)
couch_potato (0.6.0)
activemodel
couchrest (>= 1.0.1)
json
json (~> 1.6.0)
GIT
remote: git://github.com/bterkuile/simply_stored.git
revision: a49f8044be2ad4d587e73d53bff9ffbe4aa6d7e3
revision: abe990e1d97763ef90d3ff010d449bf2adf5a227
specs:
simply_stored (0.5.4)
activesupport
@@ -35,31 +35,31 @@ PATH
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
actionpack (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
actionmailer (3.2.3)
actionpack (= 3.2.3)
mail (~> 2.4.4)
actionpack (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.2)
activesupport (= 3.2.2)
activemodel (3.2.3)
activesupport (= 3.2.3)
builder (~> 3.0.0)
activerecord (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activerecord (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activesupport (3.2.2)
activeresource (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
archive-tar-minitar (0.5.2)
@@ -68,6 +68,15 @@ GEM
bourbon (1.4.0)
sass (>= 3.1)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.3.1)
ffi (~> 1.0.6)
cocaine (0.2.1)
coffee-script (2.2.0)
coffee-script-source
@@ -91,6 +100,12 @@ GEM
erubis (2.7.0)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (3.0.0)
activesupport (>= 3.0.0)
factory_girl_rails (3.0.0)
factory_girl (~> 3.0.0)
railties (>= 3.0.0)
ffi (1.0.11)
haml (3.1.4)
haml-rails (0.3.4)
actionpack (~> 3.0)
@@ -103,7 +118,7 @@ GEM
jquery-rails (2.0.1)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.5)
json (1.6.6)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.4.4)
@@ -112,10 +127,12 @@ GEM
treetop (~> 1.4.8)
mime-types (1.18)
multi_json (1.0.4)
orm_adapter (0.0.6)
paperclip (2.7.0)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
nokogiri (1.5.2)
orm_adapter (0.0.7)
paperclip (3.0.1)
activemodel (>= 3.0.0)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (>= 0.0.2)
mime-types
polyglot (0.3.3)
@@ -126,17 +143,17 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.2)
actionmailer (= 3.2.2)
actionpack (= 3.2.2)
activerecord (= 3.2.2)
activeresource (= 3.2.2)
activesupport (= 3.2.2)
rails (3.2.3)
actionmailer (= 3.2.3)
actionpack (= 3.2.3)
activerecord (= 3.2.3)
activeresource (= 3.2.3)
activesupport (= 3.2.3)
bundler (~> 1.0)
railties (= 3.2.2)
railties (3.2.2)
actionpack (= 3.2.2)
activesupport (= 3.2.2)
railties (= 3.2.3)
railties (3.2.3)
actionpack (= 3.2.3)
activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@@ -169,11 +186,17 @@ GEM
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.6.1)
sass (3.1.15)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.20.0)
childprocess (>= 0.2.5)
ffi (~> 1.0)
multi_json (~> 1.0)
rubyzip
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
@@ -188,18 +211,22 @@ GEM
tzinfo (0.3.32)
warden (1.1.1)
rack (>= 1.0)
xpath (0.1.4)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
bourbon
capybara
cmtool!
coffee-script
couch_potato!
devise
devise_simply_stored
email_validator
factory_girl_rails
haml-rails
jquery-rails
paperclip
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

+186
View File
@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="400px"
height="400px"
viewBox="0 0 400 400"
enable-background="new 0 0 400 400"
xml:space="preserve"
id="svg2"
inkscape:version="0.48.2 r9819"
sodipodi:docname="LOGO Companytools.svg"><metadata
id="metadata70"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs68"><inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 200 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="400 : 200 : 1"
inkscape:persp3d-origin="200 : 133.33333 : 1"
id="perspective72" />
<linearGradient
id="SVGID_1_"
gradientUnits="userSpaceOnUse"
x1="199.9995"
y1="194.5112"
x2="199.9995"
y2="157.0262">
<stop
offset="0"
style="stop-color:#B5B5B5"
id="stop10" />
<stop
offset="1"
style="stop-color:#FFFFFF"
id="stop12" />
</linearGradient>
<linearGradient
id="SVGID_2_"
gradientUnits="userSpaceOnUse"
x1="200.0005"
y1="225.8867"
x2="200.0005"
y2="165.356">
<stop
offset="0"
style="stop-color:#C9C9C9"
id="stop17" />
<stop
offset="0.3768"
style="stop-color:#ABABAB"
id="stop19" />
<stop
offset="0.7626"
style="stop-color:#939393"
id="stop21" />
<stop
offset="1"
style="stop-color:#8A8A8A"
id="stop23" />
</linearGradient>
<linearGradient
id="SVGID_3_"
gradientUnits="userSpaceOnUse"
x1="83.953598"
y1="194.42039"
x2="83.953598"
y2="157.026">
<stop
offset="0"
style="stop-color:#005BA6"
id="stop30" />
<stop
offset="1"
style="stop-color:#B8EFFF"
id="stop32" />
</linearGradient>
<linearGradient
id="SVGID_4_"
gradientUnits="userSpaceOnUse"
x1="83.375"
y1="225.8867"
x2="83.375"
y2="165.0788">
<stop
offset="0"
style="stop-color:#0086E6"
id="stop37" />
<stop
offset="0.3196"
style="stop-color:#0063B4"
id="stop39" />
<stop
offset="0.6182"
style="stop-color:#00478C"
id="stop41" />
<stop
offset="0.8549"
style="stop-color:#003674"
id="stop43" />
<stop
offset="1"
style="stop-color:#00306B"
id="stop45" />
</linearGradient>
</defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1436"
inkscape:window-height="856"
id="namedview66"
showgrid="false"
inkscape:zoom="1.668772"
inkscape:cx="80.064443"
inkscape:cy="189.85368"
inkscape:window-x="4"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<g
id="g49"
style="fill:#ddddff;fill-opacity:1">
<path
style="fill:#ddddff;fill-opacity:1"
inkscape:connector-curvature="0"
id="path51"
d="m 81.585,203.606 c 1.455,-0.61 2.27,-1.241 2.27,-1.241 l -0.208,-0.829 c -0.673,-0.183 -1.972,-0.14 -2.483,-0.113 -0.072,-0.255 -0.152,-0.506 -0.239,-0.751 1.172,-0.883 1.76,-1.624 1.76,-1.624 l -0.414,-0.752 c -0.617,-0.019 -1.658,0.242 -2.236,0.404 -0.157,-0.281 -0.325,-0.557 -0.501,-0.822 0.943,-1.107 1.354,-1.959 1.354,-1.959 l -0.565,-0.695 c -0.65,0.102 -1.706,0.619 -2.208,0.881 -0.191,-0.199 -0.387,-0.393 -0.59,-0.578 0.646,-1.293 0.84,-2.212 0.84,-2.212 l -0.715,-0.54 c -0.603,0.252 -1.497,0.998 -1.925,1.374 -0.247,-0.156 -0.499,-0.304 -0.756,-0.443 0.311,-1.405 0.277,-2.339 0.277,-2.339 l -0.825,-0.352 c -0.52,0.389 -1.202,1.32 -1.529,1.793 -0.282,-0.094 -0.567,-0.178 -0.856,-0.251 -0.041,-1.433 -0.3,-2.327 -0.3,-2.327 l -0.885,-0.141 c -0.41,0.504 -0.843,1.57 -1.047,2.107 -0.295,-0.021 -0.592,-0.031 -0.892,-0.031 -0.388,-1.381 -0.856,-2.186 -0.856,-2.186 l -0.893,0.08 c -0.276,0.59 -0.438,1.736 -0.504,2.305 -0.1,0.019 -0.2,0.037 -0.3,0.058 -0.19,0.039 -0.377,0.081 -0.563,0.128 -0.713,-1.25 -1.365,-1.919 -1.365,-1.919 l -0.847,0.294 c -0.125,0.642 -0.002,1.801 0.072,2.365 -0.269,0.121 -0.532,0.25 -0.789,0.389 -0.998,-1.043 -1.796,-1.536 -1.796,-1.536 l -0.75,0.49 c 0.035,0.659 0.442,1.767 0.649,2.292 -0.228,0.18 -0.448,0.368 -0.662,0.562 -1.228,-0.776 -2.129,-1.062 -2.129,-1.062 l -0.609,0.657 c 0.196,0.64 0.875,1.632 1.199,2.083 -0.173,0.227 -0.339,0.459 -0.497,0.697 -1.392,-0.463 -2.345,-0.523 -2.345,-0.523 l -0.431,0.787 c 0.349,0.58 1.269,1.391 1.685,1.744 -0.111,0.258 -0.214,0.518 -0.309,0.783 -1.474,-0.113 -2.422,0.061 -2.422,0.061 l -0.228,0.867 c 0.487,0.484 1.599,1.058 2.078,1.293 -0.044,0.271 -0.08,0.545 -0.106,0.82 -1.471,0.248 -2.357,0.652 -2.357,0.652 l -0.01,0.896 c 0.6,0.357 1.849,0.646 2.355,0.754 0.023,0.27 0.055,0.538 0.095,0.807 -1.382,0.602 -2.153,1.215 -2.153,1.215 l 0.208,0.873 c 0.679,0.204 1.991,0.178 2.491,0.16 0.087,0.256 0.182,0.508 0.285,0.754 -1.258,0.869 -1.9,1.624 -1.9,1.624 l 0.385,0.766 c 0.747,0.047 2.129,-0.296 2.548,-0.405 0.123,0.191 0.249,0.379 0.381,0.562 -1.028,1.141 -1.474,2.031 -1.474,2.031 l 0.569,0.653 c 0.738,-0.124 1.998,-0.769 2.381,-0.972 0.165,0.16 0.334,0.317 0.507,0.469 -0.711,1.33 -0.92,2.288 -0.92,2.288 l 0.718,0.502 c 0.667,-0.278 1.688,-1.142 2.045,-1.452 0.208,0.124 0.419,0.242 0.634,0.354 -0.347,1.423 -0.311,2.376 -0.311,2.376 l 0.826,0.321 c 0.557,-0.405 1.298,-1.404 1.595,-1.821 0.259,0.08 0.521,0.153 0.785,0.218 0.03,1.421 0.3,2.308 0.3,2.308 l 0.888,0.119 c 0.427,-0.505 0.882,-1.594 1.075,-2.088 0.284,0.018 0.568,0.024 0.854,0.023 0.39,1.345 0.872,2.127 0.872,2.127 l 0.895,-0.09 c 0.287,-0.588 0.452,-1.742 0.515,-2.264 0.052,-0.01 0.104,-0.021 0.156,-0.031 0.228,-0.047 0.454,-0.1 0.677,-0.156 0.725,1.215 1.397,1.861 1.397,1.861 l 0.849,-0.293 c 0.133,-0.649 -0.011,-1.846 -0.082,-2.344 0.249,-0.115 0.492,-0.238 0.731,-0.368 1.032,1.028 1.871,1.509 1.871,1.509 l 0.752,-0.48 c -0.038,-0.692 -0.529,-1.9 -0.706,-2.312 0.198,-0.16 0.391,-0.326 0.578,-0.498 1.303,0.787 2.276,1.066 2.276,1.066 l 0.611,-0.638 c -0.229,-0.71 -1.121,-1.871 -1.33,-2.138 0.142,-0.188 0.278,-0.379 0.409,-0.572 1.513,0.482 2.569,0.529 2.569,0.529 l 0.433,-0.758 c -0.436,-0.682 -1.757,-1.693 -1.888,-1.793 0.089,-0.203 0.173,-0.408 0.251,-0.615 1.624,0.123 2.687,-0.08 2.687,-0.08 l 0.229,-0.832 c -0.605,-0.564 -2.182,-1.246 -2.301,-1.297 0.04,-0.217 0.074,-0.434 0.102,-0.651 1.609,-0.257 2.589,-0.697 2.589,-0.697 l 0.011,-0.856 c -0.674,-0.371 -2.169,-0.65 -2.51,-0.71 -0.01,-0.231 -0.028,-0.462 -0.052,-0.694 z m -3.204,-1.449 -4.488,0.91 c -0.603,-1.641 -1.97,-2.846 -3.601,-3.282 l 0.497,-4.554 c 3.549,0.685 6.546,3.303 7.592,6.926 z m -8.064,2.457 c 0.155,0.766 -0.34,1.514 -1.106,1.67 -0.766,0.154 -1.513,-0.341 -1.668,-1.105 -0.155,-0.768 0.339,-1.514 1.106,-1.67 0.766,-0.155 1.513,0.34 1.668,1.105 z m -3.343,-9.361 c 0.745,-0.151 1.488,-0.213 2.217,-0.195 l -0.497,4.555 c -0.27,0.012 -0.542,0.045 -0.815,0.102 -1.452,0.293 -2.642,1.156 -3.388,2.31 l -4.174,-1.885 c 1.347,-2.438 3.714,-4.289 6.657,-4.887 z m -7.318,6.351 4.175,1.887 c -0.214,0.775 -0.255,1.613 -0.083,2.457 0.176,0.865 0.554,1.639 1.075,2.279 l -3.086,3.383 c -1.201,-1.285 -2.073,-2.907 -2.449,-4.758 -0.37,-1.816 -0.212,-3.619 0.368,-5.248 z m 11.231,12.936 c -2.909,0.59 -5.779,-0.169 -7.96,-1.848 l 3.088,-3.385 c 1.127,0.745 2.539,1.062 3.968,0.771 0.289,-0.059 0.566,-0.14 0.833,-0.241 l 2.259,3.985 c -0.685,0.318 -1.417,0.561 -2.188,0.718 z m 3.586,-1.511 -2.259,-3.986 c 1.31,-1.038 2.084,-2.668 2,-4.397 l 4.488,-0.912 c 0.445,3.718 -1.267,7.275 -4.229,9.295 z" />
<path
style="fill:#ddddff;fill-opacity:1"
inkscape:connector-curvature="0"
id="path53"
d="m 107.645,192.421 c 1.335,-0.789 2.044,-1.512 2.044,-1.512 l -0.312,-0.779 c -0.682,-0.088 -1.939,0.127 -2.434,0.221 -0.104,-0.238 -0.215,-0.471 -0.332,-0.699 1.023,-1.016 1.496,-1.814 1.496,-1.814 l -0.502,-0.678 c -0.604,0.064 -1.583,0.457 -2.125,0.691 -0.189,-0.254 -0.39,-0.498 -0.598,-0.734 0.771,-1.202 1.058,-2.087 1.058,-2.087 l -0.644,-0.602 c -0.619,0.187 -1.578,0.831 -2.033,1.151 -0.211,-0.168 -0.429,-0.329 -0.65,-0.482 0.456,-1.346 0.522,-2.267 0.522,-2.267 l -0.768,-0.431 c -0.554,0.326 -1.323,1.172 -1.691,1.596 -0.261,-0.119 -0.526,-0.229 -0.796,-0.331 0.115,-1.409 -0.042,-2.315 -0.042,-2.315 l -0.85,-0.231 c -0.454,0.448 -0.994,1.447 -1.249,1.95 -0.287,-0.054 -0.576,-0.097 -0.867,-0.13 -0.23,-1.39 -0.603,-2.226 -0.603,-2.226 l -0.88,-0.019 c -0.332,0.544 -0.612,1.641 -0.738,2.192 -0.291,0.019 -0.581,0.048 -0.873,0.088 -0.561,-1.292 -1.125,-2.013 -1.125,-2.013 l -0.858,0.196 c -0.19,0.61 -0.194,1.749 -0.183,2.312 -0.096,0.031 -0.19,0.063 -0.285,0.097 -0.18,0.062 -0.357,0.129 -0.531,0.199 -0.861,-1.121 -1.586,-1.687 -1.586,-1.687 l -0.785,0.399 c -0.037,0.642 0.238,1.754 0.385,2.294 -0.244,0.153 -0.483,0.314 -0.715,0.482 -1.11,-0.882 -1.954,-1.256 -1.954,-1.256 l -0.665,0.578 c 0.122,0.637 0.667,1.662 0.939,2.145 -0.197,0.207 -0.387,0.419 -0.569,0.637 -1.3,-0.592 -2.215,-0.751 -2.215,-0.751 l -0.505,0.722 c 0.276,0.596 1.07,1.473 1.445,1.869 -0.139,0.243 -0.269,0.491 -0.391,0.744 -1.417,-0.265 -2.353,-0.195 -2.353,-0.195 l -0.314,0.822 c 0.417,0.518 1.422,1.186 1.874,1.473 -0.074,0.266 -0.139,0.533 -0.196,0.805 -1.45,0.086 -2.35,0.383 -2.35,0.383 l -0.105,0.875 c 0.538,0.406 1.698,0.816 2.195,0.98 -0.007,0.271 -0.005,0.543 0.006,0.814 -1.398,0.438 -2.208,0.949 -2.208,0.949 l 0.109,0.873 c 0.631,0.27 1.887,0.385 2.395,0.421 0.058,0.259 0.125,0.516 0.2,0.772 -1.266,0.77 -1.934,1.471 -1.934,1.471 l 0.319,0.82 c 0.688,0.109 1.961,-0.091 2.447,-0.176 0.119,0.237 0.245,0.471 0.377,0.697 -1.109,1.014 -1.634,1.834 -1.634,1.834 l 0.478,0.695 c 0.732,-0.055 2.033,-0.573 2.426,-0.736 0.145,0.17 0.292,0.336 0.446,0.497 -0.849,1.247 -1.163,2.175 -1.163,2.175 l 0.641,0.561 c 0.702,-0.221 1.843,-1.016 2.188,-1.264 0.183,0.134 0.368,0.264 0.557,0.387 -0.515,1.391 -0.591,2.352 -0.591,2.352 l 0.767,0.393 c 0.612,-0.36 1.491,-1.336 1.798,-1.688 0.219,0.094 0.44,0.181 0.664,0.262 -0.148,1.432 0.014,2.354 0.014,2.354 l 0.848,0.202 c 0.488,-0.469 1.076,-1.54 1.311,-1.986 0.263,0.044 0.527,0.08 0.793,0.108 0.219,1.379 0.601,2.206 0.601,2.206 l 0.88,-0.001 c 0.35,-0.55 0.646,-1.671 0.768,-2.177 0.279,-0.021 0.557,-0.053 0.836,-0.094 0.559,1.259 1.133,1.956 1.133,1.956 l 0.859,-0.207 c 0.201,-0.61 0.207,-1.757 0.198,-2.273 0.05,-0.017 0.099,-0.033 0.147,-0.05 0.217,-0.076 0.43,-0.157 0.639,-0.243 0.868,1.086 1.609,1.626 1.609,1.626 l 0.787,-0.4 c 0.043,-0.648 -0.257,-1.795 -0.393,-2.27 0.228,-0.146 0.448,-0.297 0.664,-0.457 1.142,0.865 2.021,1.221 2.021,1.221 l 0.669,-0.568 c -0.129,-0.67 -0.771,-1.78 -0.996,-2.158 0.171,-0.182 0.337,-0.37 0.496,-0.562 1.374,0.593 2.359,0.734 2.359,0.734 l 0.509,-0.701 c -0.317,-0.66 -1.34,-1.673 -1.58,-1.904 0.113,-0.201 0.221,-0.404 0.322,-0.611 1.537,0.268 2.572,0.172 2.572,0.172 l 0.32,-0.795 c -0.516,-0.607 -1.937,-1.416 -2.077,-1.495 0.06,-0.209 0.114,-0.419 0.162,-0.633 1.599,-0.096 2.606,-0.436 2.606,-0.436 l 0.111,-0.841 c -0.666,-0.469 -2.291,-0.922 -2.414,-0.956 0.01,-0.215 0.014,-0.431 0.012,-0.647 1.533,-0.465 2.428,-1.024 2.428,-1.024 l -0.104,-0.835 c -0.707,-0.272 -2.199,-0.344 -2.539,-0.357 -0.043,-0.224 -0.092,-0.446 -0.145,-0.669 z m -10.997,6.244 c -1.821,0.637 -3.814,-0.324 -4.452,-2.145 -0.637,-1.822 0.324,-3.814 2.145,-4.452 1.822,-0.638 3.815,0.323 4.453,2.145 0.637,1.821 -0.324,3.815 -2.146,4.452 z" />
<g
id="g55"
style="fill:#ddddff;fill-opacity:1">
<path
style="fill:#ddddff;fill-opacity:1"
inkscape:connector-curvature="0"
id="path57"
d="m 86.155,174.878 c 1.377,-0.712 2.125,-1.394 2.125,-1.394 l -0.27,-0.795 c -0.674,-0.126 -1.942,0.018 -2.441,0.083 -0.09,-0.243 -0.188,-0.482 -0.292,-0.716 1.08,-0.957 1.596,-1.729 1.596,-1.729 l -0.464,-0.705 c -0.606,0.031 -1.605,0.368 -2.159,0.571 -0.176,-0.264 -0.362,-0.519 -0.556,-0.766 0.836,-1.158 1.173,-2.024 1.173,-2.024 l -0.608,-0.637 c -0.629,0.151 -1.623,0.741 -2.094,1.036 -0.203,-0.179 -0.411,-0.353 -0.624,-0.519 0.531,-1.317 0.649,-2.234 0.649,-2.234 l -0.742,-0.473 c -0.571,0.295 -1.388,1.096 -1.779,1.498 -0.254,-0.133 -0.512,-0.259 -0.774,-0.375 0.194,-1.401 0.087,-2.313 0.087,-2.313 l -0.836,-0.279 c -0.479,0.422 -1.073,1.389 -1.356,1.876 -0.283,-0.069 -0.569,-0.128 -0.858,-0.178 -0.152,-1.4 -0.477,-2.256 -0.477,-2.256 l -0.878,-0.067 c -0.361,0.525 -0.703,1.604 -0.86,2.146 -0.291,0.003 -0.583,0.016 -0.875,0.039 -0.488,-1.321 -1.011,-2.073 -1.011,-2.073 l -0.868,0.148 c -0.224,0.6 -0.292,1.736 -0.312,2.298 -0.097,0.025 -0.193,0.052 -0.29,0.08 -0.183,0.053 -0.364,0.109 -0.542,0.169 -0.796,-1.168 -1.488,-1.772 -1.488,-1.772 l -0.806,0.354 c -0.072,0.638 0.14,1.765 0.256,2.312 -0.253,0.14 -0.501,0.287 -0.742,0.442 -1.059,-0.943 -1.879,-1.363 -1.879,-1.363 l -0.696,0.539 c 0.085,0.643 0.572,1.696 0.816,2.194 -0.208,0.195 -0.41,0.396 -0.604,0.604 -1.265,-0.664 -2.17,-0.874 -2.17,-0.874 l -0.544,0.692 c 0.242,0.611 0.986,1.53 1.338,1.947 -0.152,0.235 -0.296,0.476 -0.432,0.72 -1.4,-0.343 -2.338,-0.326 -2.338,-0.326 l -0.36,0.803 c 0.388,0.541 1.353,1.264 1.788,1.576 -0.088,0.261 -0.169,0.525 -0.24,0.792 -1.453,0.004 -2.368,0.251 -2.368,0.251 l -0.154,0.867 c 0.514,0.436 1.649,0.91 2.137,1.103 -0.022,0.27 -0.035,0.54 -0.04,0.812 -1.421,0.358 -2.258,0.824 -2.258,0.824 l 0.061,0.878 c 0.616,0.303 1.863,0.489 2.367,0.554 0.043,0.26 0.096,0.521 0.156,0.782 -1.307,0.697 -2.014,1.359 -2.014,1.359 l 0.272,0.838 c 0.681,0.146 1.964,0.018 2.453,-0.039 0.105,0.244 0.218,0.482 0.338,0.717 -1.164,0.95 -1.734,1.74 -1.734,1.74 l 0.438,0.721 c 0.734,-0.014 2.062,-0.458 2.464,-0.598 0.134,0.178 0.274,0.351 0.417,0.52 -0.917,1.199 -1.283,2.107 -1.283,2.107 l 0.608,0.595 c 0.713,-0.181 1.896,-0.911 2.256,-1.14 0.175,0.145 0.353,0.284 0.534,0.418 -0.592,1.36 -0.722,2.315 -0.722,2.315 l 0.744,0.435 c 0.631,-0.326 1.563,-1.25 1.889,-1.584 0.213,0.105 0.429,0.205 0.648,0.299 -0.229,1.421 -0.118,2.351 -0.118,2.351 l 0.835,0.251 c 0.514,-0.441 1.161,-1.479 1.419,-1.91 0.26,0.059 0.522,0.109 0.786,0.152 0.142,1.389 0.476,2.236 0.476,2.236 l 0.878,0.048 c 0.379,-0.529 0.739,-1.632 0.889,-2.13 0.279,-0.006 0.558,-0.021 0.839,-0.047 0.488,1.288 1.021,2.016 1.021,2.016 l 0.87,-0.158 c 0.235,-0.598 0.306,-1.742 0.326,-2.258 0.05,-0.014 0.1,-0.027 0.15,-0.042 0.22,-0.063 0.437,-0.133 0.651,-0.207 0.806,1.134 1.516,1.714 1.516,1.714 l 0.809,-0.354 c 0.08,-0.647 -0.156,-1.807 -0.264,-2.29 0.235,-0.132 0.464,-0.271 0.688,-0.418 1.092,0.928 1.951,1.331 1.951,1.331 l 0.7,-0.529 c -0.092,-0.676 -0.669,-1.82 -0.874,-2.21 0.181,-0.173 0.356,-0.352 0.526,-0.533 1.338,0.668 2.314,0.865 2.314,0.865 l 0.548,-0.673 c -0.28,-0.677 -1.245,-1.745 -1.471,-1.989 0.124,-0.195 0.243,-0.393 0.356,-0.593 1.52,0.354 2.559,0.315 2.559,0.315 l 0.363,-0.775 c -0.48,-0.635 -1.854,-1.522 -1.99,-1.609 0.071,-0.205 0.137,-0.413 0.198,-0.622 1.601,-0.007 2.626,-0.29 2.626,-0.29 l 0.158,-0.833 c -0.639,-0.506 -2.235,-1.049 -2.356,-1.09 0.022,-0.214 0.038,-0.43 0.048,-0.646 1.557,-0.377 2.481,-0.887 2.481,-0.887 l -0.057,-0.839 c -0.689,-0.312 -2.177,-0.466 -2.515,-0.499 -0.03,-0.222 -0.067,-0.447 -0.108,-0.673 z m -10.554,10.749 c -4.584,0.931 -9.054,-2.032 -9.984,-6.616 -0.93,-4.583 2.032,-9.054 6.616,-9.984 4.584,-0.93 9.054,2.032 9.984,6.616 0.93,4.584 -2.032,9.053 -6.616,9.984 z" />
<circle
style="fill:#ddddff;fill-opacity:1"
sodipodi:ry="3.494"
sodipodi:rx="3.494"
sodipodi:cy="177.138"
sodipodi:cx="73.859001"
id="circle59"
r="3.494"
cy="177.138"
cx="73.859001" />
</g>
</g>
<g
id="gear">
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

@@ -60,7 +60,7 @@ body, html
#content
h2
margin: 10px 0
background-image: image-url("sessions/logo.png")
background-image: image-url("cmtool/logo.png")
background-repeat: no-repeat
background-position: right bottom
padding: 18px
@@ -1,6 +1,6 @@
module Cmtool
class ApplicationController < ::ApplicationController
before_filter :authenticate_user!, :set_locale
before_filter :authenticate_user!, :authorize_user, :check_environment, :set_locale
private
@@ -11,5 +11,15 @@ module Cmtool
I18n.locale = :en
end
end
def authorize_user
end
def check_environment
@cmtool_warnings ||= []
@cmtool_warnings << 'no_host_specified' unless ( Rails.application.config.action_mailer.default_url_options[:host] rescue false) ||
Rails.application.default_url_options[:host].present?
end
end
end
@@ -1,5 +1,7 @@
module Cmtool
class Cmtool::ContactFormsController < Cmtool::ApplicationController
skip_before_filter :authenticate_user!, :authorize_user, only: :add
# GET /contact_forms
# GET /contact_forms.xml
def index
@@ -81,5 +83,14 @@ module Cmtool
format.xml { head :ok }
end
end
def add
@contact_form = Cmtool::ContactForm.new(params[:contact_form])
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(', '))
end
end
end
end
@@ -1,5 +1,7 @@
module Cmtool
class Cmtool::NewsletterSubscriptionsController < Cmtool::ApplicationController
skip_before_filter :authenticate_user!, :authorize_user, only: :add
# GET /newsletter_subscriptions
# GET /newsletter_subscriptions.xml
def index
@@ -81,5 +83,14 @@ module Cmtool
format.xml { head :ok }
end
end
def add
@newsletter_subscription = Cmtool::NewsletterSubscription.new(params[:newsletter_subscription])
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
end
end
@@ -1,5 +1,5 @@
module Cmtool
class PasswordsController < Devise::PasswordsController
layout 'cmtool/application'
layout 'cmtool/sessions'
end
end
+4
View File
@@ -28,6 +28,10 @@ module Cmtool
end
alias are_you_sure? are_you_sure
def warnings
@cmtool_warnings
end
def boolean_text(yes)
yes.present? ? t('cmtool.general.yes') : t('cmtool.general.no')
end
+5 -3
View File
@@ -5,9 +5,11 @@ module Cmtool
property :file_file_name
property :file_content_type
property :file_file_size, :type => Fixnum
property :file_updated_at, :type => Time
has_attached_file :file, :styles => { :page => '675x10000>', :medium => "354x1000>", :thumb => "150x1250>" }
property :file_file_size, type: Fixnum
property :file_updated_at, type: Time
has_attached_file :file, styles: { page: '675x10000>', medium: "354x1000>", thumb: "150x1250>" },
path: ":rails_root/public/system/:attachment/:id/:style.:extension",
url: "/system/:attachment/:id/:style.:extension"
belongs_to :directory
@@ -8,3 +8,13 @@
.icon
.text
=raw flash[:notice]
- if warnings.any?
.message.warning.ui-state-highlight
.icon
.text
%ul
- for warning in warnings
- if warning.is_a?(Hash)
%li.warning= t("cmtool.warnings.#{warning.delete(:message)}", warning)
- else
%li.warning= t("cmtool.warnings.#{warning}")
@@ -26,7 +26,7 @@
%li{:class => controller_name == 'faqs' ? 'ui-state-active' : 'ui-state-default'}=link_to Cmtool::Faq.model_name.human_plural, cmtool.faqs_path
%li{:class => controller_name == 'quotes' ? 'ui-state-active' : 'ui-state-default'}=link_to Cmtool::Quote.model_name.human_plural, cmtool.quotes_path
%li{:class => %w[contact_forms demo_requests call_requests newsletter_subscriptions].include?(controller_name) ? ['ui-state-active', 'parent'] : ['ui-state-default', 'parent']}
%span.title Formulieren
%span.title= t('cmtool.menu.forms.title')
%ul.child-menu
%li{:class => controller_name == 'contact_forms' ? 'ui-state-active' : 'ui-state-default'}=link_to Cmtool::ContactForm.model_name.human_plural, cmtool.contact_forms_path
%li{:class => controller_name == 'newsletter_subscriptions' ? 'ui-state-active' : 'ui-state-default'}=link_to Cmtool::NewsletterSubscription.model_name.human_plural, cmtool.newsletter_subscriptions_path
+11
View File
@@ -6,6 +6,9 @@ en:
are_you_sure: 'Are you sure?'
are_you_sure_with_name: 'Are you sure you want to delete %{model} %{name}?'
empty_result: No %{models} found
menu:
forms:
title: Form
action:
index:
title: List %{models}
@@ -30,6 +33,12 @@ en:
label: Add %{image}
news:
remove_image: Remove image
newsletter_subscription:
subscribed: You subscribed successfully to the newsletter
subscription_failed: 'There was a problem with your subscription<br/>%{reason}'
contact_form:
submitted: You successfully submitted the contact form
submission_failed: 'There was a problem with the contact form submission<br/>%{reason}'
quote:
remove_image: Remove image
sessions:
@@ -39,6 +48,8 @@ en:
errors:
form:
title: 'The action could not be completed because of %{count} reasons'
warnings:
no_host_specified: 'You did not specify a host in config/environments/:env (config.action_mailer.default_url_options = { :host => "example.com" })'
activemodel:
models:
page: Page
+6 -2
View File
@@ -26,8 +26,12 @@ Cmtool::Engine.routes.draw do
end
# ADMIN FORMS
resources :contact_forms
resources :newsletter_subscriptions
resources :contact_forms do
post :add
end
resources :newsletter_subscriptions do
post :add
end
# USER MANAGEMENT
resources :users
+8 -4
View File
@@ -2,12 +2,11 @@ module Cmtool
module Includes
module User
def self.included(klass)
klass.extend Devise::Models
klass.send :include, SimplyStored::Couch
klass.send :include, Devise::Orm::SimplyStored
klass.send :include, InstanceMethods
klass.send :extend, ClassMethods
klass.property :employee_email
klass.property :is_admin, type: :boolean
klass.property :active, type: :boolean, default: true
@@ -36,12 +35,17 @@ module Cmtool
end
def generate_password!
@password_haystack ||= (:a..:z).to_a + (:A..:Z).to_a + (0..9).to_a
@generated_password = @password_haystack.sample(8).join
@generated_password = self.class.password_haystack.sample(8).join
self.password = @generated_password
self.password_confirmation = @generated_password
end
end
module ClassMethods
def password_haystack
@password_haystack ||= (:a..:z).to_a + (:A..:Z).to_a + (0..9).to_a
end
end
end
end
end
+154
View File
@@ -0,0 +1,154 @@
require 'spec_helper'
describe Cmtool::FaqsController do
before :each do
sign_in @user
end
describe 'no user is signed in' do
before :each do
sign_out @user
end
it "should not allow acces when no user is logged in" do
faq = create :faq
get :index
response.should be_redirect
end
end
describe "GET index" do
it "assigns all faqs as @faqs" do
faq = create :faq
get :index
assigns(:faqs).should eq([faq])
end
end
describe "GET show" do
it "assigns the requested faq as @faq" do
faq = create :faq
get :show, :id => faq.id
assigns(:faq).should eq(faq)
end
end
describe "GET new" do
it "assigns a new faq as @faq" do
get :new
assigns(:faq).should be_a_new(Cmtool::Faq)
end
end
describe "GET edit" do
it "assigns the requested faq as @faq" do
faq = create :faq
get :edit, :id => faq.id
assigns(:faq).should eq(faq)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Cmtool::Faq" do
expect {
post :create, :faq => build(:faq).attributes
}.to change(Cmtool::Faq, :count).by(1)
end
it "assigns a newly created faq as @faq" do
post :create, :faq => build(:faq).attributes
assigns(:faq).should be_a(Cmtool::Faq)
assigns(:faq).should be_persisted
end
it "redirects to the faqs faq" do
post :create, :faq => build(:faq).attributes
response.should redirect_to(Cmtool::Faq.last)
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
describe "with valid params" do
it "updates the requested faq" do
faq = create(:faq)
# Assuming there are no other faqs in the database, this
# 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'}
end
it "assigns the requested faq as @faq" do
faq = create(:faq)
put :update, :id => faq.id, :faq => faq.attributes
assigns(:faq).should eq(faq)
end
it "redirects to the faq" do
faq = create(:faq)
put :update, :id => faq.id, :faq => faq.attributes
response.should redirect_to(faq)
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
it "destroys the requested faq" do
@request.env['HTTP_REFERER'] = faqs_path
faq = create(:faq)
expect {
delete :destroy, :id => faq.id
}.to change(Cmtool::Faq, :count).by(-1)
end
it "redirects to the faqs list" do
@request.env['HTTP_REFERER'] = faqs_path
faq = create(:faq)
delete :destroy, :id => faq.id
response.should redirect_to(faqs_path)
end
it "redirects to the faqs list when called from edit page" do
faq = create(:faq)
@request.env['HTTP_REFERER'] = edit_faq_path(faq)
delete :destroy, :id => faq.id
response.should redirect_to(faqs_path)
end
end
end
@@ -0,0 +1,161 @@
require 'spec_helper'
describe Cmtool::NewsletterSubscriptionsController do
before :each do
sign_in @user
end
describe 'no user is signed in' do
before :each do
sign_out @user
end
it "should not allow acces when no user is logged in" do
newsletter_subscription = create :newsletter_subscription
get :index
response.should be_redirect
end
it "should add a subscription without authentication" do
@request.env['HTTP_REFERER'] = '/'
expect {
post :add, newsletter_subscription: {email: "unauthenticated@example.com"}
}.to change(Cmtool::NewsletterSubscription, :count).by(1)
end
end
describe "GET index" do
it "assigns all newsletter_subscriptions as @newsletter_subscriptions" do
newsletter_subscription = create :newsletter_subscription
get :index
assigns(:newsletter_subscriptions).should eq([newsletter_subscription])
end
end
describe "GET show" do
it "assigns the requested newsletter_subscription as @newsletter_subscription" do
newsletter_subscription = create :newsletter_subscription
get :show, :id => newsletter_subscription.id
assigns(:newsletter_subscription).should eq(newsletter_subscription)
end
end
describe "GET new" do
it "assigns a new newsletter_subscription as @newsletter_subscription" do
get :new
assigns(:newsletter_subscription).should be_a_new(Cmtool::NewsletterSubscription)
end
end
describe "GET edit" do
it "assigns the requested newsletter_subscription as @newsletter_subscription" do
newsletter_subscription = create :newsletter_subscription
get :edit, :id => newsletter_subscription.id
assigns(:newsletter_subscription).should eq(newsletter_subscription)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Cmtool::NewsletterSubscription" do
expect {
post :create, :newsletter_subscription => build(:newsletter_subscription).attributes
}.to change(Cmtool::NewsletterSubscription, :count).by(1)
end
it "assigns a newly created newsletter_subscription as @newsletter_subscription" do
post :create, :newsletter_subscription => build(:newsletter_subscription).attributes
assigns(:newsletter_subscription).should be_a(Cmtool::NewsletterSubscription)
assigns(:newsletter_subscription).should be_persisted
end
it "redirects to the newsletter_subscriptions newsletter_subscription" do
post :create, :newsletter_subscription => build(:newsletter_subscription).attributes
response.should redirect_to(Cmtool::NewsletterSubscription.last)
end
end
describe "with invalid params" 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 => {}
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 => {}
response.should render_template("new")
end
end
end
describe "PUT update" do
describe "with valid params" do
it "updates the requested newsletter_subscription" do
newsletter_subscription = create(:newsletter_subscription)
# Assuming there are no other newsletter_subscriptions in the database, this
# 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'}
end
it "assigns the requested newsletter_subscription as @newsletter_subscription" do
newsletter_subscription = create(:newsletter_subscription)
put :update, :id => newsletter_subscription.id, :newsletter_subscription => newsletter_subscription.attributes
assigns(:newsletter_subscription).should eq(newsletter_subscription)
end
it "redirects to the newsletter_subscription" do
newsletter_subscription = create(:newsletter_subscription)
put :update, :id => newsletter_subscription.id, :newsletter_subscription => newsletter_subscription.attributes
response.should redirect_to(newsletter_subscription)
end
end
describe "with invalid params" do
it "assigns the newsletter_subscription as @newsletter_subscription" 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 => {}
assigns(:newsletter_subscription).should eq(newsletter_subscription)
end
it "re-renders the 'edit' template" 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 => {}
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested newsletter_subscription" do
@request.env['HTTP_REFERER'] = newsletter_subscriptions_path
newsletter_subscription = create(:newsletter_subscription)
expect {
delete :destroy, :id => newsletter_subscription.id
}.to change(Cmtool::NewsletterSubscription, :count).by(-1)
end
it "redirects to the newsletter_subscriptions list" do
@request.env['HTTP_REFERER'] = newsletter_subscriptions_path
newsletter_subscription = create(:newsletter_subscription)
delete :destroy, :id => newsletter_subscription.id
response.should redirect_to(newsletter_subscriptions_path)
end
it "redirects to the newsletter_subscriptions list when called from edit page" do
newsletter_subscription = create(:newsletter_subscription)
@request.env['HTTP_REFERER'] = edit_newsletter_subscription_path(newsletter_subscription)
delete :destroy, :id => newsletter_subscription.id
response.should redirect_to(newsletter_subscriptions_path)
end
end
end
Binary file not shown.
@@ -22,6 +22,8 @@ Dummy::Application.configure do
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
config.action_mailer.default_url_options = { :host => "http://localhost:3000" }
# Raise exception on mass assignment protection for Active Record models
# config.active_record.mass_assignment_sanitizer = :strict
+1 -1
View File
@@ -30,7 +30,7 @@ Dummy::Application.configure do
config.action_mailer.delivery_method = :test
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# config.active_record.mass_assignment_sanitizer = :strict
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
+223
View File
@@ -0,0 +1,223 @@
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"
# Automatically apply schema changes in tableless databases
config.apply_schema = false
# ==> ORM configuration
# 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/'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [ :email ]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [ :email ]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [ :email ]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Basic 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.
# config.http_authenticatable = false
# If http headers should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. "Application" by default.
# config.http_authentication_realm = "Application"
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# 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.
# 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
config.skip_session_storage = [:http_auth]
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
#
# 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.
config.stretches = Rails.env.test? ? 1 : 10
# Setup a pepper to generate the encrypted password.
# config.pepper = "4d61ec240ec1a40b14433880885d34d96c937689a2756f88a65895640e20e69275ec4252b6c4b2d34a6cad3368a9f04b25221d02d230163ae50b4ff7d6ac0257"
# ==> 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,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming his account.
# config.allow_unconfirmed_access_for = 2.days
# If true, requires any email changes to be confirmed (exctly 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.
config.reconfirmable = true
# Defines which key will be used when confirming an account
# config.confirmation_keys = [ :email ]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# If true, uses the password salt as remember token. This should be turned
# to false if you are not using database authenticatable.
config.use_salt_as_remember_token = true
# Options to be passed to the created cookie. For instance, you can set
# :secure => true in order to force SSL only cookies.
# config.cookie_options = {}
# ==> Configuration for :validatable
# Range for password length. Default is 6..128.
# config.password_length = 6..128
# Email regex used to validate email formats. It simply asserts that
# an one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
# config.email_regexp = /\A[^@]+@[^@]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [ :email ]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [ :email ]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 6.hours
# ==> Configuration for :encryptable
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
# REST_AUTH_SITE_KEY to pepper)
# 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
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Configure sign_out behavior.
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
# The default is true, which means any logout action will sign out all active scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ["*/*", :html]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :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'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
# end
end
+57
View File
@@ -0,0 +1,57 @@
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
en:
errors:
messages:
expired: "has expired, please request a new one"
not_found: "not found"
already_confirmed: "was already confirmed, please try signing in"
not_locked: "was not locked"
not_saved:
one: "1 error prohibited this %{resource} from being saved:"
other: "%{count} errors prohibited this %{resource} from being saved:"
devise:
failure:
already_authenticated: 'You are already signed in.'
unauthenticated: 'You need to sign in or sign up before continuing.'
unconfirmed: 'You have to confirm your account before continuing.'
locked: 'Your account is locked.'
invalid: 'Invalid email or password.'
invalid_token: 'Invalid authentication token.'
timeout: 'Your session expired, please sign in again to continue.'
inactive: 'Your account was not activated yet.'
sessions:
signed_in: 'Signed in successfully.'
signed_out: 'Signed out successfully.'
passwords:
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
updated: 'Your password was changed successfully. You are now signed in.'
updated_not_active: 'Your password was changed successfully.'
send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
confirmations:
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
confirmed: 'Your account was successfully confirmed. You are now signed in.'
registrations:
signed_up: 'Welcome! You have signed up successfully.'
signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
updated: 'You updated your account successfully.'
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
unlocks:
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
omniauth_callbacks:
success: 'Successfully authorized from %{kind} account.'
failure: 'Could not authorize you from %{kind} because "%{reason}".'
mailer:
confirmation_instructions:
subject: 'Confirmation instructions'
reset_password_instructions:
subject: 'Reset password instructions'
unlock_instructions:
subject: 'Unlock Instructions'
+1 -1
View File
@@ -1,8 +1,8 @@
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"
root :to => 'pages#home'
mount Cmtool::Engine => "/cmtool"
end
+4
View File
@@ -0,0 +1,4 @@
FactoryGirl.define do
factory :faq, class: Cmtool::Faq do
end
end
@@ -0,0 +1,6 @@
FactoryGirl.define do
factory :newsletter_subscription, class: Cmtool::NewsletterSubscription do
sequence(:created_at){|i| Time.zone.now + i.seconds} # ensure following created at
sequence(:email){ |i| "subscriber#{i}@example.com" }
end
end
+8
View File
@@ -0,0 +1,8 @@
FactoryGirl.define do
factory :user, class: User do
email 'utools-test@example.com'
password '12345'
is_admin true
active true
end
end
+46 -5
View File
@@ -1,14 +1,55 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'factory_girl'
require 'capybara/rspec'
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
Dir[File.join(ENGINE_RAILS_ROOT, "spec/factories/**/*.rb")].each {|f| require f }
I18n.locale = :en
Devise.stretches = 1
Capybara.default_driver = :selenium
RSpec.configure do |config|
config.mock_with :rspec
config.include FactoryGirl::Syntax::Methods
#config.include CompanyFactory
config.include Cmtool::Engine.routes.url_helpers
config.include Devise::TestHelpers, :type => :controller
#config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = true
config.render_views = true
config.before :each do
CouchPotato.couchrest_database.recreate!
@user = User.first || create(:user)
end
config.before :all, type: :controller do
#render_views
end
config.before :all do
end
config.before :each, type: :request do
#Capybara.current_driver = :selenium
sign_in_user_through_request
end
config.after :each, type: :request do
visit "/users/sign_out"
end
def sign_in_user_through_request
visit "/users/sign_in"
fill_in 'user[email]', with: @user.email
fill_in 'user[password]', with: @user.password
click_on 'Sign in'
end
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
@@ -18,12 +59,12 @@ RSpec.configure do |config|
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
#config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
#config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of