diff --git a/.gitignore b/.gitignore index 417560f..102b015 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/.bundle/ +.bundle/ /.yardoc /Gemfile.lock /_yardoc/ @@ -9,3 +9,4 @@ /log tmp .DS_Store +log/ diff --git a/.travis.yml b/.travis.yml index 4872a16..97e7558 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ env: - "RAILS_VERSION=4.2" - "RAILS_VERSION=5.0" - "RAILS_VERSION=5.1" + - "RAILS_VERSION=5.2" matrix: fast_finish: true exclude: diff --git a/test/rails4.2/.gitignore b/test/rails4.2/.gitignore deleted file mode 100644 index 280c06b..0000000 --- a/test/rails4.2/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# See https://help.github.com/articles/ignoring-files for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' - -# Ignore bundler config. -/.bundle - -# Ignore all logfiles and tempfiles. -/log/* -!/log/.keep -/tmp \ No newline at end of file diff --git a/test/rails5.0/.gitignore b/test/rails5.0/.gitignore deleted file mode 100644 index 280c06b..0000000 --- a/test/rails5.0/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# See https://help.github.com/articles/ignoring-files for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' - -# Ignore bundler config. -/.bundle - -# Ignore all logfiles and tempfiles. -/log/* -!/log/.keep -/tmp \ No newline at end of file diff --git a/test/rails5.1/.gitignore b/test/rails5.1/.gitignore deleted file mode 100644 index 280c06b..0000000 --- a/test/rails5.1/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# See https://help.github.com/articles/ignoring-files for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' - -# Ignore bundler config. -/.bundle - -# Ignore all logfiles and tempfiles. -/log/* -!/log/.keep -/tmp \ No newline at end of file diff --git a/test/rails5.2/Gemfile b/test/rails5.2/Gemfile new file mode 100644 index 0000000..69d0111 --- /dev/null +++ b/test/rails5.2/Gemfile @@ -0,0 +1,20 @@ +source 'https://rubygems.org' + +gem 'rails', '~> 5.2.0' + +gem "my_engine", path: "engines/my_engine" + +gem 'sass-rails' +gem "sprockets" + +group :development, :test do + gem "minitest-spec-rails" + gem "capybara_minitest_spec" +end + +gem "cells", ">= 4.1.6" +# gem "cells", path: "../../../cells"# ">= 4.1.0" +gem "cells-rails", path: "../../../cells-rails"# ">= 4.1.0" +gem "cells-erb" +gem "simple_form" +gem "formtastic" diff --git a/test/rails5.2/Gemfile.lock b/test/rails5.2/Gemfile.lock new file mode 100644 index 0000000..abb71ce --- /dev/null +++ b/test/rails5.2/Gemfile.lock @@ -0,0 +1,198 @@ +PATH + remote: ../.. + specs: + cells-rails (0.0.9) + actionpack (>= 3.0) + cells (>= 4.1.6, < 5.0.0) + +PATH + remote: engines/my_engine + specs: + my_engine (0.0.1) + cells (>= 4.0.0.beta5) + cells-erb + rails (>= 4.2.1) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.0) + actionpack (= 5.2.0) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.0) + actionpack (= 5.2.0) + actionview (= 5.2.0) + activejob (= 5.2.0) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.0) + actionview (= 5.2.0) + activesupport (= 5.2.0) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.0) + activesupport (= 5.2.0) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.0) + activesupport (= 5.2.0) + globalid (>= 0.3.6) + activemodel (5.2.0) + activesupport (= 5.2.0) + activerecord (5.2.0) + activemodel (= 5.2.0) + activesupport (= 5.2.0) + arel (>= 9.0) + activestorage (5.2.0) + actionpack (= 5.2.0) + activerecord (= 5.2.0) + marcel (~> 0.3.1) + activesupport (5.2.0) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + arel (9.0.0) + builder (3.2.3) + capybara (3.0.2) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + xpath (~> 3.0) + capybara_minitest_spec (1.0.7) + capybara (>= 2) + minitest (>= 4) + cells (4.1.7) + declarative-builder (< 0.2.0) + declarative-option (< 0.2.0) + tilt (>= 1.4, < 3) + uber (< 0.2.0) + cells-erb (0.1.0) + cells (~> 4.0) + erbse (>= 0.1.1) + concurrent-ruby (1.0.5) + crass (1.0.4) + declarative-builder (0.1.0) + declarative-option (< 0.2.0) + declarative-option (0.1.0) + erbse (0.1.3) + temple + erubi (1.7.1) + ffi (1.9.23) + formtastic (3.1.5) + actionpack (>= 3.2.13) + globalid (0.4.1) + activesupport (>= 4.2.0) + i18n (1.0.1) + concurrent-ruby (~> 1.0) + loofah (2.2.2) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.0) + mini_mime (>= 0.1.1) + marcel (0.3.2) + mimemagic (~> 0.3.2) + method_source (0.9.0) + mimemagic (0.3.2) + mini_mime (1.0.0) + mini_portile2 (2.3.0) + minitest (5.11.3) + minitest-spec-rails (5.4.0) + minitest (~> 5.0) + rails (>= 4.1) + nio4r (2.3.0) + nokogiri (1.8.2) + mini_portile2 (~> 2.3.0) + public_suffix (3.0.2) + rack (2.0.5) + rack-test (1.0.0) + rack (>= 1.0, < 3) + rails (5.2.0) + actioncable (= 5.2.0) + actionmailer (= 5.2.0) + actionpack (= 5.2.0) + actionview (= 5.2.0) + activejob (= 5.2.0) + activemodel (= 5.2.0) + activerecord (= 5.2.0) + activestorage (= 5.2.0) + activesupport (= 5.2.0) + bundler (>= 1.3.0) + railties (= 5.2.0) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.2.0) + actionpack (= 5.2.0) + activesupport (= 5.2.0) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.1) + rb-fsevent (0.10.3) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + sass (3.5.6) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.0.7) + railties (>= 4.0.0, < 6) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + simple_form (4.0.0) + actionpack (> 4) + activemodel (> 4) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + temple (0.8.0) + thor (0.20.0) + thread_safe (0.3.6) + tilt (2.0.8) + tzinfo (1.2.5) + thread_safe (~> 0.1) + uber (0.1.0) + websocket-driver (0.7.0) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + xpath (3.0.0) + nokogiri (~> 1.8) + +PLATFORMS + ruby + +DEPENDENCIES + capybara_minitest_spec + cells (>= 4.1.6) + cells-erb + cells-rails! + formtastic + minitest-spec-rails + my_engine! + rails (~> 5.2.0) + sass-rails + simple_form + sprockets + +BUNDLED WITH + 1.16.1 diff --git a/test/rails5.2/Rakefile b/test/rails5.2/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/test/rails5.2/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/test/rails5.2/app/assets/images/.keep b/test/rails5.2/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/rails5.2/app/assets/images/logo.jpeg b/test/rails5.2/app/assets/images/logo.jpeg new file mode 100644 index 0000000..7bd23cc Binary files /dev/null and b/test/rails5.2/app/assets/images/logo.jpeg differ diff --git a/test/rails5.2/app/assets/stylesheets/application.css.erb b/test/rails5.2/app/assets/stylesheets/application.css.erb new file mode 100644 index 0000000..75503dc --- /dev/null +++ b/test/rails5.2/app/assets/stylesheets/application.css.erb @@ -0,0 +1,19 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + *= require user + *= require song + */ +<%# capture do %> +<%# end %> \ No newline at end of file diff --git a/test/rails5.2/app/cells/form_for/show.erb b/test/rails5.2/app/cells/form_for/show.erb new file mode 100644 index 0000000..98c427d --- /dev/null +++ b/test/rails5.2/app/cells/form_for/show.erb @@ -0,0 +1,7 @@ +<%= form_for Song.new do |f| %> + First + <%= f.text_field :id %> + <%= f.fields_for :artist do |a| %> + <%= a.text_field :id %> + <% end %> +<% end %> \ No newline at end of file diff --git a/test/rails5.2/app/cells/form_for_cell.rb b/test/rails5.2/app/cells/form_for_cell.rb new file mode 100644 index 0000000..b62f5e9 --- /dev/null +++ b/test/rails5.2/app/cells/form_for_cell.rb @@ -0,0 +1,7 @@ +class FormForCell < Cell::ViewModel + include ActionView::RecordIdentifier + + def show + render + end +end diff --git a/test/rails5.2/app/cells/form_tag/show.erb b/test/rails5.2/app/cells/form_tag/show.erb new file mode 100644 index 0000000..62785ca --- /dev/null +++ b/test/rails5.2/app/cells/form_tag/show.erb @@ -0,0 +1,5 @@ +<%= form_tag songs_path do %> + Second + <%= text_field_tag :id %> + <%= submit_tag "Save" %> +<% end %> diff --git a/test/rails5.2/app/cells/form_tag_cell.rb b/test/rails5.2/app/cells/form_tag_cell.rb new file mode 100644 index 0000000..e8503b0 --- /dev/null +++ b/test/rails5.2/app/cells/form_tag_cell.rb @@ -0,0 +1,5 @@ +class FormTagCell < Cell::ViewModel + def show + render + end +end diff --git a/test/rails5.2/app/cells/formtastic/show.erb b/test/rails5.2/app/cells/formtastic/show.erb new file mode 100644 index 0000000..2c69990 --- /dev/null +++ b/test/rails5.2/app/cells/formtastic/show.erb @@ -0,0 +1,12 @@ +<%= semantic_form_for Song.new do |f| %> + First + <%= f.input :id %> + <%= f.semantic_fields_for :artist do |a| %> + <%= a.input :id %> + <% end %> + + <%= f.actions do %> + <%= f.submit 'Go!', as: :button, class: 'btn btn-primary' %> + <% end %> + +<% end %> \ No newline at end of file diff --git a/test/rails5.2/app/cells/formtastic_cell.rb b/test/rails5.2/app/cells/formtastic_cell.rb new file mode 100644 index 0000000..7e126ae --- /dev/null +++ b/test/rails5.2/app/cells/formtastic_cell.rb @@ -0,0 +1,9 @@ +class FormtasticCell < Cell::ViewModel + include ActionView::RecordIdentifier + include Formtastic::Helpers::FormHelper + include ActionView::Helpers::FormOptionsHelper + + def show + render + end +end diff --git a/test/rails5.2/app/cells/simple_form/show.erb b/test/rails5.2/app/cells/simple_form/show.erb new file mode 100644 index 0000000..d2236f5 --- /dev/null +++ b/test/rails5.2/app/cells/simple_form/show.erb @@ -0,0 +1,7 @@ +<%= simple_form_for Song.new do |f| %> + First + <%= f.input :id %> + <%= f.fields_for :artist do |a| %> + <%= a.input :id %> + <% end %> +<% end %> \ No newline at end of file diff --git a/test/rails5.2/app/cells/simple_form_cell.rb b/test/rails5.2/app/cells/simple_form_cell.rb new file mode 100644 index 0000000..f3c1f3f --- /dev/null +++ b/test/rails5.2/app/cells/simple_form_cell.rb @@ -0,0 +1,11 @@ +class SimpleFormCell < Cell::ViewModel + include ActionView::RecordIdentifier + include SimpleForm::ActionViewExtensions::FormHelper + + # include ActiveSupport::Configurable + # include ActionController::RequestForgeryProtection # FIXME: this does NOT activate any protection. + + def show + render + end +end diff --git a/test/rails5.2/app/cells/song/song.css b/test/rails5.2/app/cells/song/song.css new file mode 100644 index 0000000..da39d11 --- /dev/null +++ b/test/rails5.2/app/cells/song/song.css @@ -0,0 +1 @@ +.song { background: red; } \ No newline at end of file diff --git a/test/rails5.2/app/cells/song/with_escaped.erb b/test/rails5.2/app/cells/song/with_escaped.erb new file mode 100644 index 0000000..8bd1683 --- /dev/null +++ b/test/rails5.2/app/cells/song/with_escaped.erb @@ -0,0 +1 @@ +<%= title %> \ No newline at end of file diff --git a/test/rails5.2/app/cells/song_cell.rb b/test/rails5.2/app/cells/song_cell.rb new file mode 100644 index 0000000..958a6ac --- /dev/null +++ b/test/rails5.2/app/cells/song_cell.rb @@ -0,0 +1,18 @@ +class SongCell < Cell::ViewModel + include Escaped + property :title + + def show + "happy" + end + + def with_escaped + render + end + # include ActionView::Helpers::AssetUrlHelper + # include Sprockets::Rails::Helper + + # self.assets_prefix = Rails.application.config.assets.prefix + # self.assets_environment = Rails.application.assets + # self.digest_assets = Rails.application.config.assets[:digest] +end \ No newline at end of file diff --git a/test/rails5.2/app/controllers/application_controller.rb b/test/rails5.2/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/test/rails5.2/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/test/rails5.2/app/controllers/concerns/.keep b/test/rails5.2/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/rails5.2/app/controllers/index_controller.rb b/test/rails5.2/app/controllers/index_controller.rb new file mode 100644 index 0000000..3f52a60 --- /dev/null +++ b/test/rails5.2/app/controllers/index_controller.rb @@ -0,0 +1,7 @@ +class IndexController < ApplicationController + + def index + end + +end + diff --git a/test/rails5.2/app/controllers/musician_controller.rb b/test/rails5.2/app/controllers/musician_controller.rb new file mode 100644 index 0000000..3bca1d5 --- /dev/null +++ b/test/rails5.2/app/controllers/musician_controller.rb @@ -0,0 +1,29 @@ +class MusicianController < ActionController::Base + def view_with_concept_with_show + render inline: %{<%= concept("view_extensions_test/cell", "Up For Breakfast", volume: 1).show %>} # TODO: concept doesn't need .call + end + + def view_with_concept_without_call + render inline: %{<%= concept("view_extensions_test/cell", "A Tale That Wasn't Right") %>} # this tests ViewModel#to_s. + end + + def view_with_concept_with_call + render inline: %{<%= concept("view_extensions_test/cell", "A Tale That Wasn't Right").call %>} + end + + def view_with_cell_with_call + render inline: %{<%= cell("view_extensions_test/song", "A Tale That Wasn't Right").call %>} + end + + def view_with_collection_without_call + render inline: %{<%= cell("view_extensions_test/song", collection: ["A Tale That Wasn't Right"]) %>} + end + + def action_with_concept_with_call + render plain: concept("view_extensions_test/cell", "A Tale That Wasn't Right").call + end + + def action_with_cell_with_call + render plain: cell("view_extensions_test/song", "A Tale That Wasn't Right").call + end +end diff --git a/test/rails5.2/app/controllers/songs_controller.rb b/test/rails5.2/app/controllers/songs_controller.rb new file mode 100644 index 0000000..326ca9b --- /dev/null +++ b/test/rails5.2/app/controllers/songs_controller.rb @@ -0,0 +1,32 @@ +class SongsController < ApplicationController + def show + # renders show.html.haml + end + + def index + render plain: cell(:song).() + end + + def new + render plain: cell(:song).url_for(Song.new) + end + + def edit + render plain: cell(:song).video_path(1) + end + + def with + method = params[:song][:method] + args = params[:song][:args] + + render plain: cell("songs_controller/asset").send(method, args) + end + + def with_escaped + render layout: false + end + + require "cell/helper/asset_helper" + class AssetCell < Cell::ViewModel + end +end diff --git a/test/rails5.2/app/helpers/application_helper.rb b/test/rails5.2/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/test/rails5.2/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/test/rails5.2/app/mailers/.keep b/test/rails5.2/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/rails5.2/app/models/.keep b/test/rails5.2/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/rails5.2/app/models/artist.rb b/test/rails5.2/app/models/artist.rb new file mode 100644 index 0000000..2a53e6a --- /dev/null +++ b/test/rails5.2/app/models/artist.rb @@ -0,0 +1,25 @@ +class Artist + require "active_model" + include ActiveModel::Conversion + include ActiveModel::Naming + + def persisted? + true + end + + def parents + [] + end + + def name + "artist" + end + + def id + 1 + end + + # def artist + # Artist.new + # end +end diff --git a/test/rails5.2/app/models/concerns/.keep b/test/rails5.2/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/rails5.2/app/models/song.rb b/test/rails5.2/app/models/song.rb new file mode 100644 index 0000000..93a2a58 --- /dev/null +++ b/test/rails5.2/app/models/song.rb @@ -0,0 +1,25 @@ +class Song < OpenStruct + require "active_model" + include ActiveModel::Conversion + extend ActiveModel::Naming + + def persisted? + true + end + + def parents + [] + end + + def name + "song" + end + + def id + 1 + end + + def artist + Artist.new + end +end diff --git a/test/rails5.2/app/views/index/index.html.erb b/test/rails5.2/app/views/index/index.html.erb new file mode 100644 index 0000000..aeabffc --- /dev/null +++ b/test/rails5.2/app/views/index/index.html.erb @@ -0,0 +1,6 @@ +