cells 4.0.5 → 4.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -14
  3. data/CHANGES.md +34 -7
  4. data/Gemfile +2 -2
  5. data/README.md +18 -88
  6. data/benchmarks/class_builder.rb +37 -0
  7. data/benchmarks/collection.rb +47 -0
  8. data/cells.gemspec +5 -7
  9. data/lib/cell.rb +2 -11
  10. data/lib/cell/builder.rb +16 -0
  11. data/lib/cell/collection.rb +54 -0
  12. data/lib/cell/concept.rb +6 -7
  13. data/lib/cell/escaped.rb +1 -0
  14. data/lib/cell/layout.rb +50 -14
  15. data/lib/cell/testing.rb +6 -5
  16. data/lib/cell/util.rb +10 -1
  17. data/lib/cell/version.rb +1 -1
  18. data/lib/cell/view_model.rb +27 -56
  19. data/lib/cells.rb +1 -1
  20. data/test/builder_test.rb +4 -2
  21. data/test/cell_test.rb +9 -2
  22. data/test/concept_test.rb +9 -16
  23. data/test/context_test.rb +33 -0
  24. data/test/fixtures/cell_test/song/show_with_block.erb +1 -0
  25. data/test/fixtures/comment/layout/show.erb +1 -0
  26. data/test/fixtures/comment/show/show.erb +1 -0
  27. data/test/fixtures/song/with_block.erb +1 -0
  28. data/test/layout_test.rb +34 -1
  29. data/test/prefixes_test.rb +3 -3
  30. data/test/public_test.rb +43 -9
  31. data/test/render_test.rb +7 -3
  32. data/test/test_helper.rb +2 -38
  33. data/test/{test_case_test.rb → testing_test.rb} +2 -2
  34. metadata +16 -159
  35. data/gemfiles/rails3.2.gemfile +0 -16
  36. data/gemfiles/rails4.0.gemfile +0 -12
  37. data/gemfiles/rails4.1.gemfile +0 -12
  38. data/gemfiles/rails4.2.gemfile +0 -10
  39. data/lib/cell/caching/notification.rb +0 -15
  40. data/lib/cell/rails.rb +0 -98
  41. data/lib/cell/railtie.rb +0 -69
  42. data/lib/cell/test_case.rb +0 -12
  43. data/lib/cell/translation.rb +0 -19
  44. data/lib/rails/generators/cell/cell_generator.rb +0 -43
  45. data/lib/rails/generators/cell/templates/cell.rb.erb +0 -8
  46. data/lib/rails/generators/cell/templates/view.erb +0 -7
  47. data/lib/rails/generators/cell/templates/view.haml +0 -4
  48. data/lib/rails/generators/cell/templates/view.slim +0 -2
  49. data/lib/rails/generators/concept/concept_generator.rb +0 -38
  50. data/lib/rails/generators/concept/templates/concept.rb.erb +0 -7
  51. data/lib/rails/generators/concept/templates/view.erb +0 -7
  52. data/lib/rails/generators/concept/templates/view.haml +0 -4
  53. data/lib/rails/generators/concept/templates/view.slim +0 -2
  54. data/lib/rails/generators/test_unit/cell/cell_generator.rb +0 -21
  55. data/lib/rails/generators/test_unit/cell/templates/unit_test.rb.erb +0 -11
  56. data/lib/rails/generators/test_unit/concept/concept_generator.rb +0 -21
  57. data/lib/rails/generators/test_unit/concept/templates/unit_test.rb.erb +0 -11
  58. data/test/caching_test.rb +0 -305
  59. data/test/cell_generator_test.rb +0 -90
  60. data/test/concept_generator_test.rb +0 -40
  61. data/test/dummy/Rakefile +0 -7
  62. data/test/dummy/app/assets/javascripts/application.js +0 -2
  63. data/test/dummy/app/cells/album/assets/album.js +0 -1
  64. data/test/dummy/app/concepts/song/assets/songs.js +0 -1
  65. data/test/dummy/app/controllers/application_controller.rb +0 -4
  66. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  67. data/test/dummy/app/views/musician/featured.html.erb +0 -1
  68. data/test/dummy/app/views/musician/featured_with_block.html.erb +0 -4
  69. data/test/dummy/app/views/musician/hamlet.html.erb +0 -1
  70. data/test/dummy/app/views/musician/title.erb +0 -1
  71. data/test/dummy/config.ru +0 -4
  72. data/test/dummy/config/application.rb +0 -41
  73. data/test/dummy/config/boot.rb +0 -10
  74. data/test/dummy/config/database.yml +0 -22
  75. data/test/dummy/config/environment.rb +0 -5
  76. data/test/dummy/config/locales/en.yml +0 -5
  77. data/test/dummy/config/routes.rb +0 -5
  78. data/test/dummy/script/rails +0 -6
  79. data/test/rails/translation_test.rb +0 -45
  80. data/test/rails4.2/.gitignore +0 -13
  81. data/test/rails4.2/Gemfile +0 -18
  82. data/test/rails4.2/README.rdoc +0 -3
  83. data/test/rails4.2/Rakefile +0 -6
  84. data/test/rails4.2/app/assets/images/.keep +0 -0
  85. data/test/rails4.2/app/assets/stylesheets/application.css.erb +0 -19
  86. data/test/rails4.2/app/cells/form_for/show.erb +0 -7
  87. data/test/rails4.2/app/cells/form_for_cell.rb +0 -7
  88. data/test/rails4.2/app/cells/form_tag/show.erb +0 -5
  89. data/test/rails4.2/app/cells/form_tag_cell.rb +0 -5
  90. data/test/rails4.2/app/cells/formtastic/show.erb +0 -12
  91. data/test/rails4.2/app/cells/formtastic_cell.rb +0 -9
  92. data/test/rails4.2/app/cells/simple_form/show.erb +0 -7
  93. data/test/rails4.2/app/cells/simple_form_cell.rb +0 -11
  94. data/test/rails4.2/app/cells/song/song.css +0 -1
  95. data/test/rails4.2/app/cells/song/with_escaped.erb +0 -1
  96. data/test/rails4.2/app/cells/song_cell.rb +0 -18
  97. data/test/rails4.2/app/controllers/application_controller.rb +0 -5
  98. data/test/rails4.2/app/controllers/concerns/.keep +0 -0
  99. data/test/rails4.2/app/controllers/index_controller.rb +0 -7
  100. data/test/rails4.2/app/controllers/songs_controller.rb +0 -25
  101. data/test/rails4.2/app/helpers/application_helper.rb +0 -2
  102. data/test/rails4.2/app/mailers/.keep +0 -0
  103. data/test/rails4.2/app/models/.keep +0 -0
  104. data/test/rails4.2/app/models/artist.rb +0 -25
  105. data/test/rails4.2/app/models/concerns/.keep +0 -0
  106. data/test/rails4.2/app/models/song.rb +0 -25
  107. data/test/rails4.2/app/views/index/index.html.erb +0 -6
  108. data/test/rails4.2/app/views/layouts/application.html.erb +0 -13
  109. data/test/rails4.2/app/views/songs/show.html.erb +0 -1
  110. data/test/rails4.2/app/views/songs/with_escaped.html.erb +0 -1
  111. data/test/rails4.2/bin/bundle +0 -3
  112. data/test/rails4.2/bin/rails +0 -4
  113. data/test/rails4.2/bin/rake +0 -4
  114. data/test/rails4.2/bin/setup +0 -29
  115. data/test/rails4.2/config.ru +0 -4
  116. data/test/rails4.2/config/application.rb +0 -38
  117. data/test/rails4.2/config/boot.rb +0 -3
  118. data/test/rails4.2/config/environment.rb +0 -5
  119. data/test/rails4.2/config/environments/development.rb +0 -25
  120. data/test/rails4.2/config/environments/production.rb +0 -64
  121. data/test/rails4.2/config/environments/test.rb +0 -42
  122. data/test/rails4.2/config/initializers/backtrace_silencers.rb +0 -7
  123. data/test/rails4.2/config/initializers/cookies_serializer.rb +0 -3
  124. data/test/rails4.2/config/initializers/filter_parameter_logging.rb +0 -4
  125. data/test/rails4.2/config/initializers/formtastic.rb +0 -2
  126. data/test/rails4.2/config/initializers/inflections.rb +0 -16
  127. data/test/rails4.2/config/initializers/mime_types.rb +0 -4
  128. data/test/rails4.2/config/initializers/session_store.rb +0 -3
  129. data/test/rails4.2/config/initializers/wrap_parameters.rb +0 -9
  130. data/test/rails4.2/config/locales/en.yml +0 -23
  131. data/test/rails4.2/config/routes.rb +0 -9
  132. data/test/rails4.2/config/secrets.yml +0 -22
  133. data/test/rails4.2/db/seeds.rb +0 -7
  134. data/test/rails4.2/engines/my_engine/.gitignore +0 -3
  135. data/test/rails4.2/engines/my_engine/Gemfile +0 -15
  136. data/test/rails4.2/engines/my_engine/MIT-LICENSE +0 -20
  137. data/test/rails4.2/engines/my_engine/README.rdoc +0 -3
  138. data/test/rails4.2/engines/my_engine/Rakefile +0 -24
  139. data/test/rails4.2/engines/my_engine/app/assets/images/my_engine/.keep +0 -0
  140. data/test/rails4.2/engines/my_engine/app/assets/stylesheets/my_engine/application.css +0 -15
  141. data/test/rails4.2/engines/my_engine/app/concepts/user/cell.rb +0 -8
  142. data/test/rails4.2/engines/my_engine/app/concepts/user/views/show.erb +0 -1
  143. data/test/rails4.2/engines/my_engine/app/concepts/user/views/user.scss +0 -3
  144. data/test/rails4.2/engines/my_engine/app/controllers/my_engine/application_controller.rb +0 -4
  145. data/test/rails4.2/engines/my_engine/app/controllers/my_engine/user_controller.rb +0 -7
  146. data/test/rails4.2/engines/my_engine/app/helpers/my_engine/application_helper.rb +0 -4
  147. data/test/rails4.2/engines/my_engine/app/models/my_engine/user.rb +0 -4
  148. data/test/rails4.2/engines/my_engine/app/views/layouts/my_engine/application.html.erb +0 -14
  149. data/test/rails4.2/engines/my_engine/app/views/my_engine/user/show.html.erb +0 -3
  150. data/test/rails4.2/engines/my_engine/bin/rails +0 -12
  151. data/test/rails4.2/engines/my_engine/config/routes.rb +0 -3
  152. data/test/rails4.2/engines/my_engine/db/migrate/20150530135920_create_my_engine_users.rb +0 -8
  153. data/test/rails4.2/engines/my_engine/lib/my_engine.rb +0 -6
  154. data/test/rails4.2/engines/my_engine/lib/my_engine/engine.rb +0 -9
  155. data/test/rails4.2/engines/my_engine/lib/my_engine/version.rb +0 -3
  156. data/test/rails4.2/engines/my_engine/lib/tasks/my_engine_tasks.rake +0 -4
  157. data/test/rails4.2/engines/my_engine/my_engine.gemspec +0 -24
  158. data/test/rails4.2/engines/my_engine/test/fixtures/my_engine/users.yml +0 -11
  159. data/test/rails4.2/engines/my_engine/test/models/my_engine/user_test.rb +0 -9
  160. data/test/rails4.2/lib/assets/.keep +0 -0
  161. data/test/rails4.2/lib/tasks/.keep +0 -0
  162. data/test/rails4.2/log/.keep +0 -0
  163. data/test/rails4.2/test/integration/asset_pipeline_test.rb +0 -17
  164. data/test/rails4.2/test/integration/controller_test.rb +0 -16
  165. data/test/rails4.2/test/integration/form_for_test.rb +0 -10
  166. data/test/rails4.2/test/integration/form_tag_test.rb +0 -11
  167. data/test/rails4.2/test/integration/formtastic_test.rb +0 -12
  168. data/test/rails4.2/test/integration/simple_form_test.rb +0 -11
  169. data/test/rails4.2/test/integration/url_helper_test.rb +0 -47
  170. data/test/rails4.2/test/test_helper.rb +0 -14
  171. data/test/rails4.2/vendor/assets/stylesheets/.keep +0 -0
  172. data/test/rails_extensions_test.rb +0 -51
@@ -1,20 +0,0 @@
1
- Copyright 2015 Alexander Huber
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,3 +0,0 @@
1
- = MyEngine
2
-
3
- This project rocks and uses MIT-LICENSE.
@@ -1,24 +0,0 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'MyEngine'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
-
18
-
19
- load 'rails/tasks/statistics.rake'
20
-
21
-
22
-
23
- Bundler::GemHelper.install_tasks
24
-
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,8 +0,0 @@
1
- class User::Cell < Cell::Concept
2
- view_paths << "#{MyEngine::Engine.root}/app/concepts"
3
-
4
- def show
5
- # return _prefixes.inspect
6
- render#(view: :show)
7
- end
8
- end
@@ -1 +0,0 @@
1
- <%= "Just an empty view, rendered by a cell..." %>
@@ -1,3 +0,0 @@
1
- user {
2
- background: green;
3
- }
@@ -1,4 +0,0 @@
1
- module MyEngine
2
- class ApplicationController < ActionController::Base
3
- end
4
- end
@@ -1,7 +0,0 @@
1
- module MyEngine
2
- class UserController < MyEngine::ApplicationController
3
-
4
- def show
5
- end
6
- end
7
- end
@@ -1,4 +0,0 @@
1
- module MyEngine
2
- module ApplicationHelper
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module MyEngine
2
- class User
3
- end
4
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>MyEngine</title>
5
- <%= stylesheet_link_tag "my_engine/application", media: "all" %>
6
- <%= javascript_include_tag "my_engine/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,3 +0,0 @@
1
- <%- @user = MyEngine::User.new %>
2
-
3
- <%= concept("user/cell", @user) %>
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
-
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/my_engine/engine', __FILE__)
6
-
7
- # Set up gems listed in the Gemfile.
8
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
-
11
- require 'rails/all'
12
- require 'rails/engine/commands'
@@ -1,3 +0,0 @@
1
- MyEngine::Engine.routes.draw do
2
- get "user" => "user#show"
3
- end
@@ -1,8 +0,0 @@
1
- class CreateMyEngineUsers < ActiveRecord::Migration
2
- def change
3
- create_table :my_engine_users do |t|
4
-
5
- t.timestamps null: false
6
- end
7
- end
8
- end
@@ -1,6 +0,0 @@
1
- require "my_engine/engine"
2
-
3
- module MyEngine
4
- # This also works
5
- # Cell::Concept.view_paths << File.expand_path("#{MyEngine::Engine.root}/app/concepts", __FILE__)
6
- end
@@ -1,9 +0,0 @@
1
- require "cells"
2
- puts "eingiiiiiiine loaded"
3
- module MyEngine
4
- class Engine < ::Rails::Engine
5
- isolate_namespace MyEngine
6
- # This also works
7
- # Cell::Concept.view_paths << File.expand_path("#{MyEngine::Engine.root}/app/concepts", __FILE__)
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- module MyEngine
2
- VERSION = "0.0.1"
3
- end
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :my_engine do
3
- # # Task goes here
4
- # end
@@ -1,24 +0,0 @@
1
- $:.push File.expand_path("../lib", __FILE__)
2
-
3
- # Maintain your gem's version:
4
- require "my_engine/version"
5
-
6
- # Describe your gem and declare its dependencies:
7
- Gem::Specification.new do |s|
8
- s.name = "my_engine"
9
- s.version = MyEngine::VERSION
10
- s.authors = ["Alexander Huber"]
11
- s.email = ["alih83@gmx.de"]
12
- s.homepage = "https://github.com/apotonick/cells"
13
- s.summary = "Summary of MyEngine."
14
- s.description = "Description of MyEngine."
15
- s.license = "MIT"
16
-
17
- s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
18
-
19
- s.add_dependency "rails", "~> 4.2.1"
20
- s.add_dependency "cells", ">= 4.0.0.beta5"
21
- s.add_dependency "cells-erb"
22
-
23
- s.add_development_dependency "sqlite3"
24
- end
@@ -1,11 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
-
3
- # This model initially had no columns defined. If you add columns to the
4
- # model remove the '{}' from the fixture names and add the columns immediately
5
- # below each fixture, per the syntax in the comments below
6
- #
7
- one: {}
8
- # column: value
9
- #
10
- two: {}
11
- # column: value
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module MyEngine
4
- class UserTest < ActiveSupport::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
File without changes
File without changes
File without changes
@@ -1,17 +0,0 @@
1
- require "test_helper"
2
- require "capybara/rails"
3
- require "capybara/dsl"
4
-
5
- # This blog post helped so much: http://rakeroutes.com/blog/write-a-gem-for-the-rails-asset-pipeline/
6
- # Thanks, Stephen!!! :)
7
-
8
- class AssetPipelineTest < ActionDispatch::IntegrationTest
9
- include ::Capybara::DSL
10
-
11
- it do
12
- visit "/assets/application.css"
13
-
14
- # both engine User::Cell and SongCell provide assets.
15
- page.text.must_equal "user{background:green}.song{background:red}"
16
- end
17
- end
@@ -1,16 +0,0 @@
1
- require "test_helper"
2
-
3
- class ControllerTest < ActionController::TestCase
4
- tests SongsController
5
-
6
- it do
7
- get :index
8
- response.body.must_equal "happy"
9
- end
10
-
11
- # HTML escaping.
12
- it do
13
- get :with_escaped
14
- response.body.must_equal "<h1>Yeah!</h1><b>&lt;script&gt;</b>" # only the property is escaped.
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- require "test_helper"
2
-
3
- class FormForTestTest < MiniTest::Spec
4
- include Cell::Testing
5
-
6
- it do
7
- cell("form_for").().gsub(/\s\s/, "").must_equal %{<form class=\"edit_song\" id=\"edit_song_1\" action=\"/songs/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /> First <input type=\"text\" value=\"1\" name=\"song[id]\" id=\"song_id\" /><input type=\"text\" name=\"song[artist][id]\" id=\"song_artist_id\" />
8
- </form>}
9
- end
10
- end
@@ -1,11 +0,0 @@
1
- require "test_helper"
2
-
3
- class FormTagTestTest < MiniTest::Spec
4
- include Cell::Testing
5
- controller SongsController
6
-
7
- it do
8
- cell("form_tag").().gsub(/\s\s/, "").must_equal %{<form action=\"/songs\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /> Second <input type=\"text\" name=\"id\" id=\"id\" /> <input type=\"submit\" name=\"commit\" value=\"Save\" />
9
- </form>}
10
- end
11
- end
@@ -1,12 +0,0 @@
1
- require "test_helper"
2
-
3
- class FormForTestTest < MiniTest::Spec
4
- include Cell::Testing
5
- controller SongsController # provides #url_options.
6
-
7
- it do
8
- cell("formtastic").().gsub(/\s\s/, "").must_equal %{<form novalidate=\"novalidate\" class=\"formtastic song\" id=\"edit_song_1\" action=\"/songs/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /> First <li class=\"string input required stringish\" id=\"song_id_input\"><label for=\"song_id\" class=\"label\">Id<abbr title=\"required\">*</abbr></label><input id=\"song_id\" type=\"text\" value=\"1\" name=\"song[id]\" /></li><li class=\"string input required stringish\" id=\"song_artist_id_input\"><label for=\"song_artist_id\" class=\"label\">Id<abbr title=\"required\">*</abbr></label><input id=\"song_artist_id\" type=\"text\" name=\"song[artist][id]\" /></li><fieldset class=\"actions\"><ol> <input type=\"submit\" name=\"commit\" value=\"Go!\" as=\"button\" class=\"btn btn-primary\" />
9
- </ol></fieldset>
10
- </form>}
11
- end
12
- end
@@ -1,11 +0,0 @@
1
- require "test_helper"
2
-
3
- class SimpleFormTest < MiniTest::Spec
4
- include Cell::Testing
5
- controller SongsController # provides #url_options.
6
-
7
- it do
8
- cell("simple_form").().gsub(/\s\s/, "").must_equal %{<form class=\"simple_form edit_song\" id=\"edit_song_1\" action=\"/songs/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /> First <div class=\"input string required song_id\"><label class=\"string required\" for=\"song_id\"><abbr title=\"required\">*</abbr> Id</label><input class=\"string required\" required=\"required\" aria-required=\"true\" type=\"text\" value=\"1\" name=\"song[id]\" id=\"song_id\" /></div><div class=\"input string required song_artist_id\"><label class=\"string required\" for=\"song_artist_id\"><abbr title=\"required\">*</abbr> Id</label><input class=\"string required\" required=\"required\" aria-required=\"true\" type=\"text\" name=\"song[artist][id]\" id=\"song_artist_id\" /></div>
9
- </form>}
10
- end
11
- end
@@ -1,47 +0,0 @@
1
- require 'test_helper'
2
-
3
- class MusiciansController < ApplicationController
4
- end
5
-
6
- class UrlHelperTest < MiniTest::Spec
7
- include Cell::Testing
8
- controller MusiciansController
9
-
10
- class Cell < Cell::ViewModel
11
- def show
12
- url_for(model)
13
- end
14
- end
15
-
16
- let (:song_cell) { Cell.new(Song.new, controller: controller) }
17
-
18
- # path helpers work in cell instance.
19
- it { song_cell.songs_path.must_equal "/songs" }
20
- it { song_cell.().must_equal "http://test.host/songs/1" }
21
- end
22
-
23
-
24
- class UrlTest < ActionDispatch::IntegrationTest
25
- include ::Capybara::DSL
26
-
27
- it do
28
- visit "/songs/new" # cell.url_for(Song.new)
29
- page.text.must_equal "http://www.example.com/songs/1"
30
- end
31
-
32
- # it do
33
- # visit "/songs/1/edit"
34
- # page.text.must_equal "http://www.example.com/songs/1"
35
- # end
36
-
37
-
38
- end
39
-
40
- class AssetsHelperTest < ActionController::TestCase
41
- tests SongsController
42
-
43
- it do
44
- get :with_image_tag
45
- response.body.must_equal "<img src=\"/images/logo.png\" alt=\"Logo\" />"
46
- end
47
- end
@@ -1,14 +0,0 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- Rails.backtrace_cleaner.remove_silencers!
6
-
7
- # MiniTest::Spec.class_eval do
8
- # after :each do
9
- # # DatabaseCleaner.clean
10
- # Thing.delete_all
11
- # Comment.delete_all
12
- # User.delete_all
13
- # end
14
- # end
@@ -1,51 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ViewExtensionsTest < ActionController::TestCase
4
- tests MusicianController
5
-
6
- class Cell < Cell::Concept
7
- def show
8
- "<b>#{model}</b>"
9
- end
10
- end
11
-
12
- class SongCell < ::Cell::ViewModel
13
- def show
14
- "<b>#{model}</b>"
15
- end
16
- end
17
-
18
-
19
- # #concept is available in controller views.
20
- test "concept(..).show" do
21
- get :view_with_concept_with_show
22
- assert_equal "&lt;b&gt;Up For Breakfast&lt;/b&gt;", @response.body # TODO: test options/with twin.
23
- end
24
-
25
- test "concept(..).call" do
26
- get :view_with_concept_with_call
27
- assert_equal "<b>A Tale That Wasn't Right</b>", @response.body # TODO: test options/with twin.
28
- end
29
-
30
- test "concept(..) without #call" do
31
- get :view_with_concept_without_call
32
- assert_equal "<b>A Tale That Wasn't Right</b>", @response.body
33
- end
34
-
35
- test "cell(..) with #call" do
36
- get :view_with_cell_with_call
37
- assert_equal "<b>A Tale That Wasn't Right</b>", @response.body
38
- end
39
-
40
- # Controller#concept
41
- test "Controller#concept(..).call" do
42
- get :action_with_concept_with_call
43
- assert_equal "<b>A Tale That Wasn't Right</b>", @response.body # TODO: test options/with twin.
44
- end
45
-
46
- # Controller#cell
47
- test "Controller#cell(..).call" do
48
- get :action_with_cell_with_call
49
- assert_equal "<b>A Tale That Wasn't Right</b>", @response.body # TODO: test options/with twin.
50
- end
51
- end