From 7591abd33b6e55b2ade1f7ef5001994cb0d491db Mon Sep 17 00:00:00 2001 From: Dreedle Date: Mon, 28 Mar 2016 13:45:05 -0700 Subject: [PATCH 01/27] Addin gpry --- Gemfile | 1 + Gemfile.lock | 17 ++++++++++++++++- app/controllers/admin/categories_controller.rb | 13 ++++++++----- db/db_development | Bin 0 -> 159744 bytes db/db_test | Bin 0 -> 176128 bytes features/create_category.feature | 17 +++++++++++++++++ features/edit_category.feature | 0 features/support/paths.rb | 3 +++ public/javascripts/ckeditor/config.bak | 2 +- public/javascripts/ckeditor/config.js | 2 +- 10 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 db/db_development create mode 100644 db/db_test create mode 100644 features/create_category.feature create mode 100644 features/edit_category.feature mode change 100644 => 100755 public/javascripts/ckeditor/config.bak mode change 100644 => 100755 public/javascripts/ckeditor/config.js diff --git a/Gemfile b/Gemfile index b8121c7ee5..771ddb6ce7 100644 --- a/Gemfile +++ b/Gemfile @@ -57,4 +57,5 @@ group :development, :test do gem 'cucumber-rails-training-wheels' gem 'database_cleaner' gem 'capybara' + gem 'pry' end diff --git a/Gemfile.lock b/Gemfile.lock index 64eb36cc1c..26794b0ec3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: RedCloth (4.2.9) abstract (1.0.0) @@ -87,6 +87,8 @@ GEM i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) + method_source (0.6.7) + ruby_parser (>= 2.3.1) mime-types (1.19) mini_magick (1.3.3) subexec (~> 0.0.4) @@ -94,6 +96,11 @@ GEM nokogiri (1.5.5) pg (0.14.1) polyglot (0.3.3) + pry (0.9.7.4) + coderay (~> 0.9.8) + method_source (~> 0.6.7) + ruby_parser (>= 2.3.1) + slop (~> 2.1.0) rack (1.2.5) rack-mount (0.6.14) rack (>= 1.0.0) @@ -141,6 +148,8 @@ GEM ruby-debug-base19 (>= 0.11.19) ruby_core_source (0.1.5) archive-tar-minitar (>= 0.5.2) + ruby_parser (3.8.1) + sexp_processor (~> 4.1) rubypants (0.2.0) rubyzip (0.9.9) selenium-webdriver (2.25.0) @@ -148,10 +157,12 @@ GEM libwebsocket (~> 0.1.3) multi_json (~> 1.0) rubyzip + sexp_processor (4.7.0) simplecov (0.6.4) multi_json (~> 1.0) simplecov-html (~> 0.5.3) simplecov-html (0.5.3) + slop (2.1.0) sqlite3 (1.3.6) subexec (0.0.4) thin (1.5.0) @@ -193,6 +204,7 @@ DEPENDENCIES kaminari mini_magick (~> 1.3.3) pg + pry rails (~> 3.0.10) rake (~> 0.9.2) recaptcha @@ -205,3 +217,6 @@ DEPENDENCIES thin uuidtools (~> 2.1.1) webrat + +BUNDLED WITH + 1.11.2 diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index b7026f8f29..e148bcd380 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -1,13 +1,14 @@ class Admin::CategoriesController < Admin::BaseController cache_sweeper :blog_sweeper + require 'pry' def index; redirect_to :action => 'new' ; end def edit; new_or_edit; end - def new + def new respond_to do |format| format.html { new_or_edit } - format.js { + format.js { @category = Category.new } end @@ -25,12 +26,14 @@ def destroy def new_or_edit @categories = Category.find(:all) - @category = Category.find(params[:id]) - @category.attributes = params[:category] + binding.pry + @category = Category.find(params[:id]) + @category.attributes = params[:category] + if request.post? respond_to do |format| format.html { save_category } - format.js do + format.js do @category.save @article = Article.new @article.categories << @category diff --git a/db/db_development b/db/db_development new file mode 100644 index 0000000000000000000000000000000000000000..a9c7606a8dfa28e3ced5c5857990129376916394 GIT binary patch literal 159744 zcmeI53ve6Bd7v>s4?uvNX;KmeaVai`;BqNgOOXIbg49YYbG2NpcJ&tNm9nzo0Wc(H z1z@0=fh5{x`#^1cb}l(zUgb(smvZhZmALAhN9B2TIakihNjW}WD$XT!j#F_qm6wya z;?%mzw|ABMyJrT#5a6x^@0OQ)KP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VIF~kN^@u0!RP}AOR$R1dsp{KmvP! G!2bhsUJ&{K literal 0 HcmV?d00001 diff --git a/db/db_test b/db/db_test new file mode 100644 index 0000000000000000000000000000000000000000..483a1e1710cdf278bde9c98d22d6b589e9e9b08a GIT binary patch literal 176128 zcmeI54{#gVecyM11wnw=T~QK+(@_+c9Ys+T#ea8a+yYn< zE8^c_7yKjJ=RkLE&$Z*&j^jz=#C0-m?T#C}iQTx3(@fHO>efzNw`0eyQ_t8#no>f# znuu$~+sDS{#z*JJrTNiI)8kTau~)BjrdJL3N>elQ;}hd^((K&Swb8j{>FM!hY4q0o z^{E*Mdu@DXUYfZM|F@>6ACr1RiMX!B^#BQ|!seQig1z}@i+4Npqh|ZLb8M!YW-ysb ztg2B(3#8Pwh_01=?I_J=nJ>v{ZdY*%Bw-R+@jgf9)Dg42tBbwcRg!Ez#-r5}+7*ka z98{vc(uSN0MdZ{Ox7X`{EXCE35|?92g-0wAP6L2mNmsUXM`rl2+1}H`-t}kmnb7or zzMWLGWMS(_SzZesyUK0VJS7!q@liFtUXk0dqJ>gwk~FANKS!+HY`-EL>^ zc4k45l<0x&Wq63kuE-RnR@A1`smi(yr4(6L!U0+DmBO&4t1-o)iNK?;jEB6Y1VVBs z0u3Ih5cbKPU5Bbt+40W@$x+$yAjPBg=*Vz_+1>}KUe8k5Ii@Hbv5e5pLA&Bq*@7II zY2Iu_?!Bz4iaLzV2#g_u z2{{FUa#<(>TXdijlhw+;rCNWZCU?>wbdj@5Fq&AS-N}we?!1#s2cxPMQ6TkTA`w;O zxO92^%IK}>dFk}(X$V?4prrc(4^0OpRK!R2rnLa*Y*kIgilTL7OqNQOd6ga=rQZEOE5Lu1n!;!>yyc{ntnW;qH zWuy|xACE&ggQYiOmuyJ~OMJFHx~+hu1~RSP6jYD`W+ADqMIc+q6GPxP>v zo?=brGL{_+6XW#vcvzKGLyTer>jG(M3fr@jV zBg)coWyVf3l53V)K$q9Fk}rnRjFtG2`mEldA)0(!hPm`Z?L3)i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2BLSmmrHSxWS zYGO@|L3*NfM>S{Hn?Q1VpOC0~K@w>W$y$9Rt4$zL_6bRNFGxboAqmz;A~%8L`F%nX z*b9=kG>7E5`beH_0?9M`gk)teNS2#JvQ!_*ViQOf_6fNamVAa$}#6 z%N=4as(UKpxlTCpRc3AKy3}e;1o588a#L!e6Dc~KHG=}pQ)q4 zmD(DF*$`?FHF)qexYW1?7aP&wLLCj>s;xnoexn9ag9lE7Wd3iqM9SX(f3W7nSXv~2 z1dsp{Kmter3G4@fhvK#89&l#`&OLDMap2}2j%efa|Mf=Z|F`SR|JB+Wgj;z~gQ&p+ Hr@{XZeiYZI literal 0 HcmV?d00001 diff --git a/features/create_category.feature b/features/create_category.feature new file mode 100644 index 0000000000..d810ddd97d --- /dev/null +++ b/features/create_category.feature @@ -0,0 +1,17 @@ +Feature: Create Categories + As a a blog administrator + In order to organize my blog posts into categories + I want to create a category + + Background: + Given the blog is set up + And I am logged into the admin panel + + Scenario: New category page shown + Given I am on the new category page + Then I should see "Categories" + + Scenario: New category page not shown + Given I am on the new category page + Then I should not see "Categories" + And I should see "The page you were looking for doesn't exist" diff --git a/features/edit_category.feature b/features/edit_category.feature new file mode 100644 index 0000000000..e69de29bb2 diff --git a/features/support/paths.rb b/features/support/paths.rb index e7e00e5d89..4d4dca9c38 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -24,6 +24,9 @@ def path_to(page_name) # when /^(.*)'s profile page$/i # user_profile_path(User.find_by_login($1)) + when /^the new category page$/ + '/admin/categories/new' + else begin page_name =~ /^the (.*) page$/ diff --git a/public/javascripts/ckeditor/config.bak b/public/javascripts/ckeditor/config.bak old mode 100644 new mode 100755 index 187db086f2..492800fd66 --- a/public/javascripts/ckeditor/config.bak +++ b/public/javascripts/ckeditor/config.bak @@ -8,7 +8,7 @@ CKEDITOR.editorConfig = function( config ) config.PreserveSessionOnFileBrowser = true; // Define changes to default configuration here. For example: //config.language = ''; - config.uiColor = '#E0ECFF'; + config.uiColor = '#eee'; config.toolbar = 'Basic'; config.entities_greek = false; config.entities_latin = false; diff --git a/public/javascripts/ckeditor/config.js b/public/javascripts/ckeditor/config.js old mode 100644 new mode 100755 index 187db086f2..492800fd66 --- a/public/javascripts/ckeditor/config.js +++ b/public/javascripts/ckeditor/config.js @@ -8,7 +8,7 @@ CKEDITOR.editorConfig = function( config ) config.PreserveSessionOnFileBrowser = true; // Define changes to default configuration here. For example: //config.language = ''; - config.uiColor = '#E0ECFF'; + config.uiColor = '#eee'; config.toolbar = 'Basic'; config.entities_greek = false; config.entities_latin = false; From 7bc474ecfe8742a9ede47ac2c684ecdd13740ea7 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Mon, 28 Mar 2016 13:58:29 -0700 Subject: [PATCH 02/27] Cucumber test for viewing new category page seems to work. Adding conditional to admin new categories controller (new or edit) --- .../admin/categories_controller.rb | 26 ++++++++++-------- db/db_test | Bin 176128 -> 188416 bytes features/create_category.feature | 5 ---- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index e148bcd380..f39782f5b8 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -26,22 +26,24 @@ def destroy def new_or_edit @categories = Category.find(:all) - binding.pry + if params[:action] == "edit" @category = Category.find(params[:id]) @category.attributes = params[:category] - - if request.post? - respond_to do |format| - format.html { save_category } - format.js do - @category.save - @article = Article.new - @article.categories << @category - return render(:partial => 'admin/content/categories') + else + @category = Category.new + end + if request.post? + respond_to do |format| + format.html { save_category } + format.js do + @category.save + @article = Article.new + @article.categories << @category + return render(:partial => 'admin/content/categories') + end end + return end - return - end render 'new' end diff --git a/db/db_test b/db/db_test index 483a1e1710cdf278bde9c98d22d6b589e9e9b08a..977e2a0cee3221ccdefc073012bef1c5714a9e0b 100644 GIT binary patch delta 1076 zcmYk)O-K}B7zglqo_A)}acAb8UDs6%Q=_2PFS0`fkrGBh7bT)YP;I$^Q0uO{ey{FM zA9U%EiB6Xy2$G1v5Zgc@NhpHAE*(k_n-o^4^r0DasF``+g)Rdx^W*v8|73E7nOX0R zEz-Oo2zA4ijWGZC%>DX6t3X@nNBWk&q|>yGCg>e{ebQ&_r42qHJ1`mPO`bmAejyp@ zObE9$nUrIqy)AM!Y(K|T4=IOp9noYYnoJ;lG;+Byq|-G)hrCITOgHZF+a3Mzf2H)L zrYB7x#)2NYX#W&y=^y%wey1yRnJ&@AY}o`nr(XL`G?NniiF0@rYv3;|z(cqQ0byB~8}S*nq{^gLd=0jtsaxhMRHLa`;V*Ck zP1UOU0Q=GOTJa^QL$i=Og}VaoJlx6LN!*Ft5$=#X;7)KIq+JF>u7W`qLCQ5Sz(_wM zeT?)n(!)qMBVCLn8A&kG$w-`$m`k#w*RZ2BD>mUO*!A@p2tmKKdkVHgpLJ>mDxlXI znt?Lt$qrA!Z-j1Ux|m5alVGNkn>aHuW;&ROx+Z(&0jA`!7L-FdL6g-L^|d;#4k#HV zqBJX83w}tO(xNmijY{np#beljD&*`Nod9A-@78sqaRzjvaVB)4aYnSGVf~$KoJG)7 zI4t1M!=apq5{Dv(ghS*I@=#zarP)eDY^6b0LCQg!ICd9hBP?i=`c-|U-cx&&loGZ_ zKdO*YGsp`T=L-gS=OW(O&pZ1#GmhCf!F>{j>g5@7Jreb-VO?jfBin fH%K%~_+bV4VHNYk3b=WrS;U>6J0Ew3<7)o_=+{u) delta 246 zcmZoTz}@hGYl1XuJp%)S_Cy7H#`=v3%k)Kx8TjAvKjFX1f1H0e|62ZH{(1a8n*{|T z`2~2`nPnN1^Ycnl^Gb@D7#Jou+iUUhumJ^&GgDHN5{ruSChxX477}1&R%I+nttg34 z%giZBEh;W(a@gj;$WkE0%Ksc_8G|Pi<$) smk?s-%wXVU<9Wk#hG#iX4QCT)22fQHCzC|p^!r Date: Mon, 28 Mar 2016 14:24:13 -0700 Subject: [PATCH 03/27] Fleshing out edit action in admin categories controller to be analogous to new action --- .../admin/categories_controller.rb | 43 +++++++++--------- db/db_development | Bin 159744 -> 159744 bytes db/db_test | Bin 188416 -> 196608 bytes 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index f39782f5b8..718f13b1b3 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -3,14 +3,21 @@ class Admin::CategoriesController < Admin::BaseController require 'pry' def index; redirect_to :action => 'new' ; end - def edit; new_or_edit; end + + def edit + respond_to do |format| + @category = Category.find(params[:id]) + @category.attributes = params[:category] + format.html {new_or_edit} + format.js + end + end def new respond_to do |format| - format.html { new_or_edit } - format.js { - @category = Category.new - } + @category = Category.new + format.html {new_or_edit} + format.js end end @@ -26,24 +33,18 @@ def destroy def new_or_edit @categories = Category.find(:all) - if params[:action] == "edit" - @category = Category.find(params[:id]) - @category.attributes = params[:category] - else - @category = Category.new - end - if request.post? - respond_to do |format| - format.html { save_category } - format.js do - @category.save - @article = Article.new - @article.categories << @category - return render(:partial => 'admin/content/categories') - end + if request.post? + respond_to do |format| + format.html { save_category } + format.js do + @category.save + @article = Article.new + @article.categories << @category + return render(:partial => 'admin/content/categories') end - return end + return + end render 'new' end diff --git a/db/db_development b/db/db_development index a9c7606a8dfa28e3ced5c5857990129376916394..7a346e4dddbc37d1ab5ce78ee758da9d87a53047 100644 GIT binary patch delta 579 zcmZ{hzi-n}5XbK&q0}bff}o13R5TQ-4&eC3abhPEQ3kqYs=83ZOZ?Kf_(x?sK@~!6 zPz7Qmc!!0hTagC@e**(!CsfMBgpgn<3l9b+IGt{|)15xw@9iB+d&knVB5|h+ZQ{PZ z`%0Z57z4)11^N_s?~yzdHrfRMkN|KVip+9tZ_wksRvq+=Ue7QsX7;O=rs-C#Ua2>9 zHZTUfQP(MJSZr*EWj3+`zEgH~Jn!bF%WS9I_uW5tDy$#bW3DJl>A^!eheseIpTTeV z4&UPod@kc>+{Z&4BNsfk@CqK`TzXjwxMc@i?D}4qy_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e9xVbVF)3V-MHrai307RG%>P@2sBmaU=beogw|C z5&Xn@Ngp%jcUX+{QDc6Og-9QP8-^Q#8-yExOTi`K`r-QEdf|HDy5YLuI^jCt+Tq&Z zTHz9KEpW|nakwV97+fP<16(~^6s`^~0#^%H0~dy?hO2@L!3E(0aFuWsaOH4iaHVj5 zxDvSHBbN(p(>9B1=12Wchda=_cG0^w(au)U&V<#@7N};S;zBhE6|+<$RD)3ULPdqD zvs47CR;U`G!a`Las^4_yG}&v4X!0LM(j3MxNyTOxkH&7yiWx=Bh=>^$F+)NPT513) ZB~((Vexdp-)eF@lRJTxFLUoEO{{_ewdlmoy delta 162 zcmV;T0A2rpfDC}Z3y>NH0nY#c04|XrJ^}&Hv0wu~5SR@H104c$X=G($VRCZ-mVTf6+`j>r+`j@S5(f!k01X8U z>I}&YqYQTmd Date: Mon, 28 Mar 2016 14:45:45 -0700 Subject: [PATCH 04/27] Wrote rspec and cucumber tests that fail when the original bug is present --- db/db_test | Bin 196608 -> 143360 bytes .../admin/categories_controller_spec.rb | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/db/db_test b/db/db_test index 9ad2cb9cf5316db12631bcd41de0219fb8efd469..e11ed5ab62695f097d5e721dca292606bb077426 100644 GIT binary patch delta 164 zcmZo@;AwckF+qxrp_hSyL3yHr9TP+E#)KvEn^^>y1X$iN@W0zEDDZ?|NPv-9m9ZqX zq9i^oGp8iAsF-ch0)<5v3>Iw=Sad;P(*~A?%`6B0=x@5fBCwpLfYAWX6JX H_#+Phl0G-W literal 196608 zcmeI54|E&Hediazf*?QuE9xI4QkOQ)7H*u~R31q*Dra@{`kZW8-79{LJj+`H|Tx`~zcG_>s$V z7bd5{@Az>kNmbsFY=1vvIKq4lA6`ylvx_6lz?d`go?IqFXL)=|CqAjtA z3PCa2$*%~hP((-_aeKW^NK#x1iE$w&ZgPkv!f61|$t&WT;>--~G&wptbT|FkbS7ja zpsXiFIaxT`RhHI*!1JI5sG@87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ksoe;_R{~iO& zaL;q^;ryJ{{zLoc>^JNkwpVP=+dgay+RWA$te>+!V?EdM)0SsjKHQRQaa+D^`9sSy zmPN~5<}aGxYfi#!fxh_S2o9;L5X!_fx^`@z&BgR*apEnA|0pkw# zMfM}?BzwT{s^Ke!-!Sw;wD>^+uRDRG8F;OR`j`E|OEntvvcHLX-VBl%*Y;|V%-Ndn z205A;)57IUqqvOL#pSd{E+Z&vM|ak;N9F0dDdrk6wBtAYz`WuczSaHF{R z>*4|%Vrb$rq=F0VXQ7^pw^3XM>f!>sVrb&xR>1`}wNTH+)hI4~b#XbNkxQ=%F2}WS zIo2pHN9*F^)X3$C3NAfbxEyX2m+rc_+^vyImkKVOTDWvHiVN(EQOC=Q;m09O?aM(G zTwtRM_3g`nMsb17G3wv~bM>0I>{r1BcDqo|#nC7(utP>2Twv-{6PMj8xWJYd>bdM} z6c^YgqYf@Glcj+R{{H{E4?i200B2@M!zAmVs!3LFtx48_TTHS-7ZN8~aguf0O|m*O zZVf{0S0zMOEg|;ZLWnSCK_Q|Lx1kVwH3;#zDj^=LCB&n*5F!kcQHUtSZ79Se8id%R zN{EMR39#*YAw+m40)>b|+=fCN(ICY8RSEG_Eg{}_3n9WoI4DFE;x-iG dy&8mgk18P!*Ak-t7D9xlzEFrL#BC?U{|_=~dQboW diff --git a/spec/controllers/admin/categories_controller_spec.rb b/spec/controllers/admin/categories_controller_spec.rb index bb290f4a0d..c765e696eb 100644 --- a/spec/controllers/admin/categories_controller_spec.rb +++ b/spec/controllers/admin/categories_controller_spec.rb @@ -34,6 +34,20 @@ end end + describe "test_new" do + before(:each) do + get :new + end + + it 'should render template new' do + assert_template 'new' + end + + it 'should have a new category' do + assigns(:category).should_not be_nil + end + end + it "test_update" do post :edit, :id => Factory(:category).id assert_response :redirect, :action => 'index' @@ -48,7 +62,7 @@ it 'should render destroy template' do assert_response :success - assert_template 'destroy' + assert_template 'destroy' end end @@ -62,5 +76,5 @@ assert_raise(ActiveRecord::RecordNotFound) { Category.find(test_id) } end - + end From d50917da45fbb61410b18190c43a9a25309d0bb9 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Mon, 28 Mar 2016 14:54:41 -0700 Subject: [PATCH 05/27] Removing pry require --- app/controllers/admin/categories_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index 718f13b1b3..42ca4513e4 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -1,6 +1,5 @@ class Admin::CategoriesController < Admin::BaseController cache_sweeper :blog_sweeper - require 'pry' def index; redirect_to :action => 'new' ; end From 66203966e7bad7d0b05fcfdca33bf7234ba08b5f Mon Sep 17 00:00:00 2001 From: Dreedle Date: Mon, 28 Mar 2016 18:27:53 -0700 Subject: [PATCH 06/27] Able to create and edit categories --- .../admin/categories_controller.rb | 26 ++++++++++-------- app/views/admin/categories/new.html.erb | 6 ++-- app/views/admin/categories/new.js.erb | 3 +- db/db_development | Bin 159744 -> 159744 bytes 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index 718f13b1b3..0b710fba1c 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -1,23 +1,15 @@ class Admin::CategoriesController < Admin::BaseController cache_sweeper :blog_sweeper - require 'pry' def index; redirect_to :action => 'new' ; end - - def edit - respond_to do |format| - @category = Category.find(params[:id]) - @category.attributes = params[:category] - format.html {new_or_edit} - format.js - end - end + def edit; new_or_edit; end def new respond_to do |format| - @category = Category.new format.html {new_or_edit} - format.js + format.js { + @category = Category.new + } end end @@ -32,6 +24,16 @@ def destroy private def new_or_edit + if params[:action] == "new" + @category = Category.new + elsif params[:action] == "edit" && params[:id] + @category = Category.find(params[:id]) + @category.attributes = params[:category] + elsif params[:action] == "edit" && !params[:id] + @category = Category.new + @category.attributes = params[:category] + end + @categories = Category.find(:all) if request.post? respond_to do |format| diff --git a/app/views/admin/categories/new.html.erb b/app/views/admin/categories/new.html.erb index b7c999e7cc..09c1519a82 100644 --- a/app/views/admin/categories/new.html.erb +++ b/app/views/admin/categories/new.html.erb @@ -1,8 +1,8 @@ <% @page_heading = _("Categories") %>
- <%= form_tag :action=>"edit", :id => @category.id do %> <%= error_messages_for 'category' %> @@ -32,7 +32,7 @@
- <%= cancel_or_save %> + <%= cancel_or_save %>
<% end %> diff --git a/app/views/admin/categories/new.js.erb b/app/views/admin/categories/new.js.erb index 127773d772..ac6cf5fbfc 100644 --- a/app/views/admin/categories/new.js.erb +++ b/app/views/admin/categories/new.js.erb @@ -11,9 +11,8 @@ $$('.top-layer').each(function(layer) { layer.remove(); }); event.stop(); }); - cancel_link.writeAttribute('href', '#close_form'); - + // $$('.concrete form').each(function(cat_form) { cat_form.observe('submit', function(event) { cat_form.request({ diff --git a/db/db_development b/db/db_development index 7a346e4dddbc37d1ab5ce78ee758da9d87a53047..acf2ca86f2c992ff42b2a3fc916fcf5c09bef0af 100644 GIT binary patch delta 243 zcmZp8z}fJCbAmKu`9v9K#`28`%j{V~+4w^@b2)hP3-B>AD>5c0mZYZV7iFdvvrSI* zFP7#1$iU56l$oAUQp_XBEX!D&nUb26SX9i)z`(%2`Kv#Vf*}8X23GzB4E(S8@9?kZ zKf%9XvtmLYzc()%2LnGNKR-W1DQjtIDIW`jE67m5Tu@Mu57f^ImKI_KOGxrFWU^%D zB!XZjFB42}K2v5@e)H@4>96Y36L8BZIK*90d28hrauH_1`qMG3P4K_kx&i-57?7sPjejr000XK za%pF1baM<5104Z#X=G($VRCZ?4FLlov-M95APE2f009r{01xZ45rE+jgX@2n>wf_m V1_2NC01x%E5y0yYxAl(!3*aywCM^H} From cc0b3f85c15815d01bcde03118c8f7d78646f326 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 10:18:28 -0700 Subject: [PATCH 07/27] Adding cucumber tests for creating and editing categories --- db/db_test | Bin 143360 -> 143360 bytes features/create_category.feature | 10 ++++++++++ features/edit_category.feature | 20 ++++++++++++++++++++ features/step_definitions/web_steps.rb | 12 +++++++++--- features/support/paths.rb | 4 ++++ 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/db/db_test b/db/db_test index e11ed5ab62695f097d5e721dca292606bb077426..463daf9a2acc30bf9279a64b5dbf7ea078ac0b5f 100644 GIT binary patch delta 56 zcmV-80LTA;;0S==2#^~AiIE&b0g16-pFaTtfwy^X(bgnjE${FtRKVVB>qwz<-5*DSsuu7rz|e`^|y^ kxA~ZK*`_al@9I{n&vMlB{?76_La%-z29J!7;30ORN#YybcN diff --git a/features/create_category.feature b/features/create_category.feature index ab817ed7d6..dc713c93e1 100644 --- a/features/create_category.feature +++ b/features/create_category.feature @@ -10,3 +10,13 @@ Feature: Create Categories Scenario: New category page shown Given I am on the new category page Then I should see "Categories" + + Scenario: Successfully create category + Given I am on the new category page + When I fill in "category_name" with "Foobar" + And I fill in "category_keywords" with "Lorem Ipsum" + And I fill in "category_description" with "Lorem Ipsum" + And I press "Save" + Then I should be on the new category page + And I should see "Foobar" + And I should see "Lorem Ipsum" diff --git a/features/edit_category.feature b/features/edit_category.feature index e69de29bb2..ff65b4d174 100644 --- a/features/edit_category.feature +++ b/features/edit_category.feature @@ -0,0 +1,20 @@ +Feature: Edit Categories + As a a blog administrator + In order to change category details + I want to edit categories + + Background: + Given the blog is set up + And I am logged into the admin panel + And a category has been created + + +Scenario: Successfully edit categories + Given I am on the new category page + Then I should see "Embarrassing Stories" + When I follow "Edit" + Then I should be on the edit category page + When I fill in "category_description" with "the best." + And I press "Save" + Then I should be on the new category page + And I should see "the best." diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 6315105872..e4a07d1557 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -55,6 +55,12 @@ def with_scope(locator) end end +And /^a category has been created$/ do + Category.create!({:name => 'Embarrassing Stories', + :keywords => 'mortifying, humiliating', + :description => 'the worst.' }) +end + # Single-line step scoper When /^(.*) within (.*[^:])$/ do |step, parent| with_scope(parent) { When step } @@ -250,7 +256,7 @@ def with_scope(locator) end end end - + Then /^(?:|I )should be on (.+)$/ do |page_name| current_path = URI.parse(current_url).path if current_path.respond_to? :should @@ -264,8 +270,8 @@ def with_scope(locator) query = URI.parse(current_url).query actual_params = query ? CGI.parse(query) : {} expected_params = {} - expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} - + expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} + if actual_params.respond_to? :should actual_params.should == expected_params else diff --git a/features/support/paths.rb b/features/support/paths.rb index 4d4dca9c38..076f9cd0f1 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -27,6 +27,10 @@ def path_to(page_name) when /^the new category page$/ '/admin/categories/new' + when /^the edit category page$/ + url_for({:controller => 'admin/categories', :action =>'edit', + :id => Category.first.id, :only_path => true}) + else begin page_name =~ /^the (.*) page$/ From a086d02d81b792e486aa6cefe33c54c33a7e6cb4 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 11:29:13 -0700 Subject: [PATCH 08/27] Adding cuke stubbed tests for merge article feature. Able to log in as a blog publisher in test --- db/db_test | Bin 143360 -> 143360 bytes features/edit_category.feature | 18 +++++++++--------- features/merge_article.feature | 24 ++++++++++++++++++++++++ features/step_definitions/web_steps.rb | 20 ++++++++++++++++++++ 4 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 features/merge_article.feature diff --git a/db/db_test b/db/db_test index 463daf9a2acc30bf9279a64b5dbf7ea078ac0b5f..f2e2387d80b5105d6d5641bf11701b55c3127ad0 100644 GIT binary patch delta 6947 zcmc&(TWs6b89vm_k}T;s7spAJCdYGKFL7kutXT3;G>($U%6w5A$FkiF9!1g;ZBo=o z%Cg*UY*G{$uwv^rVBOO&1S|G1Y{1%~dni`)Z9szoec0_~Lmq~q+khr0P+-_z_8;nE z*^%M^nH__I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m(X66uplRMbG0vvAY39Bj9dgu@#E$&QNsyKcQ%}-xd!Hibnfw@xY*HwBHsF z42nkUhW`|xXf%#LJGaFHgQ8J8kL=zS9|1+@<3q7)Zzvk>Q;r4}J3!Ii8H%-LH2q!OzUWZp+zYZ~gH;bJkes?Lx5^pN;xuR$b?n3cSCBm0pFPF}gP0cvcbh z0=aGyGL+C@rsr$=-fCOK4UfpnUw41$XcxTw>y7$bXe|ohe+dE=KHgqBaOAC@-e&@X z{fE0yZ*Q;PPx)uyQhw^>l&3BQm4BeN=FNoqw&d|GBs zNor9s)1n0mi!K-}+90s#g21K?EDf7k4*b#Ibb&=+IZFYf0i4Id#J`k*{|f(7pgA-7 TnRJ<^>%V2x-G1dgqmBarKX@ym diff --git a/features/edit_category.feature b/features/edit_category.feature index ff65b4d174..e4e4ddc70f 100644 --- a/features/edit_category.feature +++ b/features/edit_category.feature @@ -9,12 +9,12 @@ Feature: Edit Categories And a category has been created -Scenario: Successfully edit categories - Given I am on the new category page - Then I should see "Embarrassing Stories" - When I follow "Edit" - Then I should be on the edit category page - When I fill in "category_description" with "the best." - And I press "Save" - Then I should be on the new category page - And I should see "the best." + Scenario: Successfully edit categories + Given I am on the new category page + Then I should see "Embarrassing Stories" + When I follow "Edit" + Then I should be on the edit category page + When I fill in "category_description" with "the best." + And I press "Save" + Then I should be on the new category page + And I should see "the best." diff --git a/features/merge_article.feature b/features/merge_article.feature new file mode 100644 index 0000000000..d8d143f714 --- /dev/null +++ b/features/merge_article.feature @@ -0,0 +1,24 @@ +Feature: Merge Articles + As a blog administrator + In order to combine articles that are similar + I want to be able to merge articles + + Background: + Given the blog is set up + + Scenario: Article merge not possible as a non-admin + Given I am logged in as a blog publisher + + + Scenario: Article merge not possible on new articles + Given I am logged into the admin panel + + Scenario: Successful merge of publish articles + + Scenario: Merged article contains text of previous articles + + Scenario: Merged article has one author (either author of original articles) + + Scenario: Merged article has one title (either title of original articles) + + Scenario: Comments of original articles carry over to new merged article diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index e4a07d1557..ea965ccbe1 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -41,8 +41,28 @@ def with_scope(locator) :profile_id => 1, :name => 'admin', :state => 'active'}) + User.create!({:login => 'usera', + :password => 'password', + :email => 'usera@gmail.com', + :profile_id => 2, + :name => 'usera', + :state => 'active'}) +end + +Given /^I am logged in as a blog publisher$/ do + visit '/accounts/login' + fill_in 'user_login', :with => 'usera' + fill_in 'user_password', :with => 'password' + click_button 'Login' + if page.respond_to? :should + page.should have_content('Login successful') + else + assert page.has_content?('Login successful') + end + end + And /^I am logged into the admin panel$/ do visit '/accounts/login' fill_in 'user_login', :with => 'admin' From 541bb51e33e618a84c7780c23bd0d2ace877848c Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 12:11:33 -0700 Subject: [PATCH 09/27] Mapping edit article path for cucumber test --- db/db_test | Bin 143360 -> 151552 bytes features/edit_category.feature | 2 -- features/merge_article.feature | 8 +++++++- features/step_definitions/web_steps.rb | 17 +++++++++++------ features/support/paths.rb | 8 ++++++++ 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/db/db_test b/db/db_test index f2e2387d80b5105d6d5641bf11701b55c3127ad0..9b389898e8e00a67d264e31a00942e666c88679a 100644 GIT binary patch delta 539 zcma*jJ4*vm5Cz~pH*D_SHM=H=c|X=XOtPXPLO>8=5k$mZu+Ws2Dpo-xT38z_ZmET6 zVUr+|!W0%(BH}+#!A>Jc1O-uCGyVXZY37@ObE@}R^+4=K)Q+MknVMBZr%_%gBDZ&5 zEWzHMI-0_YsX9yaemYah^nOaSj-(s6I6?K)=bZ)12c+484Zj>aLmK^Zv4uqQwE^99 zJ2&Zoaf%C<<+8aU`8|enJ%t{wU+HW5w4M@gqA8ZdxbSKZ+Mzb5S^SIN@EV`shV#DR zX0|Q2+89D!Uc6u)IeGVlNo3_{8zUH$t1n0*LnKWkMI=dNfQUsTK_pHjMkGokLL^Ki zL?lQgK*ZlA&7CJyO5AYL1yGf|j{N@`=`#m?tgIMr&$H*+bL`m=+hSSFh?MrBeyfk_ zrMj=KvkEIa(F=?Pb8@qVFtW|s89tbkwp(H@`8xtX-YrZ>K2)ZX6qnz70S E0OZRaI{*Lx diff --git a/features/edit_category.feature b/features/edit_category.feature index e4e4ddc70f..537a01d05d 100644 --- a/features/edit_category.feature +++ b/features/edit_category.feature @@ -6,8 +6,6 @@ Feature: Edit Categories Background: Given the blog is set up And I am logged into the admin panel - And a category has been created - Scenario: Successfully edit categories Given I am on the new category page diff --git a/features/merge_article.feature b/features/merge_article.feature index d8d143f714..733fb4f7e6 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -6,12 +6,18 @@ Feature: Merge Articles Background: Given the blog is set up + Scenario: Article merge not possible as a non-admin Given I am logged in as a blog publisher + And I am on the edit article page + + Scenario: Article merge possible as an admin + Given I am logged into the admin panel + And I am on the edit article page Scenario: Article merge not possible on new articles - Given I am logged into the admin panel + Scenario: Successful merge of publish articles diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index ea965ccbe1..f42594290f 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -47,6 +47,17 @@ def with_scope(locator) :profile_id => 2, :name => 'usera', :state => 'active'}) + Category.create!({:name => 'Embarrassing Stories', + :keywords => 'mortifying, humiliating', + :description => 'the worst.' }) + Content.create!({:title => 'First blog post', + :author => 'First blogger', + :body => 'I wrote this first', + :guid => 10}) + Content.create!({:title => 'Second blog post', + :author => 'Second blogger', + :body => 'I wrote this second', + :guid => 11}) end Given /^I am logged in as a blog publisher$/ do @@ -75,12 +86,6 @@ def with_scope(locator) end end -And /^a category has been created$/ do - Category.create!({:name => 'Embarrassing Stories', - :keywords => 'mortifying, humiliating', - :description => 'the worst.' }) -end - # Single-line step scoper When /^(.*) within (.*[^:])$/ do |step, parent| with_scope(parent) { When step } diff --git a/features/support/paths.rb b/features/support/paths.rb index 076f9cd0f1..9b1ace3b62 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -31,6 +31,14 @@ def path_to(page_name) url_for({:controller => 'admin/categories', :action =>'edit', :id => Category.first.id, :only_path => true}) + when /^the edit article page$/ + url_for({:controller => 'admin/content', :action =>'edit', + :id => Article.first.id, :only_path => true}) + + when /^the blog publisher edit article page $/ + url_for({:controller => 'admin/content', :action =>'edit', + :id => Article.first.id, :only_path => true}) + else begin page_name =~ /^the (.*) page$/ From cca8085b5e47ec50b2bf4175892f607611cdbbfc Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 12:19:20 -0700 Subject: [PATCH 10/27] Adding content creation to blog setup in cuke tests --- db/db_development | Bin 159744 -> 159744 bytes db/db_test | Bin 151552 -> 155648 bytes features/merge_article.feature | 1 - features/step_definitions/web_steps.rb | 9 ++++++--- features/support/paths.rb | 4 ---- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/db/db_development b/db/db_development index acf2ca86f2c992ff42b2a3fc916fcf5c09bef0af..dc3b2009c6438d3d6ae795024c15bb4b7f162480 100644 GIT binary patch delta 235 zcmZp8z}fJCbAmKu#Y7or#)^#zOY}LI_zfBOC-WO_7Bo=huTNkSU=WYh7H42!U}Rw6 zmt>GGElw>;G&3_aG&V6ZPBJh_wMa5ZHnlJ^GdDK2Ff>R`v`8~aN=`~nwge)uVu$qH z#LOJM9{(i%$NVk)H~7o=Q-N-@36L8Bcaa=J0e7)rq%Q^m50d~7ld~aUi4T*LKW`e?016LP1`kya zx)00`o)3}_;}3)nun%?*WwRk*IS-RnPg?{C69X5Mv`-`p5AgsC336#?XmoRf<4=d< LPXV{%PXZkv7B(Vo diff --git a/db/db_test b/db/db_test index 9b389898e8e00a67d264e31a00942e666c88679a..9ded89863deef47ee08bbc962027531741f7b570 100644 GIT binary patch delta 415 zcmXZXze@sP7{Kv+-n;kg=&n-=3WJg~!8?Cznh|+KL;pY|4v|~XQhSK`7bFqySX+&S z*bO>3I7LH)&{%^c{lv+nAbRs@dEkK$U!JFQrj(k>ky{3rAPD}7XN7?4YCE5W^l?4A z2AQ&TZGp6>61~rX;Mc$PzU{n(Cw-K!^Clm@Nv#S^(IaNWHgi0}#*F+T*X5$@r(g7* zUeH}SE_J1rbRy*>L2OrD&b&yB3_E-W6Bb$F88#u!9$sM?QtYk^VOU`MA20_=Bnc#O zBrzmWBoQQGBq1b0BqkDLNbIF9+~mXw=rM;yyfU%KH1zl_O&|f2jWxgkgT-p#g8VZ;Lc9eC+J2Id@w8IN6N~Y4R*Z?=A>`Dy=gg-D0 bCNY>81|g0n_HUwSB51;BLTG}2=9ByaXfJ&9 delta 117 zcmZoTz}c{XbAl8b!)FEt2GxlQc1#SPHzq{cGiprUZSTUU)#R|vfsv(vi;@2~PyvG~ z|L^U5225}H*?=4sao)|02bdL@wb*&5vp--A-7F}uk&Q`9YkK2bM(yoZ&lyieFbgsz UOlNmsQU=PIF>Oz9Vp_lp0CL(N<^TWy diff --git a/features/merge_article.feature b/features/merge_article.feature index 733fb4f7e6..04d203f80c 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -6,7 +6,6 @@ Feature: Merge Articles Background: Given the blog is set up - Scenario: Article merge not possible as a non-admin Given I am logged in as a blog publisher And I am on the edit article page diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index f42594290f..a6a58f884c 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -53,11 +53,14 @@ def with_scope(locator) Content.create!({:title => 'First blog post', :author => 'First blogger', :body => 'I wrote this first', - :guid => 10}) + :guid => 10, + :user_id => User.where(login: 'admin').first.id }) + Content.create!({:title => 'Second blog post', - :author => 'Second blogger', + :author => 'Second blogger usera', :body => 'I wrote this second', - :guid => 11}) + :guid => 11, + :user_id => User.where(login: 'usera').first.id}) end Given /^I am logged in as a blog publisher$/ do diff --git a/features/support/paths.rb b/features/support/paths.rb index 9b1ace3b62..34a143cd15 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -35,10 +35,6 @@ def path_to(page_name) url_for({:controller => 'admin/content', :action =>'edit', :id => Article.first.id, :only_path => true}) - when /^the blog publisher edit article page $/ - url_for({:controller => 'admin/content', :action =>'edit', - :id => Article.first.id, :only_path => true}) - else begin page_name =~ /^the (.*) page$/ From df4466ea755f96d5b003c638d290607911bdffa6 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 12:21:38 -0700 Subject: [PATCH 11/27] Changing content creation to article creation in cuke tests --- db/db_test | Bin 155648 -> 155648 bytes features/merge_article.feature | 2 +- features/step_definitions/web_steps.rb | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/db_test b/db/db_test index 9ded89863deef47ee08bbc962027531741f7b570..88069feb595764d13d7b2efd52111b0c193cb8b5 100644 GIT binary patch delta 170 zcmZoTz}awsbAmLZ^h6nFM(K?SQTB{BlXu&@FxoXaY;#~_S-@<^bZ|QR1IA)5=8eov z%&tstnGS9i6tHDt(z2W0_?A(d(RO;`OU7_Uo9PYD7;PA>r(bx^sK;nEz3?5Q5~C$p z$#%vkjLbRAf=mh1*&Udaf!fWOm?Uhb*X?1HVzk~qaVz5wCZG1p51?0045X1!n O7&n)Gya5`fRssqZqaf-4 diff --git a/features/merge_article.feature b/features/merge_article.feature index 04d203f80c..f04de127a9 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -8,7 +8,7 @@ Feature: Merge Articles Scenario: Article merge not possible as a non-admin Given I am logged in as a blog publisher - And I am on the edit article page + And I am on the edit article page Scenario: Article merge possible as an admin Given I am logged into the admin panel diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index a6a58f884c..08db7329c2 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -50,13 +50,13 @@ def with_scope(locator) Category.create!({:name => 'Embarrassing Stories', :keywords => 'mortifying, humiliating', :description => 'the worst.' }) - Content.create!({:title => 'First blog post', + Article.create!({:title => 'First blog post', :author => 'First blogger', :body => 'I wrote this first', :guid => 10, :user_id => User.where(login: 'admin').first.id }) - Content.create!({:title => 'Second blog post', + Article.create!({:title => 'Second blog post', :author => 'Second blogger usera', :body => 'I wrote this second', :guid => 11, From 80bdce7578daf588020b4777dbd25f21de1f00a5 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 13:49:05 -0700 Subject: [PATCH 12/27] Improving cuke test for edit category --- features/edit_category.feature | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/edit_category.feature b/features/edit_category.feature index 537a01d05d..dbf3824bba 100644 --- a/features/edit_category.feature +++ b/features/edit_category.feature @@ -1,5 +1,5 @@ Feature: Edit Categories - As a a blog administrator + As an admin In order to change category details I want to edit categories @@ -15,4 +15,5 @@ Feature: Edit Categories When I fill in "category_description" with "the best." And I press "Save" Then I should be on the new category page + And I should see "Category was successfully saved." And I should see "the best." From 7fa43e869e9cca2bdb66654cbdad6987a1efb399 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 13:50:18 -0700 Subject: [PATCH 13/27] Improving create category cuke test --- features/create_category.feature | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/create_category.feature b/features/create_category.feature index dc713c93e1..aeef7b8cbe 100644 --- a/features/create_category.feature +++ b/features/create_category.feature @@ -1,5 +1,5 @@ Feature: Create Categories - As a a blog administrator + As an admin In order to organize my blog posts into categories I want to create a category @@ -18,5 +18,6 @@ Feature: Create Categories And I fill in "category_description" with "Lorem Ipsum" And I press "Save" Then I should be on the new category page + And I should see "Category was successfully saved." And I should see "Foobar" And I should see "Lorem Ipsum" From 44c15eaf7154735e6ac37f40b60262b9bbab1777 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 16:08:11 -0700 Subject: [PATCH 14/27] Adding cuke tests for editing articles (authorization) --- db/db_test | Bin 155648 -> 208896 bytes features/edit_article.feature | 29 +++++++++++++++++++++++++ features/merge_article.feature | 4 ++-- features/step_definitions/web_steps.rb | 16 +++++--------- features/support/paths.rb | 3 +++ features/write_article.feature | 2 +- 6 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 features/edit_article.feature diff --git a/db/db_test b/db/db_test index 88069feb595764d13d7b2efd52111b0c193cb8b5..b9a6a6d2cb275a8431d2d314c4d754d430bc7d44 100644 GIT binary patch delta 3779 zcmcK6Yitx%6bJCRcXoDnc4zjsr94_5r9h$dNn73m-Il&v=!??QmbTk=3+2(4wmb{8 zqcI_Bj1^@~h>B<=MkFZhe^T|6#Q5bTll|rH zId|{>&JLVc2S&B$qV2p>lBA5m=_@$ze7EV%)W~v4l#B1h7vhpQD_TX5ctt#OGCXXN zNDpUn9Pjn->TPUm-_q;v?vZZjc6loAX>av6`^?85G>1HuwRCp$`a61ixOnH_6PXDf zaYynn%k&>So0$<|eq{vv>q`BPd*AmmTh}zVxM+STWr#n-Z{jC$OI#P-dYz@PoWQm_YzA9NB%4SU5igO<5E=gPJC>{mr%y4e%sMyJY3z~v9iGa zb1a&b4iBDU4>(&*W)+zdGR0(yU<%0;kjW>LM?_t8<@ zOGmMf$Q~lQiR>b>lgJJt+lllN=^@fhWE+t#BArA!h-@XYg~(WI`5Sx2OXNHvkQM5>6aAyP@Cf=D@$G9sl!Rufr8 zq=ZN@ks>06K@xlD9VWE3bJS_hpOxR05#_A%qSDSgcqLEg8XGlVN<&OG z@6gcN!K?)@%V5@mw`DME!JE*`8ubtiTkullh6?BebO72dr~ujkWk3$dEGW@f{WR8o z8fzbowfAphjYztp-PAtTUe|W2dsUz6RimAEl>5q8%CIu1`1vMY%2T+LjhJH{4~{hx zP0TUmpJFOkiirhcBFS?JoyWHunYp&z21FjlZwEBVi zg4$(n1b4pW+-u&z@s690K}V~@>j<-dX5VcuvBxV9lrxG?nXiP|Mr}uJg|;d31NpN2 zl$<8p_$VLZ;oUrn-C~#7ORSbL>2qmlFl&l=0at~h%8fOlta76=6jp9jgwo25@=#p4 zQ3h8Ew;FC0TnSt;ToGI$Tmf7@TpnC5Tn^kyxNNvAI4@i#+zPnmaLeExgIfx>1a2|h zBDjTc3*hF%Wx%DwrNPaEONC2;ONL8=ON2{+n+q2YHwSJuTpZjixS4P>;9}vX!^OZ& zgPRIB1#U82G+Y$iB)Exi6X3?fMZ%4Pi+~G<3k$mBdAj*;ERsEXNEaa~3z3usNXmR9 zCBuqTI$#>$Jit`I6bmK;CIKb_CIHU0U_9U)z}bLtfV0LzYF?|4K3Xx>FT(nTSib=4 z=Ua{B0pZ7cdiW1>kZEE(3fFa4Fytz{US@v_`Dofc4j7{d%llXEjm_ zxDK!euo`f!1*-tp09FE40G3;@46qb%HQ*}1lCjYe#eYH{$l=l{5_im z1tR$cc-Wa`8I$w#N>cMmikTP~CO6w_@$s+$1&cFNQj-#kiftzEwl@|MU}RQhEJ>{> ziBHSSDM>9Vwrg_O=D^5Oz{AA<4QLyK8vk$pZ`%b7n4a--1G%c&Kte^FcQfMwW(8(D yri0Vj3z%wwcG@y+KUl=%%)6N7fWmSX0VW4#L8gT1><&!IKuI&E?Fm6l3wQxN&o){B diff --git a/features/edit_article.feature b/features/edit_article.feature new file mode 100644 index 0000000000..005ba67ef3 --- /dev/null +++ b/features/edit_article.feature @@ -0,0 +1,29 @@ +Feature: Edit Articles + As a blog publisher or admin + In order to provide the best articles possible + I want to be able to edit articles + + Background: + Given the blog is set up + + Scenario: Successfully edit articles that belong to publisher + Given I am logged in as a blog publisher + Given the following article record + | title | body | published | user_id | + | "publisher article" | "hi here it is" | true | 2 | + + And I am on the articles page + Then I should see "publisher article" + When I follow "Edit" + Then I should see "Publish settings" + + Scenario: As publisher, cannot edit articles that do not belong to you. + Given I am logged in as a blog publisher + Given the following article record + | title | body | published | user_id | + | "admin article" | "hi here's another" | true | 1 | + + And I am on the articles page + Then I should see "admin article" + When I follow "Edit" + Then I should see "Error, you are not allowed to perform this action" diff --git a/features/merge_article.feature b/features/merge_article.feature index f04de127a9..3b026563c2 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -1,5 +1,5 @@ Feature: Merge Articles - As a blog administrator + As an admin In order to combine articles that are similar I want to be able to merge articles @@ -8,7 +8,7 @@ Feature: Merge Articles Scenario: Article merge not possible as a non-admin Given I am logged in as a blog publisher - And I am on the edit article page + And I am on the edit article page Scenario: Article merge possible as an admin Given I am logged into the admin panel diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 08db7329c2..250ac85a64 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -50,17 +50,12 @@ def with_scope(locator) Category.create!({:name => 'Embarrassing Stories', :keywords => 'mortifying, humiliating', :description => 'the worst.' }) - Article.create!({:title => 'First blog post', - :author => 'First blogger', - :body => 'I wrote this first', - :guid => 10, - :user_id => User.where(login: 'admin').first.id }) +end - Article.create!({:title => 'Second blog post', - :author => 'Second blogger usera', - :body => 'I wrote this second', - :guid => 11, - :user_id => User.where(login: 'usera').first.id}) +Given /^the following (.+) records?$/ do |factory, table| + table.hashes.each do |hash| + Article.create!(hash) + end end Given /^I am logged in as a blog publisher$/ do @@ -76,7 +71,6 @@ def with_scope(locator) end - And /^I am logged into the admin panel$/ do visit '/accounts/login' fill_in 'user_login', :with => 'admin' diff --git a/features/support/paths.rb b/features/support/paths.rb index 34a143cd15..9b6b0791b8 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -35,6 +35,9 @@ def path_to(page_name) url_for({:controller => 'admin/content', :action =>'edit', :id => Article.first.id, :only_path => true}) + when /^the articles page$/ + '/admin/content' + else begin page_name =~ /^the (.*) page$/ diff --git a/features/write_article.feature b/features/write_article.feature index 9d1c789980..1895cc3fe3 100644 --- a/features/write_article.feature +++ b/features/write_article.feature @@ -1,5 +1,5 @@ Feature: Write Articles - As a blog administrator + As an admin In order to share my thoughts with the world I want to be able to add articles to my blog From 838d00733d2b46e6b031c5d350b9845bd9b9f008 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 16:09:14 -0700 Subject: [PATCH 15/27] Removing edit articles from paths.rb --- features/support/paths.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/features/support/paths.rb b/features/support/paths.rb index 9b6b0791b8..3f174165c4 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -31,10 +31,6 @@ def path_to(page_name) url_for({:controller => 'admin/categories', :action =>'edit', :id => Category.first.id, :only_path => true}) - when /^the edit article page$/ - url_for({:controller => 'admin/content', :action =>'edit', - :id => Article.first.id, :only_path => true}) - when /^the articles page$/ '/admin/content' From 33eb38dbdd6c969c95a5ef32b492936fa62ef9a7 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 16:17:50 -0700 Subject: [PATCH 16/27] Red cuke test for article merging as admin vs not admin --- db/db_test | Bin 208896 -> 212992 bytes features/merge_article.feature | 22 +++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/db/db_test b/db/db_test index b9a6a6d2cb275a8431d2d314c4d754d430bc7d44..6ac689290814036802fcba92121d7bbabdae3d9f 100644 GIT binary patch delta 395 zcmXxgy-Pw-7zXh3zE{oR%4zNkm9^h_PPqZ?||HMOXrCQsmq+>9*KK5$s@35e zQREzybx_7ZX$PhLQPM#P2W<_JTAwzKJ%=%LdC}}LpWEyXKDalH@xkU{N9ix#$6pmF BjE?{S delta 155 zcmV;M0A&AwfDM4)43HZIZvX%QGm#)a0dKKj13wVx4F&@p0&{6(Wny7+a{%Upb3eCp zKLL?&9t#h|00000GY|U@_7Cw7><{M;;t$*p)(_AR$`8c1A}|7?4~N9R0k_1z0zgm$ z6AQ$b2haj1vk?%M3j->FXqSQQ0V}ui8v_yq5(f!k01X8U>I}&YqYQTmd Date: Tue, 29 Mar 2016 16:27:27 -0700 Subject: [PATCH 17/27] Moving merge article feature tests conerning authorization to their own file --- db/db_test | Bin 212992 -> 212992 bytes features/merge_article.feature | 28 ++--------------- features/merge_article_authorization.feature | 30 +++++++++++++++++++ 3 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 features/merge_article_authorization.feature diff --git a/db/db_test b/db/db_test index 6ac689290814036802fcba92121d7bbabdae3d9f..3c54d0b0608cd99ccc75dbe18515d6f40d2c0e64 100644 GIT binary patch delta 194 zcmZo@;B9E&ogmFPeWHvrCjZTX0(|VuT8%Z+8{aZ&Gc{IEPkhN3&eT{nUGX8K4O3&~^ukAsdQ6QK z(+l4*Dls*dgVk+cCBYmeF2v56$iU0W^NQyr&tjf(&Kk}{pmE-u%o0HD_qQ@hGgfY& oxRvn-6G;2V6HMBS<O&na+NJ$#t`!fB^@yR%7|}#Fpf0%s-d_P{<;q diff --git a/features/merge_article.feature b/features/merge_article.feature index 23bc4037b7..94b9f63acf 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -6,35 +6,11 @@ Feature: Merge Articles Background: Given the blog is set up - Scenario: Article merge not possible as a non-admin - Given I am logged in as a blog publisher - Given the following article record - | title | body | published | user_id | - | "publisher article" | "hi here it is" | true | 2 | - And I am on the articles page - When I follow "Edit" - Then I should see "Publish settings" - And I should not see "Merge articles" - - Scenario: Article merge possible as an admin - Given I am logged into the admin panel - And I am on the articles page - Given the following article record - | title | body | published | user_id | - | "admin article" | "hi here's another" | true | 1 | - - And I am on the articles page - Then I should see "admin article" - When I follow "Edit" - Then I should see "Publish settings" - And I should see "Merge articles" - - - Scenario: Article merge not possible on new articles - Scenario: Successful merge of publish articles + + Scenario: Successful merge of published articles Scenario: Merged article contains text of previous articles diff --git a/features/merge_article_authorization.feature b/features/merge_article_authorization.feature new file mode 100644 index 0000000000..85fa636786 --- /dev/null +++ b/features/merge_article_authorization.feature @@ -0,0 +1,30 @@ +Feature: Authorize article merge + As an admin + In order to ensure that only I can merge articles + I want to prevent other users from accessing merge feature + + Background: + Given the blog is set up + +Scenario: Article merge not possible as a non-admin + Given I am logged in as a blog publisher + Given the following article record + | title | body | published | user_id | + | "publisher article" | "hi here it is" | true | 2 | + And I am on the articles page + When I follow "Edit" + Then I should see "Publish settings" + And I should not see "Merge articles" + +Scenario: Article merge possible as an admin + Given I am logged into the admin panel + And I am on the articles page + Given the following article record + | title | body | published | user_id | + | "admin article" | "hi here's another" | true | 1 | + + And I am on the articles page + Then I should see "admin article" + When I follow "Edit" + Then I should see "Publish settings" + And I should see "Merge articles" From 3218a8b9f509c8798048f6b1990effdc39d37842 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Tue, 29 Mar 2016 16:51:22 -0700 Subject: [PATCH 18/27] Stubbing out cuke tests for merge_article.feature --- db/db_test | Bin 212992 -> 212992 bytes features/edit_article.feature | 2 +- features/merge_article.feature | 36 ++++++++++++------- features/merge_article_authorization.feature | 2 +- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/db/db_test b/db/db_test index 3c54d0b0608cd99ccc75dbe18515d6f40d2c0e64..2970a67d876fa2df9aded59c2640c8584e71b8f1 100644 GIT binary patch delta 258 zcmZo@;B9E&ogmG)dZLUojpui~>X00Z+>5Xq0wV9e&rzgH-3}0QZpU!@ONf~IFDigB= z(D3_PnWTV*Z=bl8@dp#g^p7W)v_PgCZe>(qYGRmfc!)`Xu^yyOnz0V53}`q|nKon1 Ubj6)as*KfOMcb1tndhi;5Y3H5c2r7uz##FSciz zc!61+J!Lxk1t$N^f&zT(%vy~#(;MG1YHyz;&RirR#Lk(>z{|?>isvNHVxDr&8qP$Z NGH=f9iI&Xs*#Kf-AtL|) diff --git a/features/edit_article.feature b/features/edit_article.feature index 005ba67ef3..e76be4d7e8 100644 --- a/features/edit_article.feature +++ b/features/edit_article.feature @@ -9,7 +9,7 @@ Feature: Edit Articles Scenario: Successfully edit articles that belong to publisher Given I am logged in as a blog publisher Given the following article record - | title | body | published | user_id | + | title | body | published | user_id | | "publisher article" | "hi here it is" | true | 2 | And I am on the articles page diff --git a/features/merge_article.feature b/features/merge_article.feature index 94b9f63acf..e640d3f339 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -5,17 +5,29 @@ Feature: Merge Articles Background: Given the blog is set up - + Given I am logged into the admin panel + Given the following article records + | title | body | published | user_id | author | + | "Publisher article" | "Here is one article." | true | 2 | "Mrs. Usera" | + | "Admin article" | "hi here's another" | true | 1 | "Ms. Admin" | + | "Unpublished article" | "I'm not published" | false | 1 | "Ms. Admin" | + And I am on the articles page + + Scenario: Successful merge of published articles with combined text, authors, and titles, + and carried over comments. + When I follow "Publisher article" + Then I should see "Merge With This Article" + When I fill in "Article ID" with "2" + And I press "Merge" + Then I should be on the articles page + And I should not see "Admin article" + When I follow "Publisher article" + Then I should see "Here is one article. hi here's another" + And I should see "Mrs. Usera" + And I should not see "Ms. Admin" + And I should see "Publisher article" + And I should not see "Admin article" Scenario: Article merge not possible on new articles - - - Scenario: Successful merge of published articles - - Scenario: Merged article contains text of previous articles - - Scenario: Merged article has one author (either author of original articles) - - Scenario: Merged article has one title (either title of original articles) - - Scenario: Comments of original articles carry over to new merged article + When I press "New Article" + Then I should not see "Merge With This Article" diff --git a/features/merge_article_authorization.feature b/features/merge_article_authorization.feature index 85fa636786..7a43e525e2 100644 --- a/features/merge_article_authorization.feature +++ b/features/merge_article_authorization.feature @@ -21,7 +21,7 @@ Scenario: Article merge possible as an admin And I am on the articles page Given the following article record | title | body | published | user_id | - | "admin article" | "hi here's another" | true | 1 | + | "admin article" | "hi here's another" | true | 1 | And I am on the articles page Then I should see "admin article" From 088d55e7ad0f56489cab42288289d356202182f5 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Wed, 30 Mar 2016 09:15:03 -0700 Subject: [PATCH 19/27] Specs for merge article feature (red) are complete --- db/db_test | Bin 212992 -> 225280 bytes features/merge_article.feature | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_test b/db/db_test index 2970a67d876fa2df9aded59c2640c8584e71b8f1..546d67b326a474edd46468ee3a60bc2b50325f4b 100644 GIT binary patch delta 616 zcmYMxy)Q#i7zXfr-h2C@&h5FSrFvCM3{oK>J|dBHGux~PgAM%$>KG&@H8{InQlyRv zF&VoU4E42D!i_;l7~IPvmUnpb%bPsUTQ1w>dwa(XH4MX;tmKQVaX4=lotzyuvs7AH zT3%dOFR|=qsi;duR#}b4#gR{q3B{`{ZHZHHqz9^OTX26lE?s|)$%sBXXES-n63xI) zicj$-Jkiw2dv-0t{%TaZTb{?X=TR!JtU4W#bk*7m>m!*_8_#TzWS3fKvN@7z)%(Dv zNp`BWM>b5d11<%ZglmUugG<0UZ~`t4XTx#0R=5~k3tSW~0vG;qdNF10XS8)eH;iON zy1WnC%7Fc-fd`nTj)0Qj-#kiWym&i|w};+cQoq z;Naok2UN;nGM#4wqr`R<1E$&h+xPEhbXDME=6?^8G2;Kt|CRs!cA)~MyZr6%-!pE1 z|DH)yf!UDNWIFo=rsU0n0;gD*wVK$bH@;=m-kv1Nyhw^!kjZ~K`vE3pprk6(c7G%0 Gjl2NdQZ7IM diff --git a/features/merge_article.feature b/features/merge_article.feature index e640d3f339..669d7c375a 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -29,5 +29,5 @@ Feature: Merge Articles And I should not see "Admin article" Scenario: Article merge not possible on new articles - When I press "New Article" + When I follow "New Article" Then I should not see "Merge With This Article" From f65e97eaf14928e00a7ed228eb5e3d390d1bbd13 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Wed, 30 Mar 2016 13:51:39 -0700 Subject: [PATCH 20/27] Adding html for merge article form --- app/views/admin/content/_form.html.erb | 8 ++++---- app/views/admin/content/new.html.erb | 1 + app/views/admin/shared/_merge.html.erb | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 app/views/admin/shared/_merge.html.erb diff --git a/app/views/admin/content/_form.html.erb b/app/views/admin/content/_form.html.erb index 7b85db61c8..c0318781b8 100644 --- a/app/views/admin/content/_form.html.erb +++ b/app/views/admin/content/_form.html.erb @@ -16,7 +16,7 @@
<%= _("Status:") %> <%= @article.state.to_s.downcase %> Change
    -
@@ -146,8 +146,8 @@
    <%= render 'admin/content/attachment', { :attachment_num => 1, :hidden => false } -%>
-
- + + diff --git a/app/views/admin/content/new.html.erb b/app/views/admin/content/new.html.erb index 0283264813..fe7bfce053 100644 --- a/app/views/admin/content/new.html.erb +++ b/app/views/admin/content/new.html.erb @@ -1,3 +1,4 @@ <% @page_heading = _('New article') %> <%= render "admin/shared/edit", { :form_type => "article", :form_action => { :action => "new", :id => @article.id , :class => ('autosave')} } %> +<%= render "admin/shared/merge" %> diff --git a/app/views/admin/shared/_merge.html.erb b/app/views/admin/shared/_merge.html.erb new file mode 100644 index 0000000000..fb1af613d5 --- /dev/null +++ b/app/views/admin/shared/_merge.html.erb @@ -0,0 +1,18 @@ + +
+ <%= form_for @article, url: {controller: "admin/content", action: "merge", id: @article.id }, + :html => { :class => "form" } do |f| %> +

<%= _("Merge Articles") %>

+
+ + Article ID + <%= text_field 'other_article_id', 'other_article_id', + {:autocomplete => 'off', :style => 'width: 30%; margin-left: 10px'} %> + +
+ <%= f.submit "Merge", :class => 'btn' %> +
+
+ + <% end %> +
From 1c341fc7aa849e2d68517e330d1ecfd1d64687a1 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Wed, 30 Mar 2016 14:01:09 -0700 Subject: [PATCH 21/27] Adding better errors and binding of caller --- Gemfile | 2 ++ Gemfile.lock | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/Gemfile b/Gemfile index 771ddb6ce7..0940167aea 100644 --- a/Gemfile +++ b/Gemfile @@ -46,6 +46,8 @@ gem 'acts_as_tree_rails3' gem 'recaptcha', :require => 'recaptcha/rails', :branch => 'rails3' group :development, :test do + gem 'better_errors' + gem 'binding_of_caller' gem 'ruby-debug19' gem 'factory_girl', '~> 2.2' gem 'webrat' diff --git a/Gemfile.lock b/Gemfile.lock index 26794b0ec3..67c9103a1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,6 +34,11 @@ GEM addressable (2.3.2) archive-tar-minitar (0.5.2) arel (2.0.10) + better_errors (0.0.8) + coderay + erubis + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) bluecloth (2.2.0) builder (2.1.2) capybara (1.1.2) @@ -60,6 +65,7 @@ GEM cucumber-rails (>= 1.1.1) daemons (1.1.9) database_cleaner (0.8.0) + debug_inspector (0.0.2) diff-lcs (1.1.3) erubis (2.6.6) abstract (>= 1.0.0) @@ -190,6 +196,8 @@ DEPENDENCIES acts_as_list acts_as_tree_rails3 addressable (~> 2.1) + better_errors + binding_of_caller bluecloth (~> 2.1) capybara coderay (~> 0.9) From 45abe42341942607d0395d99cf6b37d392177b0e Mon Sep 17 00:00:00 2001 From: Dreedle Date: Wed, 30 Mar 2016 14:03:15 -0700 Subject: [PATCH 22/27] Merge article is present for admin but not non-admin (cuke tests pass) --- app/views/admin/content/new.html.erb | 4 +++- features/merge_article_authorization.feature | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/admin/content/new.html.erb b/app/views/admin/content/new.html.erb index fe7bfce053..433bcea7f1 100644 --- a/app/views/admin/content/new.html.erb +++ b/app/views/admin/content/new.html.erb @@ -1,4 +1,6 @@ <% @page_heading = _('New article') %> <%= render "admin/shared/edit", { :form_type => "article", :form_action => { :action => "new", :id => @article.id , :class => ('autosave')} } %> -<%= render "admin/shared/merge" %> +<% if @current_user.admin? %> + <%= render "admin/shared/merge" %> +<% end %> diff --git a/features/merge_article_authorization.feature b/features/merge_article_authorization.feature index 7a43e525e2..08a506fed3 100644 --- a/features/merge_article_authorization.feature +++ b/features/merge_article_authorization.feature @@ -14,17 +14,17 @@ Scenario: Article merge not possible as a non-admin And I am on the articles page When I follow "Edit" Then I should see "Publish settings" - And I should not see "Merge articles" + And I should not see "Merge Articles" Scenario: Article merge possible as an admin Given I am logged into the admin panel And I am on the articles page Given the following article record | title | body | published | user_id | - | "admin article" | "hi here's another" | true | 1 | + | "admin article" | "hi here's another" | true | 1 | And I am on the articles page Then I should see "admin article" When I follow "Edit" Then I should see "Publish settings" - And I should see "Merge articles" + And I should see "Merge Articles" From 77c3b04de6b40ae2ab3024a6a7acd907dfdda7c2 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Wed, 30 Mar 2016 14:19:46 -0700 Subject: [PATCH 23/27] Cuke test passing for feature not accessible when article is new --- app/controllers/admin/content_controller.rb | 20 ++++++++++++++------ app/models/article.rb | 11 ++++++++--- app/views/admin/content/new.html.erb | 2 +- db/db_development | Bin 159744 -> 159744 bytes db/db_test | Bin 225280 -> 155648 bytes features/merge_article.feature | 4 ++-- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/app/controllers/admin/content_controller.rb b/app/controllers/admin/content_controller.rb index 6ef4ebf969..f1571051e2 100644 --- a/app/controllers/admin/content_controller.rb +++ b/app/controllers/admin/content_controller.rb @@ -13,7 +13,7 @@ def auto_complete_for_article_keywords def index @search = params[:search] ? params[:search] : {} - + @articles = Article.search_with_pagination(@search, {:page => params[:page], :per_page => this_blog.admin_display_elements}) if request.xhr? @@ -44,7 +44,7 @@ def destroy flash[:error] = _("Error, you are not allowed to perform this action") return(redirect_to :action => 'index') end - + return(render 'admin/shared/destroy') unless request.post? @record.destroy @@ -52,6 +52,14 @@ def destroy redirect_to :action => 'index' end + def merge + other_article_id = params[:other_article_id] + @article = Article.find(params[:id]) + @article.merge_with(other_article_id) + redirect_to :action => 'index' + end + + def insert_editor editor = 'visual' editor = 'simple' if params[:editor].to_s == 'simple' @@ -77,7 +85,7 @@ def attachment_box_add def attachment_save(attachment) begin - Resource.create(:filename => attachment.original_filename, :mime => attachment.content_type.chomp, + Resource.create(:filename => attachment.original_filename, :mime => attachment.content_type.chomp, :created_at => Time.now).write_to_disk(attachment) rescue => e logger.info(e.message) @@ -92,7 +100,7 @@ def autosave @article.text_filter = current_user.text_filter if current_user.simple_editor? get_fresh_or_existing_draft_for_article - + @article.attributes = params[:article] @article.published = false set_article_author @@ -159,13 +167,13 @@ def new_or_edit @article.keywords = Tag.collection_to_string @article.tags @article.attributes = params[:article] # TODO: Consider refactoring, because double rescue looks... weird. - + @article.published_at = DateTime.strptime(params[:article][:published_at], "%B %e, %Y %I:%M %p GMT%z").utc rescue Time.parse(params[:article][:published_at]).utc rescue nil if request.post? set_article_author save_attachments - + @article.state = "draft" if @article.draft if @article.save diff --git a/app/models/article.rb b/app/models/article.rb index c80469b734..937854f71a 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -71,6 +71,10 @@ def initialize(*args) end end + def merge_with(other_article_id) + puts "Hey we've merged" + end + def set_permalink return if self.state == 'draft' self.permalink = self.title.to_permalink if self.permalink.nil? or self.permalink.empty? @@ -95,6 +99,7 @@ def has_child? include Article::States class << self + def last_draft(article_id) article = Article.find(article_id) while article.has_child? @@ -104,10 +109,10 @@ def last_draft(article_id) end def search_with_pagination(search_hash, paginate_hash) - + state = (search_hash[:state] and ["no_draft", "drafts", "published", "withdrawn", "pending"].include? search_hash[:state]) ? search_hash[:state] : 'no_draft' - - + + list_function = ["Article.#{state}"] + function_search_no_draft(search_hash) if search_hash[:category] and search_hash[:category].to_i > 0 diff --git a/app/views/admin/content/new.html.erb b/app/views/admin/content/new.html.erb index 433bcea7f1..357c6d064e 100644 --- a/app/views/admin/content/new.html.erb +++ b/app/views/admin/content/new.html.erb @@ -1,6 +1,6 @@ <% @page_heading = _('New article') %> <%= render "admin/shared/edit", { :form_type => "article", :form_action => { :action => "new", :id => @article.id , :class => ('autosave')} } %> -<% if @current_user.admin? %> +<% if @current_user.admin? && @article.id %> <%= render "admin/shared/merge" %> <% end %> diff --git a/db/db_development b/db/db_development index dc3b2009c6438d3d6ae795024c15bb4b7f162480..eb9b297e67c5fe5420f6263de52a90ef80dbb3bd 100644 GIT binary patch delta 732 zcmZ{iF-#L-6vy9p-`RRcudhY1Hh|Q@uyFKxcWtkPfR_$zHYPMWh@o7scvyPm?$Ck3 znz$?8;H1$(T}%+qp}I(z9UPeqXyV#P!lDiy5?p|{yuAEh{=fI~UVEEsZ*!0O$;#?L znXIhOzR32V4@|rR@ebyKr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^Gg8TnR4^mu%t$C6rXXP%VJTq=VR0N55f&28BP<}C8;ALXa|mY>&LW(7Bc9Gc z{qkE|!}_aPe--PmWc?NKMwSyUBWxgCO1LBr>j~=!YY7( zB2wW@L@JztNQKi8sc;$+8cwB~LYG39OqWELNS8oo(FN%IbS9mT&P!*|dFb49E;^k~ zqf_Z5ouE_T>@hfd6wW>cXP<<#N9az_9j7}+ca-i3-C??6x*@tjx3Zl6&~?-8r`t!jm#&MhlWq@P2VFbeZn`$QU35F?TIqJsZKvBt*Fv|IZcEgC_0c-S zqzp1ChnSQBCZ#_fsXoGkguR44ga_iVn{YqjKEl0(U2)h+xQDQVu$^%CjgWqo(HeH6 ze%OWjVIB3u8tR8tHWHSEf>2>2V{BwJ-tj4Re3BiH5S}1B9*4&Wj}jgsJWM$JHMcgE z9cQxR3~nu*TT6>?EtPNzVG3a~VNx6>5+)E@gaJZ-9GZkaLNB2~==pSOF4vXV8*%4N u_HRu!J)BLE^{LQI%`!iIN9(wM1k{3X4zBd@G+gP Date: Wed, 30 Mar 2016 15:29:34 -0700 Subject: [PATCH 24/27] Trying to get green on cuke test for succesful merge --- app/controllers/admin/content_controller.rb | 5 ++--- app/models/article.rb | 12 +++++++++++- app/views/admin/shared/_merge.html.erb | 3 +-- db/db_development | Bin 159744 -> 159744 bytes db/db_test | Bin 155648 -> 172032 bytes features/merge_article.feature | 4 ++-- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/content_controller.rb b/app/controllers/admin/content_controller.rb index f1571051e2..770fc6de42 100644 --- a/app/controllers/admin/content_controller.rb +++ b/app/controllers/admin/content_controller.rb @@ -53,10 +53,9 @@ def destroy end def merge - other_article_id = params[:other_article_id] @article = Article.find(params[:id]) - @article.merge_with(other_article_id) - redirect_to :action => 'index' + @article.merge_with(params[:other_article_id]["other_article_id"]) + redirect_to admin_content_path end diff --git a/app/models/article.rb b/app/models/article.rb index 937854f71a..4f00f3ceb1 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -72,7 +72,17 @@ def initialize(*args) end def merge_with(other_article_id) - puts "Hey we've merged" + other_article = Article.find(other_article_id) + Article.transaction do + Comment.transaction do + old_body = self.body + self.body = old_body.concat("

\r\n\t" + other_article.body + "

\r\n") + self.comments << other_article.comments + raise + self.save! + other_article.delete + end + end end def set_permalink diff --git a/app/views/admin/shared/_merge.html.erb b/app/views/admin/shared/_merge.html.erb index fb1af613d5..f96422a0c1 100644 --- a/app/views/admin/shared/_merge.html.erb +++ b/app/views/admin/shared/_merge.html.erb @@ -6,8 +6,7 @@
Article ID - <%= text_field 'other_article_id', 'other_article_id', - {:autocomplete => 'off', :style => 'width: 30%; margin-left: 10px'} %> + <%= text_field "other_article_id", "other_article_id", {:autocomplete => 'off', :style => 'width: 30%; margin-left: 10px'} %>
<%= f.submit "Merge", :class => 'btn' %> diff --git a/db/db_development b/db/db_development index eb9b297e67c5fe5420f6263de52a90ef80dbb3bd..e04985ba7d33ac6826ed8d2e3d0ca9b09fc81452 100644 GIT binary patch delta 2214 zcmai!Ux*V&9LHy~yV0CU=Fa0h<@~c(5!>SCW@mPHW`ndBrC3_pE2SbWh|X>%m(~0^ zl5K7Kk`wyiTWe47t&~#QN0B@f3dQO}=|dk{iXuLUtq*FUNEIn)!Oq;Dn#4Q08)lOH znD2b%J2T(;8=3hVnNKFPQ>VA?*G`>3`o)Xe&x0&HFa!_6Z{bhyGx#aI2|t2Y;a{)? ztMEW~a(XxHWXJVwT1AL*$fM(CUehPFh$mvU*@{Iw4bOx1oAfa);j``3@R+_!Yl(8) z5>XO28*MYYQ4WrpjYKq(c6unUZ_!%uY&B_*W^=MK*J@VcnrQ0~UIh>UkjW^aVN>cP z;{D`EC0_VpCKxeu*)u@j@FmC{gZ_puvuC=$4e#I3$zRtnnAkb~YA#nQWp*Ca0Dusd zc7Um|QY(q0nn*-DiG`&)UarTDy>l<*hBB|cZ8dmZSaCal9X#$)I9WF~_x$`H!Om)m zmK3hVeD9Q+sTyPC_%wD*sF;X;X(U8xyTE|PLD@%Q3m zZz{Prq}&O4BU*Cfn~i~?xQN|?>-#7mYgg*J6ctL8dBN+)mFPYx+ItRGIYvJA2>OdF~ z?r`>^Oo?;Z&dDw2CNKd;$ECrUg8*owlRISCjKclRdR^vHYxxR8qAt$IN$y{-2N`7->0wDQ1NtM@= zlN${M2gg?6;I=-vs(J?I$3+qpm`iBiu;od7ZEEGQXs@Wo}t!bTTwrb@%j)K41eCwYY-kJA@(Mb^MCMecPpu#1E-w zGlYDb3heOE3j>D`qsFIa>pZR%@d`HWbL#k93oKO-`JMvgyyCMi>8e?XMf>4ip%;l&o!3WTL$cI$Q z!kYj->Ivmv;KJPt=JV!Yk{BsN*D}V^nA-sU1OJv$@+Z74>xAoI3h1rzRn0 delta 591 zcmX}pO=uHA6bJB`o!z#ZCVBBALP<&{YENcMHrZrjKx_?)o^sfEw4M~&v$LB)4pCX%4N;0*agk7JEmrpipC`%FpY+`jYy%9Ms39 zetq`C-F}VvV%q%^^3#m=={vb7s+ErEB28;AkEov_TJ4z96b6|BnFI-e z1VI8I6Ci#NABY!Z9Ape+6l4Ts7-R^<12T9<$}f&+!)n&Ac_r4my6D)I>?~B4Laad) z)YJ+&DWDDPQ!hND)b`Gnv$^-$?Z2(enMZ#&&|ePyZJ@s_63u|DgQP)HAZsA2AW4t}$O_0Z$P&mR zNE~DVWFBM=WVS_8or+$3n`Ki_%yL~mly~KVrD)mIkDaiv3t2pJ#t2~@A*2yP3L&h) HtRjSeT5oYE delta 132 zcmZoTz}0YobAl8b!+!<_2DOO_c1#TaHzq{cGwM#>ZSTTp*yOOyfsv(vhl&3iPyvG) z|8M?p+XW1mp7C=7xvJVgLPeZ+Gvfhf1ujF@`3(G5_?PlmPUm~T7_(VWz?60S{8FY= iuEi_|6qd6HFgb8A@w{Q+W#f4RlzhOm{Y?y$2r~eHxFlo% diff --git a/features/merge_article.feature b/features/merge_article.feature index 8e91d093a3..21656a7072 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -17,12 +17,12 @@ Feature: Merge Articles and carried over comments. When I follow "Publisher article" Then I should see "Merge Articles" - When I fill in "Article ID" with "2" + When I fill in "other_article_id" with "2" And I press "Merge" Then I should be on the articles page And I should not see "Admin article" When I follow "Publisher article" - Then I should see "Here is one article. hi here's another" + Then I should see "Here is one article.

\r\n\thi here's another

\r\n" And I should see "Mrs. Usera" And I should not see "Ms. Admin" And I should see "Publisher article" From 096c9e6ec1066aeaf67c9254ead8488be6558055 Mon Sep 17 00:00:00 2001 From: Dreedle Date: Wed, 30 Mar 2016 16:27:27 -0700 Subject: [PATCH 25/27] Improved cuke tests for merge, though no test for author merge yet. Test for bodies combining is currently failing --- app/models/article.rb | 1 - db/db_development | Bin 159744 -> 159744 bytes db/db_test | Bin 172032 -> 155648 bytes features/merge_article.feature | 21 ++++++++++----------- features/step_definitions/web_steps.rb | 10 +++++++++- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index 4f00f3ceb1..66922eb748 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -78,7 +78,6 @@ def merge_with(other_article_id) old_body = self.body self.body = old_body.concat("

\r\n\t" + other_article.body + "

\r\n") self.comments << other_article.comments - raise self.save! other_article.delete end diff --git a/db/db_development b/db/db_development index e04985ba7d33ac6826ed8d2e3d0ca9b09fc81452..f03c2f37d1b383ade562c2f7c4f3736d0669ffd7 100644 GIT binary patch delta 435 zcmZp8z}fJCbAmKu*F+g-#;%PC%KrRpJVMN}jLG?VC8>EO#q5(O`R59<@$%hcVBucP zz?;Qy#=V+n_U4BI&fJrOqXXH165ko5Cohiv$l2(_F2NwpFK#&5K3=lEDlsKDGtZ{L zj+cwG3Jh%YK^!9kLo;0iV_jnd1tTLX6Jsl5Gd(jy6GKZ=+%i>Z7D9K;Gf8^!?%~upZ7U$(`G?~JYN1}Hg*QdKn6$06r)HN zU)RYC*2`HK8|YUdY(O~Q!ob|Z(j2$U=I3i=nRq}B;D68mlK(OP*Uf?lF7vaoGBYx= z09~EO#cY!&`R59<^72e!VCG)J zz?;Qy#=V4R%I1dx&fJrOqXQ?ej{Z>3caPy3gS4o)F)y#9Bd2I6BLf3JKfj|qgTAO^ zQAuWUPHIkKPGVw8Zf2fMfgLXwCx{D#Hu@l*k%6I^u7RHRVWxuolA1m*32L6fsI(&Qi{CS^m7BslZ zyZQNAStcHk4*vK2FZsXnf88v2;4(iONE-`K+kR;WK34u)4E(?NKk>iff5d-lvtq&t Q{`On^jN5PVGpQv20J>yrkN^Mx diff --git a/db/db_test b/db/db_test index 9022f20b0f2b72282b019cd8af6ccae218369f9d..1f8c90e86563733b8b3be221838a90bb03c11029 100644 GIT binary patch delta 972 zcmZwGUr19?90%}w?z#W}>}+bDxsIwOF`gc4+cU#WY8ZB0$+NltG^1uUJm@u_jAtg$AL3dlBP=H zm1@>WQB>26s~b5V#uwWi8{{KdA?g>q(H-fxbJ&9l$@7KNXVRHM zGH*l`7S|#pJ(L_sSe3+JC(5T&!v&*U!B&#XXDyjDuu5aMIG89TQ`vkvX$S~ci36Ez z%6JsZ?Qhm2njX< zcFT6k#;I@BCH11(t9(~pDR-4|B`m*_AImfHfb5Z$rFm&WIxLlm&&12(h!_=q3Jbyo z;keMkf8nq3!~8+Ml3U@Xxucw)!|Y4;9D9JRW4^BIej96h&R;i_gf1!sg5xsz)IpK_Hz#0zh;iejpt{G$8Fjd_cTF z_5x`G(h8&nNHdTeUlNiWwEzGB delta 2231 zcmeIzO-vML7zglqW@bNTcV^z*^0A_|ECPaqi?h413#+iZptztQunI1v)Kyp5)MUvn zhnf&E9C|WomFU<@O_~@rX_Hn;X(CBE*w~~!H8nMD(vuu&(UwbVV!vkl$0kiV_vGbC zo_T)nQ5T$8PR&KV}cuJ$9GfX795CdxxE$ce_$- zt`LnRWvj523fYsHwyZ@DhIDOdIKgOPm&mOiEP#UuAIi6vR~L5TU{*ufbO$0 z^HE*WEZd`IsckSzjYpZM2HI;(uFx=bf^>kyL1G|LkamzZkUb!~ zK_VcnAT1zakPt{SNE1j9Bmm+E(Lr{BG=lg*c7im3XdpX4>Oty2wu97y)PPijYy+tR z@q$!>yacipB$RJJ-2Z#h>2eE-z zK`cd5#rwo!>*F<{Xf@u)ulH2!Ypv#ytWOk=so=dXy7<_l7~>xiMGbX{G-@~e3sggG z#@G^7E~W?htIFkmUR*~>ph2L4zY+BtXP0O*9a_AwKu>t;gXx7i2y+0YXWeweBw+T# zbiwRfH+x|^VLD*qFtMWfl`rmWCc)j|*w^eDJM+KCteCR0=P`R8v;V|QyZkeWdbv~Q z*bO$#QcP1Hsh8BO+NFAwZeS7@^KTAb8$-xnLC8lD z@|O|v5!?eQkfR{OAVVNWKn{Z>K?XqvK>9%rf%Jj&f*b@n0MY}}T_i*0ig|h1qzO*3 p%B%91@^yJynw2KZZ4XNPrV(T_wVvOj$nP-nJB0imfjNx){ssJ6ce(%o diff --git a/features/merge_article.feature b/features/merge_article.feature index 21656a7072..e3de9708d0 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -7,26 +7,25 @@ Feature: Merge Articles Given the blog is set up Given I am logged into the admin panel Given the following article records - | title | body | published | user_id | author | - | "Publisher article" | "Here is one article." | true | 2 | "Mrs. Usera" | - | "Admin article" | "hi here's another" | true | 1 | "Ms. Admin" | - | "Unpublished article" | "I'm not published" | false | 1 | "Ms. Admin" | + | title | body | published | user_id | author | id | + | "Publisher article" | "Here is one article." | true | 2 | "Mrs. Usera" | 100 | + | "Another article" | "hi here's another" | true | 2 | "Ms. Userb" | 101 | + | "Unpublished article" | "I'm not published" | false | 1 | "Ms. Admin" | 102 | And I am on the articles page Scenario: Successful merge of published articles with combined text, authors, and titles, and carried over comments. When I follow "Publisher article" Then I should see "Merge Articles" - When I fill in "other_article_id" with "2" + When I fill in "other_article_id[other_article_id]" with "101" And I press "Merge" Then I should be on the articles page - And I should not see "Admin article" + Then I should see "Publisher article" + And I should not see "Another article" When I follow "Publisher article" - Then I should see "Here is one article.

\r\n\thi here's another

\r\n" - And I should see "Mrs. Usera" - And I should not see "Ms. Admin" - And I should see "Publisher article" - And I should not see "Admin article" + Then I should see "Here is one article" + And I should see "Here is one article.

\r\n\thi here's another

\r\n" + Scenario: Article merge not possible on new articles When I follow "New Article" diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 250ac85a64..b4896663f1 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -47,6 +47,12 @@ def with_scope(locator) :profile_id => 2, :name => 'usera', :state => 'active'}) + User.create!({:login => 'userb', + :password => 'passwordb', + :email => 'userb@gmail.com', + :profile_id => 2, + :name => 'userb', + :state => 'active'}) Category.create!({:name => 'Embarrassing Stories', :keywords => 'mortifying, humiliating', :description => 'the worst.' }) @@ -54,7 +60,9 @@ def with_scope(locator) Given /^the following (.+) records?$/ do |factory, table| table.hashes.each do |hash| - Article.create!(hash) + article = Article.new(hash) + article.id = hash[:id] + article.save! end end From cd29d3b6b232ecd4b4dba620e7fa225221fbbc5f Mon Sep 17 00:00:00 2001 From: Dreedle Date: Wed, 30 Mar 2016 16:35:21 -0700 Subject: [PATCH 26/27] Cuke test passing for combining article text --- app/models/article.rb | 4 +--- features/merge_article.feature | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index 66922eb748..b2204478d0 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -74,13 +74,11 @@ def initialize(*args) def merge_with(other_article_id) other_article = Article.find(other_article_id) Article.transaction do - Comment.transaction do old_body = self.body - self.body = old_body.concat("

\r\n\t" + other_article.body + "

\r\n") + self.body = "#{old_body}

\r\n\t #{other_article.body}

\r\n" self.comments << other_article.comments self.save! other_article.delete - end end end diff --git a/features/merge_article.feature b/features/merge_article.feature index e3de9708d0..e0ce2db68c 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -24,7 +24,7 @@ Feature: Merge Articles And I should not see "Another article" When I follow "Publisher article" Then I should see "Here is one article" - And I should see "Here is one article.

\r\n\thi here's another

\r\n" + And I should see "hi here's another" Scenario: Article merge not possible on new articles From 7b4dbc5279d9f54ba3ceb178c9e9a45dda6feecc Mon Sep 17 00:00:00 2001 From: Dreedle Date: Wed, 30 Mar 2016 16:55:57 -0700 Subject: [PATCH 27/27] Adding conditional to admin new content view to make rspecs pass --- app/views/admin/content/new.html.erb | 3 ++- features/merge_article.feature | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/content/new.html.erb b/app/views/admin/content/new.html.erb index 357c6d064e..57986408e2 100644 --- a/app/views/admin/content/new.html.erb +++ b/app/views/admin/content/new.html.erb @@ -1,6 +1,7 @@ <% @page_heading = _('New article') %> <%= render "admin/shared/edit", { :form_type => "article", :form_action => { :action => "new", :id => @article.id , :class => ('autosave')} } %> -<% if @current_user.admin? && @article.id %> + +<% if @current_user && @current_user.admin? && @article.id %> <%= render "admin/shared/merge" %> <% end %> diff --git a/features/merge_article.feature b/features/merge_article.feature index e0ce2db68c..8a4a2f3ad6 100644 --- a/features/merge_article.feature +++ b/features/merge_article.feature @@ -26,7 +26,6 @@ Feature: Merge Articles Then I should see "Here is one article" And I should see "hi here's another" - Scenario: Article merge not possible on new articles When I follow "New Article" Then I should not see "Merge Articles"