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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -14
- data/CHANGES.md +34 -7
- data/Gemfile +2 -2
- data/README.md +18 -88
- data/benchmarks/class_builder.rb +37 -0
- data/benchmarks/collection.rb +47 -0
- data/cells.gemspec +5 -7
- data/lib/cell.rb +2 -11
- data/lib/cell/builder.rb +16 -0
- data/lib/cell/collection.rb +54 -0
- data/lib/cell/concept.rb +6 -7
- data/lib/cell/escaped.rb +1 -0
- data/lib/cell/layout.rb +50 -14
- data/lib/cell/testing.rb +6 -5
- data/lib/cell/util.rb +10 -1
- data/lib/cell/version.rb +1 -1
- data/lib/cell/view_model.rb +27 -56
- data/lib/cells.rb +1 -1
- data/test/builder_test.rb +4 -2
- data/test/cell_test.rb +9 -2
- data/test/concept_test.rb +9 -16
- data/test/context_test.rb +33 -0
- data/test/fixtures/cell_test/song/show_with_block.erb +1 -0
- data/test/fixtures/comment/layout/show.erb +1 -0
- data/test/fixtures/comment/show/show.erb +1 -0
- data/test/fixtures/song/with_block.erb +1 -0
- data/test/layout_test.rb +34 -1
- data/test/prefixes_test.rb +3 -3
- data/test/public_test.rb +43 -9
- data/test/render_test.rb +7 -3
- data/test/test_helper.rb +2 -38
- data/test/{test_case_test.rb → testing_test.rb} +2 -2
- metadata +16 -159
- data/gemfiles/rails3.2.gemfile +0 -16
- data/gemfiles/rails4.0.gemfile +0 -12
- data/gemfiles/rails4.1.gemfile +0 -12
- data/gemfiles/rails4.2.gemfile +0 -10
- data/lib/cell/caching/notification.rb +0 -15
- data/lib/cell/rails.rb +0 -98
- data/lib/cell/railtie.rb +0 -69
- data/lib/cell/test_case.rb +0 -12
- data/lib/cell/translation.rb +0 -19
- data/lib/rails/generators/cell/cell_generator.rb +0 -43
- data/lib/rails/generators/cell/templates/cell.rb.erb +0 -8
- data/lib/rails/generators/cell/templates/view.erb +0 -7
- data/lib/rails/generators/cell/templates/view.haml +0 -4
- data/lib/rails/generators/cell/templates/view.slim +0 -2
- data/lib/rails/generators/concept/concept_generator.rb +0 -38
- data/lib/rails/generators/concept/templates/concept.rb.erb +0 -7
- data/lib/rails/generators/concept/templates/view.erb +0 -7
- data/lib/rails/generators/concept/templates/view.haml +0 -4
- data/lib/rails/generators/concept/templates/view.slim +0 -2
- data/lib/rails/generators/test_unit/cell/cell_generator.rb +0 -21
- data/lib/rails/generators/test_unit/cell/templates/unit_test.rb.erb +0 -11
- data/lib/rails/generators/test_unit/concept/concept_generator.rb +0 -21
- data/lib/rails/generators/test_unit/concept/templates/unit_test.rb.erb +0 -11
- data/test/caching_test.rb +0 -305
- data/test/cell_generator_test.rb +0 -90
- data/test/concept_generator_test.rb +0 -40
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -2
- data/test/dummy/app/cells/album/assets/album.js +0 -1
- data/test/dummy/app/concepts/song/assets/songs.js +0 -1
- data/test/dummy/app/controllers/application_controller.rb +0 -4
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/musician/featured.html.erb +0 -1
- data/test/dummy/app/views/musician/featured_with_block.html.erb +0 -4
- data/test/dummy/app/views/musician/hamlet.html.erb +0 -1
- data/test/dummy/app/views/musician/title.erb +0 -1
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -41
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -22
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -5
- data/test/dummy/script/rails +0 -6
- data/test/rails/translation_test.rb +0 -45
- data/test/rails4.2/.gitignore +0 -13
- data/test/rails4.2/Gemfile +0 -18
- data/test/rails4.2/README.rdoc +0 -3
- data/test/rails4.2/Rakefile +0 -6
- data/test/rails4.2/app/assets/images/.keep +0 -0
- data/test/rails4.2/app/assets/stylesheets/application.css.erb +0 -19
- data/test/rails4.2/app/cells/form_for/show.erb +0 -7
- data/test/rails4.2/app/cells/form_for_cell.rb +0 -7
- data/test/rails4.2/app/cells/form_tag/show.erb +0 -5
- data/test/rails4.2/app/cells/form_tag_cell.rb +0 -5
- data/test/rails4.2/app/cells/formtastic/show.erb +0 -12
- data/test/rails4.2/app/cells/formtastic_cell.rb +0 -9
- data/test/rails4.2/app/cells/simple_form/show.erb +0 -7
- data/test/rails4.2/app/cells/simple_form_cell.rb +0 -11
- data/test/rails4.2/app/cells/song/song.css +0 -1
- data/test/rails4.2/app/cells/song/with_escaped.erb +0 -1
- data/test/rails4.2/app/cells/song_cell.rb +0 -18
- data/test/rails4.2/app/controllers/application_controller.rb +0 -5
- data/test/rails4.2/app/controllers/concerns/.keep +0 -0
- data/test/rails4.2/app/controllers/index_controller.rb +0 -7
- data/test/rails4.2/app/controllers/songs_controller.rb +0 -25
- data/test/rails4.2/app/helpers/application_helper.rb +0 -2
- data/test/rails4.2/app/mailers/.keep +0 -0
- data/test/rails4.2/app/models/.keep +0 -0
- data/test/rails4.2/app/models/artist.rb +0 -25
- data/test/rails4.2/app/models/concerns/.keep +0 -0
- data/test/rails4.2/app/models/song.rb +0 -25
- data/test/rails4.2/app/views/index/index.html.erb +0 -6
- data/test/rails4.2/app/views/layouts/application.html.erb +0 -13
- data/test/rails4.2/app/views/songs/show.html.erb +0 -1
- data/test/rails4.2/app/views/songs/with_escaped.html.erb +0 -1
- data/test/rails4.2/bin/bundle +0 -3
- data/test/rails4.2/bin/rails +0 -4
- data/test/rails4.2/bin/rake +0 -4
- data/test/rails4.2/bin/setup +0 -29
- data/test/rails4.2/config.ru +0 -4
- data/test/rails4.2/config/application.rb +0 -38
- data/test/rails4.2/config/boot.rb +0 -3
- data/test/rails4.2/config/environment.rb +0 -5
- data/test/rails4.2/config/environments/development.rb +0 -25
- data/test/rails4.2/config/environments/production.rb +0 -64
- data/test/rails4.2/config/environments/test.rb +0 -42
- data/test/rails4.2/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails4.2/config/initializers/cookies_serializer.rb +0 -3
- data/test/rails4.2/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/rails4.2/config/initializers/formtastic.rb +0 -2
- data/test/rails4.2/config/initializers/inflections.rb +0 -16
- data/test/rails4.2/config/initializers/mime_types.rb +0 -4
- data/test/rails4.2/config/initializers/session_store.rb +0 -3
- data/test/rails4.2/config/initializers/wrap_parameters.rb +0 -9
- data/test/rails4.2/config/locales/en.yml +0 -23
- data/test/rails4.2/config/routes.rb +0 -9
- data/test/rails4.2/config/secrets.yml +0 -22
- data/test/rails4.2/db/seeds.rb +0 -7
- data/test/rails4.2/engines/my_engine/.gitignore +0 -3
- data/test/rails4.2/engines/my_engine/Gemfile +0 -15
- data/test/rails4.2/engines/my_engine/MIT-LICENSE +0 -20
- data/test/rails4.2/engines/my_engine/README.rdoc +0 -3
- data/test/rails4.2/engines/my_engine/Rakefile +0 -24
- data/test/rails4.2/engines/my_engine/app/assets/images/my_engine/.keep +0 -0
- data/test/rails4.2/engines/my_engine/app/assets/stylesheets/my_engine/application.css +0 -15
- data/test/rails4.2/engines/my_engine/app/concepts/user/cell.rb +0 -8
- data/test/rails4.2/engines/my_engine/app/concepts/user/views/show.erb +0 -1
- data/test/rails4.2/engines/my_engine/app/concepts/user/views/user.scss +0 -3
- data/test/rails4.2/engines/my_engine/app/controllers/my_engine/application_controller.rb +0 -4
- data/test/rails4.2/engines/my_engine/app/controllers/my_engine/user_controller.rb +0 -7
- data/test/rails4.2/engines/my_engine/app/helpers/my_engine/application_helper.rb +0 -4
- data/test/rails4.2/engines/my_engine/app/models/my_engine/user.rb +0 -4
- data/test/rails4.2/engines/my_engine/app/views/layouts/my_engine/application.html.erb +0 -14
- data/test/rails4.2/engines/my_engine/app/views/my_engine/user/show.html.erb +0 -3
- data/test/rails4.2/engines/my_engine/bin/rails +0 -12
- data/test/rails4.2/engines/my_engine/config/routes.rb +0 -3
- data/test/rails4.2/engines/my_engine/db/migrate/20150530135920_create_my_engine_users.rb +0 -8
- data/test/rails4.2/engines/my_engine/lib/my_engine.rb +0 -6
- data/test/rails4.2/engines/my_engine/lib/my_engine/engine.rb +0 -9
- data/test/rails4.2/engines/my_engine/lib/my_engine/version.rb +0 -3
- data/test/rails4.2/engines/my_engine/lib/tasks/my_engine_tasks.rake +0 -4
- data/test/rails4.2/engines/my_engine/my_engine.gemspec +0 -24
- data/test/rails4.2/engines/my_engine/test/fixtures/my_engine/users.yml +0 -11
- data/test/rails4.2/engines/my_engine/test/models/my_engine/user_test.rb +0 -9
- data/test/rails4.2/lib/assets/.keep +0 -0
- data/test/rails4.2/lib/tasks/.keep +0 -0
- data/test/rails4.2/log/.keep +0 -0
- data/test/rails4.2/test/integration/asset_pipeline_test.rb +0 -17
- data/test/rails4.2/test/integration/controller_test.rb +0 -16
- data/test/rails4.2/test/integration/form_for_test.rb +0 -10
- data/test/rails4.2/test/integration/form_tag_test.rb +0 -11
- data/test/rails4.2/test/integration/formtastic_test.rb +0 -12
- data/test/rails4.2/test/integration/simple_form_test.rb +0 -11
- data/test/rails4.2/test/integration/url_helper_test.rb +0 -47
- data/test/rails4.2/test/test_helper.rb +0 -14
- data/test/rails4.2/vendor/assets/stylesheets/.keep +0 -0
- 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,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
|
-
|
File without changes
|
@@ -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 +0,0 @@
|
|
1
|
-
<%= "Just an empty view, rendered by a cell..." %>
|
@@ -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,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,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
|
File without changes
|
File without changes
|
data/test/rails4.2/log/.keep
DELETED
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><script></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=\"✓\" /><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=\"✓\" /> 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=\"✓\" /><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=\"✓\" /><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
|
File without changes
|
@@ -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 "<b>Up For Breakfast</b>", @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
|