From 4a090c1faf5225ab8c2c0fc7d8aaef4d44b649d0 Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 6 Nov 2015 11:04:50 -0500 Subject: [PATCH 1/3] Update tests/Gemfile Why: There were some deprecation warnings that have been fixed. This change addresses the need by: Removing and replacing superfluous code with better stuff. Also udpated the Gemfile.lock for funsies --- Gemfile.lock | 12 +++++------- spec/controllers/media_controller_spec.rb | 23 +++++++++++++++-------- spec/rails_helper.rb | 1 - 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5b502ab..ccbd271 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,9 @@ PATH remote: . specs: - atomic_cms (0.0.1) + atomic_cms (0.2.2) activeadmin (= 1.0.0.pre2) - angularjs-rails (~> 1.3, < 1.4) - atomic_assets (~> 0.0.4) + atomic_assets (~> 0.1.0) jquery-rails (~> 4.0, >= 4.0.3) paperclip (~> 4.3) rails (~> 4.2) @@ -62,13 +61,12 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - angularjs-rails (1.3.15) arbre (1.0.3) activesupport (>= 3.0.0) arel (6.0.3) - atomic_assets (0.0.4) + atomic_assets (0.1.0) draper (~> 2.1) - bourbon (4.2.5) + bourbon (4.2.6) sass (~> 3.4) thor (~> 0.19) builder (3.2.2) @@ -193,7 +191,7 @@ GEM rspec-mocks (~> 3.3.0) rspec-support (~> 3.3.0) rspec-support (3.3.0) - sass (3.4.18) + sass (3.4.19) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) sass (~> 3.1) diff --git a/spec/controllers/media_controller_spec.rb b/spec/controllers/media_controller_spec.rb index e6f7882..6acf338 100644 --- a/spec/controllers/media_controller_spec.rb +++ b/spec/controllers/media_controller_spec.rb @@ -1,23 +1,30 @@ -require 'rails_helper' +require "rails_helper" RSpec.describe AtomicCms::MediaController, type: :controller do - it 'accepts a post request and fails with bad data' do - scrubber = double('scrubber') + # Previously the engines guide contained an incorrect example that + # recommended using the `use_route` option to test an engine's controllers + # within the dummy application. That recommendation was incorrect and has + # since been corrected. Instead, you should override the `@routes` variable + # in the test case with `Foo::Engine.routes`. + before { @routes = AtomicCms::Engine.routes } + + it "accepts a post request and fails with bad data" do + scrubber = double("scrubber") allow(MediaScrubber).to receive(:new).and_return(scrubber) allow(scrubber).to receive(:save).and_return(false) - post :create, use_route: :atomic_cms, file: double('file') + post :create, file: double("file") expect(response).to have_http_status(:unprocessable_entity) end - it 'accepts a post with an image' do - scrubber = double('scrubber', save: true, url: 'http://www.google.com') + it "accepts a post with an image" do + scrubber = double("scrubber", save: true, url: "http://www.google.com") expect(MediaScrubber).to receive(:new).and_return(scrubber) - post :create, use_route: :atomic_cms, file: double('file') + post :create, file: double("file") expect(response).to have_http_status(:created) - expect(response.body).to include('http://www.google.com') + expect(response.body).to include("http://www.google.com") end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index d1fe6d2..7a80480 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -5,7 +5,6 @@ abort("The Rails environment is running in production mode!") if Rails.env.production? require 'spec_helper' require 'rspec/rails' -require 'rspec/autorun' require 'factory_girl_rails' require 'shoulda/matchers' require 'paperclip/matchers' From fe3bf56715856ba4ff29525aa0a32dd03bd9919a Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 6 Nov 2015 11:28:36 -0500 Subject: [PATCH 2/3] Remove name from correct element Why: We don't want the editing tools to have a name attr. This change addresses the need by: Removing the name attr from the child select input. --- app/assets/javascripts/atomic_cms.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/atomic_cms.js b/app/assets/javascripts/atomic_cms.js index 50aedfe..95103ec 100644 --- a/app/assets/javascripts/atomic_cms.js +++ b/app/assets/javascripts/atomic_cms.js @@ -166,13 +166,14 @@ $editor.find('.add-children-sublist-item').each(function() { var $input = $(this); - $input.attr('name', null).val(''); + var $componentInput = $input.siblings('.children-sublist'); + $componentInput.attr('name', null).val(''); $input.click(function(e) { e.preventDefault(); - var component = $(this).siblings('.children-sublist').val(); - if (component !== ''){ + var componentPath = $componentInput.val(); + if (componentPath !== ''){ $scope.$broadcast('append', { - href: component + href: componentPath }); } }); From 033e0b440f2ada57aa76a6956a6b6eb49d3a91a0 Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 6 Nov 2015 11:57:56 -0500 Subject: [PATCH 3/3] Update gemspec Why: We want to credit spartan with authorship. This change addresses the need by: Crediting Spartan and our email with gem creatorship --- atomic_cms.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atomic_cms.gemspec b/atomic_cms.gemspec index b48b083..95a7f9a 100644 --- a/atomic_cms.gemspec +++ b/atomic_cms.gemspec @@ -4,8 +4,8 @@ Gem::Specification.new do |s| s.date = '2015-06-19' s.summary = 'Atomic CMS' s.description = 'Live CMS powered by atomic assets.' - s.authors = ['Don Humphreys'] - s.email = 'dhumphreys88@gmail.com' + s.authors = ['Don Humphreys', 'Spartan'] + s.email = 'spartan-helot@spartansystems.co' s.files = `git ls-files`.split(/\n/) s.test_files = Dir['spec/**/*'] # s.homepage = 'http://rubygems.org/gems/atomic_cms'