initjs 0.1.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +9 -10
- data/.rvmrc +1 -0
- data/.travis.yml +15 -0
- data/LICENSE.txt +2 -2
- data/README.md +176 -47
- data/initjs.gemspec +11 -4
- data/lib/assets/javascript/init.js.coffee +8 -1
- data/lib/generators/initjs/add/add_generator.rb +57 -0
- data/lib/generators/initjs/add/templates/namespaced_action.coffee +5 -0
- data/lib/generators/initjs/add/templates/simple_action.coffee +3 -0
- data/lib/generators/initjs/install/install_generator.rb +25 -0
- data/lib/generators/initjs/install/templates/app.coffee +15 -0
- data/lib/generators/initjs/resource_helpers.rb +23 -0
- data/lib/initjs/helper.rb +5 -4
- data/lib/initjs/version.rb +1 -1
- data/spec/dummy/.rspec +1 -0
- data/spec/dummy/Gemfile +10 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application-turbolinks.js +12 -0
- data/spec/dummy/app/assets/javascripts/application.js +10 -0
- data/spec/dummy/app/assets/javascripts/application.sample.js +15 -0
- data/spec/dummy/app/assets/javascripts/dummy/blog/.gitkip +0 -0
- data/spec/dummy/app/assets/javascripts/dummy/blog/posts/.gitkip +0 -0
- data/spec/dummy/app/assets/javascripts/dummy/blog/posts/index.js.coffee +6 -0
- data/spec/dummy/app/assets/javascripts/dummy/blog/posts/new.js.coffee +6 -0
- data/spec/dummy/app/assets/javascripts/dummy/blog/posts/show.js.coffee +6 -0
- data/{lib/generators/initjs/templates/app.js.coffee → spec/dummy/app/assets/javascripts/dummy/dummy.js.coffee} +4 -1
- data/spec/dummy/app/assets/javascripts/dummy/home/.gitkip +0 -0
- data/spec/dummy/app/assets/javascripts/dummy/home/index.js.coffee +4 -0
- data/spec/dummy/app/assets/javascripts/dummy/posts/.gitkip +0 -0
- data/spec/dummy/app/assets/javascripts/dummy/posts/index.js.coffee +4 -0
- data/spec/dummy/app/assets/javascripts/dummy/posts/new.js.coffee +4 -0
- data/spec/dummy/app/assets/javascripts/dummy/posts/show.js.coffee +4 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/blog/posts_controller.rb +10 -0
- data/spec/dummy/app/controllers/home_controller.rb +4 -0
- data/spec/dummy/app/controllers/posts_controller.rb +10 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/blog/posts/index.html.erb +2 -0
- data/spec/dummy/app/views/blog/posts/new.html.erb +2 -0
- data/spec/dummy/app/views/blog/posts/show.html.erb +2 -0
- data/spec/dummy/app/views/home/index.html.erb +10 -0
- data/spec/dummy/app/views/layouts/application.html.erb +24 -0
- data/spec/dummy/app/views/posts/index.html.erb +2 -0
- data/spec/dummy/app/views/posts/new.html.erb +2 -0
- data/spec/dummy/app/views/posts/show.html.erb +2 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +54 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +8 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/tasks/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/features/blog_posts_spec.rb +47 -0
- data/spec/dummy/spec/features/home_spec.rb +11 -0
- data/spec/dummy/spec/features/posts_spec.rb +47 -0
- data/spec/dummy/spec/lib/generators/initjs/add_generator_spec.rb +80 -0
- data/spec/dummy/spec/lib/generators/initjs/install_generator_spec.rb +36 -0
- data/spec/dummy/spec/spec_helper.rb +33 -0
- data/spec/tmp/app/assets/javascripts/.gitkip +0 -0
- metadata +278 -10
- data/lib/generators/initjs/initjs_generator.rb +0 -11
@@ -0,0 +1,30 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Do not compress assets
|
26
|
+
config.assets.compress = false
|
27
|
+
|
28
|
+
# Expands the lines which load the assets
|
29
|
+
config.assets.debug = true
|
30
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
+
config.serve_static_assets = false
|
13
|
+
|
14
|
+
# Compress JavaScripts and CSS
|
15
|
+
config.assets.compress = true
|
16
|
+
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
+
config.assets.compile = false
|
19
|
+
|
20
|
+
# Generate digests for assets URLs
|
21
|
+
config.assets.digest = true
|
22
|
+
|
23
|
+
# Defaults to Rails.root.join("public/assets")
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
25
|
+
|
26
|
+
# Specifies the header that your server uses for sending files
|
27
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
+
|
30
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
+
# config.force_ssl = true
|
32
|
+
|
33
|
+
# See everything in the log (default is :info)
|
34
|
+
# config.log_level = :debug
|
35
|
+
|
36
|
+
# Use a different logger for distributed setups
|
37
|
+
# config.logger = SyslogLogger.new
|
38
|
+
|
39
|
+
# Use a different cache store in production
|
40
|
+
# config.cache_store = :mem_cache_store
|
41
|
+
|
42
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
43
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
44
|
+
|
45
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
46
|
+
# config.assets.precompile += %w( search.js )
|
47
|
+
|
48
|
+
# Disable delivery errors, bad email addresses will be ignored
|
49
|
+
# config.action_mailer.raise_delivery_errors = false
|
50
|
+
|
51
|
+
# Enable threaded mode
|
52
|
+
# config.threadsafe!
|
53
|
+
|
54
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
55
|
+
# the I18n.default_locale when a translation can not be found)
|
56
|
+
config.i18n.fallbacks = true
|
57
|
+
|
58
|
+
# Send deprecation notices to registered listeners
|
59
|
+
config.active_support.deprecation = :notify
|
60
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Configure static asset server for tests with Cache-Control for performance
|
11
|
+
config.serve_static_assets = true
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
|
+
|
27
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
+
# The :test delivery method accumulates sent emails in the
|
29
|
+
# ActionMailer::Base.deliveries array.
|
30
|
+
config.action_mailer.delivery_method = :test
|
31
|
+
|
32
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
33
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
34
|
+
# like if you have constraints or database-specific column types
|
35
|
+
# config.active_record.schema_format = :sql
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = '7eb96180d18be48094cf06cbd9f0f04f66ac7b977010a83bc58a862319650829a7b7a2e7a1053de2ba65c581d2f7c2be0e5fb5676c1b3a2bd1e107a12b90e71a'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# Disable root element in JSON by default.
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
self.include_root_in_json = false
|
14
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples "blog posts feature" do
|
4
|
+
context "When access the index posts page" do
|
5
|
+
before do
|
6
|
+
click_link "PostsBlog#index"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "javascript should insert a text" do
|
10
|
+
page.should have_content("Blog::Posts index content")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "When access the new posts page" do
|
15
|
+
before do
|
16
|
+
click_link "PostsBlog#new"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "javascript should insert a text" do
|
20
|
+
page.should have_content("Blog::Posts new content")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "When access the show posts page" do
|
25
|
+
before do
|
26
|
+
click_link "PostsBlog#show"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "javascript should insert a text" do
|
30
|
+
page.should have_content("Blog::Posts show content")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "Blog posts without turbolinks", js: true do
|
36
|
+
before do
|
37
|
+
visit '/'
|
38
|
+
end
|
39
|
+
it_behaves_like "blog posts feature"
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "Blog posts with turbolinks", js: true do
|
43
|
+
before do
|
44
|
+
visit '/?turbolinks=true'
|
45
|
+
end
|
46
|
+
it_behaves_like "blog posts feature"
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples "posts feature" do
|
4
|
+
context "When access the index posts page" do
|
5
|
+
before do
|
6
|
+
click_link "Posts#index"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "javascript should insert a text" do
|
10
|
+
page.should have_content("Posts index content")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "When access the new posts page" do
|
15
|
+
before do
|
16
|
+
click_link "Posts#new"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "javascript should insert a text" do
|
20
|
+
page.should have_content("Posts new content")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "When access the show posts page" do
|
25
|
+
before do
|
26
|
+
click_link "Posts#show"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "javascript should insert a text" do
|
30
|
+
page.should have_content("Posts show content")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "Posts without turbolinks", js: true do
|
36
|
+
before do
|
37
|
+
visit '/'
|
38
|
+
end
|
39
|
+
it_behaves_like "posts feature"
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "Posts with turbolinks", js: true do
|
43
|
+
before do
|
44
|
+
visit '/?turbolinks=true'
|
45
|
+
end
|
46
|
+
it_behaves_like "posts feature"
|
47
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Initjs::Generators::AddGenerator do
|
4
|
+
include GeneratorSpec::TestCase
|
5
|
+
destination TMP_PATH
|
6
|
+
|
7
|
+
describe "Creating the controller folder" do
|
8
|
+
arguments ['projects']
|
9
|
+
|
10
|
+
before do
|
11
|
+
run_generator
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should creates the controller folder" do
|
15
|
+
destination_root.should have_structure {
|
16
|
+
directory 'app/assets/javascripts/dummy' do
|
17
|
+
directory 'projects'
|
18
|
+
end
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "Creating the controller with actions" do
|
24
|
+
arguments ['projects', 'index', 'new']
|
25
|
+
|
26
|
+
before do
|
27
|
+
run_generator
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should creates the controller folder" do
|
31
|
+
destination_root.should have_structure {
|
32
|
+
directory 'app/assets/javascripts/dummy' do
|
33
|
+
directory 'projects'
|
34
|
+
end
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should creates the actions files" do
|
39
|
+
run_generator
|
40
|
+
destination_root.should have_structure {
|
41
|
+
directory 'app/assets/javascripts/dummy/projects' do
|
42
|
+
file 'index.js.coffee' do
|
43
|
+
contains 'Dummy.Projects.Index ='
|
44
|
+
end
|
45
|
+
|
46
|
+
file 'new.js.coffee' do
|
47
|
+
contains 'Dummy.Projects.New ='
|
48
|
+
end
|
49
|
+
end
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe Initjs::Generators::AddGenerator, "Creating the controller with namespace folders, without actions" do
|
56
|
+
include GeneratorSpec::TestCase
|
57
|
+
destination TMP_PATH
|
58
|
+
arguments ['Blog/Posts']
|
59
|
+
|
60
|
+
before do
|
61
|
+
run_generator
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should creates the namespace folder" do
|
65
|
+
destination_root.should have_structure {
|
66
|
+
directory 'app/assets/javascripts/dummy' do
|
67
|
+
directory 'blog'
|
68
|
+
end
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should creates the controller folder inside the namespace folder" do
|
73
|
+
destination_root.should have_structure {
|
74
|
+
directory 'app/assets/javascripts/dummy/blog' do
|
75
|
+
directory 'posts'
|
76
|
+
end
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|