tennpipes-init 3.6.6
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.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +163 -0
- data/Rakefile +1 -0
- data/bin/tennpipes-init +16 -0
- data/lib/tennpipes-init.rb +73 -0
- data/lib/tennpipes-init/command.rb +18 -0
- data/lib/tennpipes-init/generators/actions.rb +630 -0
- data/lib/tennpipes-init/generators/app.rb +75 -0
- data/lib/tennpipes-init/generators/app/app.rb.tt +72 -0
- data/lib/tennpipes-init/generators/app/app.rb.tt~ +72 -0
- data/lib/tennpipes-init/generators/cli.rb +57 -0
- data/lib/tennpipes-init/generators/component.rb +73 -0
- data/lib/tennpipes-init/generators/components/actions.rb +208 -0
- data/lib/tennpipes-init/generators/components/mocks/mocha.rb +10 -0
- data/lib/tennpipes-init/generators/components/mocks/rr.rb +13 -0
- data/lib/tennpipes-init/generators/components/orms/activerecord.rb +201 -0
- data/lib/tennpipes-init/generators/components/orms/couchrest.rb +55 -0
- data/lib/tennpipes-init/generators/components/orms/datamapper.rb +140 -0
- data/lib/tennpipes-init/generators/components/orms/dynamoid.rb +67 -0
- data/lib/tennpipes-init/generators/components/orms/minirecord.rb +165 -0
- data/lib/tennpipes-init/generators/components/orms/mongoid.rb +113 -0
- data/lib/tennpipes-init/generators/components/orms/mongomapper.rb +43 -0
- data/lib/tennpipes-init/generators/components/orms/mongomatic.rb +84 -0
- data/lib/tennpipes-init/generators/components/orms/ohm.rb +65 -0
- data/lib/tennpipes-init/generators/components/orms/ripple.rb +75 -0
- data/lib/tennpipes-init/generators/components/orms/sequel.rb +99 -0
- data/lib/tennpipes-init/generators/components/renderers/erb.rb +3 -0
- data/lib/tennpipes-init/generators/components/renderers/haml.rb +3 -0
- data/lib/tennpipes-init/generators/components/renderers/liquid.rb +4 -0
- data/lib/tennpipes-init/generators/components/renderers/slim.rb +3 -0
- data/lib/tennpipes-init/generators/components/scripts/dojo.rb +10 -0
- data/lib/tennpipes-init/generators/components/scripts/extcore.rb +10 -0
- data/lib/tennpipes-init/generators/components/scripts/jquery.rb +10 -0
- data/lib/tennpipes-init/generators/components/scripts/mootools.rb +10 -0
- data/lib/tennpipes-init/generators/components/scripts/prototype.rb +12 -0
- data/lib/tennpipes-init/generators/components/scripts/rightjs.rb +10 -0
- data/lib/tennpipes-init/generators/components/stylesheets/compass.rb +39 -0
- data/lib/tennpipes-init/generators/components/stylesheets/compass/application.scss +43 -0
- data/lib/tennpipes-init/generators/components/stylesheets/compass/partials/_base.scss +12 -0
- data/lib/tennpipes-init/generators/components/stylesheets/less.rb +25 -0
- data/lib/tennpipes-init/generators/components/stylesheets/sass.rb +15 -0
- data/lib/tennpipes-init/generators/components/stylesheets/scss.rb +16 -0
- data/lib/tennpipes-init/generators/components/tests/bacon.rb +103 -0
- data/lib/tennpipes-init/generators/components/tests/cucumber.rb +86 -0
- data/lib/tennpipes-init/generators/components/tests/minitest.rb +110 -0
- data/lib/tennpipes-init/generators/components/tests/riot.rb +117 -0
- data/lib/tennpipes-init/generators/components/tests/rspec.rb +111 -0
- data/lib/tennpipes-init/generators/components/tests/shoulda.rb +114 -0
- data/lib/tennpipes-init/generators/components/tests/steak.rb +114 -0
- data/lib/tennpipes-init/generators/controller.rb +77 -0
- data/lib/tennpipes-init/generators/helper.rb +50 -0
- data/lib/tennpipes-init/generators/mailer.rb +52 -0
- data/lib/tennpipes-init/generators/migration.rb +43 -0
- data/lib/tennpipes-init/generators/model.rb +113 -0
- data/lib/tennpipes-init/generators/plugin.rb +67 -0
- data/lib/tennpipes-init/generators/project.rb +160 -0
- data/lib/tennpipes-init/generators/project/config.ru +9 -0
- data/lib/tennpipes-init/generators/project/config/apps.rb.tt +35 -0
- data/lib/tennpipes-init/generators/project/config/boot.rb +49 -0
- data/lib/tennpipes-init/generators/project/public/favicon.ico +0 -0
- data/lib/tennpipes-init/generators/project/public/images/booking.com.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/causes.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bg.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.svg +68 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.svg +65 -0
- data/lib/tennpipes-init/generators/project/public/images/forever21.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.eot +0 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.svg +970 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.ttf +0 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.woff +0 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/tennpipes-icons.css +598 -0
- data/lib/tennpipes-init/generators/project/public/images/image1.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/image11.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/image2.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/image3.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/intuit.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/krispykreme.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/README.md +302 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/bower.json +4 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/composer.json +34 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/gulpfile.js +92 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.js +1920 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.min.js +12 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/package.json +46 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/holder.js +1411 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/augment.js +27 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/ondomready.js +155 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/polyfills.js +177 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/scenegraph.js +101 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/utils.js +129 -0
- data/lib/tennpipes-init/generators/project/public/images/priceline.com.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/stripe.png +0 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes.min.js +6081 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.abide.js +340 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.accordion.js +67 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.alert.js +43 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.clearing.js +556 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.dropdown.js +448 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.equalizer.js +77 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.interchange.js +354 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.joyride.js +932 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.js +703 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.magellan.js +203 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.offcanvas.js +152 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.orbit.js +476 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.reveal.js +471 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.slider.js +263 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tab.js +237 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tooltip.js +307 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.topbar.js +452 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/fastclick.js +8 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.cookie.js +8 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.js +26 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/modernizr.js +8 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/placeholder.js +2 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/app.css~ +178 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/app1.css~ +177 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css +214 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css~ +214 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/normalize.css +427 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css +6201 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css~ +6201 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.min.css +1 -0
- data/lib/tennpipes-init/generators/runner.rb +139 -0
- data/lib/tennpipes-init/generators/task.rb +45 -0
- data/lib/tennpipes-init/generators/templates/Gemfile.tt +32 -0
- data/lib/tennpipes-init/generators/templates/Rakefile.tt +8 -0
- data/lib/tennpipes-init/generators/templates/controller.rb.tt +22 -0
- data/lib/tennpipes-init/generators/templates/gem/README.md.tt +29 -0
- data/lib/tennpipes-init/generators/templates/gem/gemspec.tt +19 -0
- data/lib/tennpipes-init/generators/templates/gem/lib/libname.tt +6 -0
- data/lib/tennpipes-init/generators/templates/gem/lib/libname/version.tt +3 -0
- data/lib/tennpipes-init/generators/templates/helper.rb.tt +13 -0
- data/lib/tennpipes-init/generators/templates/initializer.rb.tt +5 -0
- data/lib/tennpipes-init/generators/templates/mailer.rb.tt +54 -0
- data/lib/tennpipes-init/generators/templates/project_bin.tt +14 -0
- data/lib/tennpipes-init/generators/templates/task.rb.tt +7 -0
- data/lib/tennpipes-init/tennpipes-tasks/activerecord.rb +377 -0
- data/lib/tennpipes-init/tennpipes-tasks/database.rb +12 -0
- data/lib/tennpipes-init/tennpipes-tasks/datamapper.rb +94 -0
- data/lib/tennpipes-init/tennpipes-tasks/minirecord.rb +19 -0
- data/lib/tennpipes-init/tennpipes-tasks/mongoid.rb +215 -0
- data/lib/tennpipes-init/tennpipes-tasks/mongomapper.rb +55 -0
- data/lib/tennpipes-init/tennpipes-tasks/sequel.rb +85 -0
- data/lib/tennpipes-init/tennpipes-tasks/sql-helpers.rb +72 -0
- data/test/fixtures/admin_template.rb +7 -0
- data/test/fixtures/example_template.rb +15 -0
- data/test/fixtures/git_template.rb +4 -0
- data/test/fixtures/plugin_template.rb +13 -0
- data/test/fixtures/rake_template.rb +9 -0
- data/test/helper.rb +103 -0
- data/test/test_app_generator.rb +142 -0
- data/test/test_cli.rb +27 -0
- data/test/test_component_generator.rb +98 -0
- data/test/test_controller_generator.rb +272 -0
- data/test/test_generator.rb +13 -0
- data/test/test_helper_generator.rb +133 -0
- data/test/test_mailer_generator.rb +69 -0
- data/test/test_migration_generator.rb +222 -0
- data/test/test_model_generator.rb +553 -0
- data/test/test_plugin_generator.rb +152 -0
- data/test/test_project_generator.rb +757 -0
- data/test/test_task_generator.rb +53 -0
- metadata +285 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
apply_component_for(:rspec, :test)
|
|
2
|
+
|
|
3
|
+
CUCUMBER_SETUP = (<<-TEST) unless defined?(CUCUMBER_SETUP)
|
|
4
|
+
RACK_ENV = 'test' unless defined?(RACK_ENV)
|
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../config/boot")
|
|
6
|
+
Dir[File.expand_path(File.dirname(__FILE__) + "/../app/helpers/**/*.rb")].each(&method(:require))
|
|
7
|
+
|
|
8
|
+
require 'capybara/cucumber'
|
|
9
|
+
require 'rspec/expectations'
|
|
10
|
+
|
|
11
|
+
##
|
|
12
|
+
# You can handle all tennpipes applications using instead:
|
|
13
|
+
# Tennpipes.application
|
|
14
|
+
Capybara.app = CLASS_NAME.tap { |app| }
|
|
15
|
+
TEST
|
|
16
|
+
|
|
17
|
+
CUCUMBER_YML = (<<-TEST) unless defined?(CUCUMBER_YML)
|
|
18
|
+
default: --tags ~@wip --strict features
|
|
19
|
+
html_report: --tags ~@wip --strict --format html --out=features_report.html features
|
|
20
|
+
TEST
|
|
21
|
+
|
|
22
|
+
CUCUMBER_FEATURE = (<<-TEST) unless defined?(CUCUMBER_FEATURE)
|
|
23
|
+
Feature: Addition
|
|
24
|
+
In order to avoid silly mistakes
|
|
25
|
+
As a math idiot
|
|
26
|
+
I want to be told the sum of two numbers
|
|
27
|
+
|
|
28
|
+
Scenario: Add two numbers
|
|
29
|
+
Given I visit the calculator page
|
|
30
|
+
And I fill in '50' for 'first'
|
|
31
|
+
And I fill in '70' for 'second'
|
|
32
|
+
When I press 'Add'
|
|
33
|
+
Then I should see 'Answer: 120'
|
|
34
|
+
TEST
|
|
35
|
+
|
|
36
|
+
CUCUMBER_STEP = (<<-TEST) unless defined?(CUCUMBER_STEP)
|
|
37
|
+
Given /^I visit the calculator page$/ do
|
|
38
|
+
visit '/add'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Given /^I fill in '(.*)' for '(.*)'$/ do |value, field|
|
|
42
|
+
fill_in(field, :with => value)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
When /^I press '(.*)'$/ do |name|
|
|
46
|
+
click_button(name)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
Then /^I should see '(.*)'$/ do |text|
|
|
50
|
+
page.should have_content(text)
|
|
51
|
+
end
|
|
52
|
+
TEST
|
|
53
|
+
|
|
54
|
+
CUCUMBER_URL = (<<-TEST) unless defined?(CUCUMBER_URL)
|
|
55
|
+
module Cucumber
|
|
56
|
+
module Web
|
|
57
|
+
module URLs
|
|
58
|
+
def url_for(*names)
|
|
59
|
+
Capybara.app.url_for(*names)
|
|
60
|
+
end
|
|
61
|
+
alias_method :url, :url_for
|
|
62
|
+
|
|
63
|
+
def absolute_url_for(*names)
|
|
64
|
+
"http://www.example.com" + Capybara.app.url_for(*names)
|
|
65
|
+
end
|
|
66
|
+
alias_method :absolute_url, :absolute_url_for
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
World(Cucumber::Web::URLs)
|
|
72
|
+
TEST
|
|
73
|
+
|
|
74
|
+
def setup_test
|
|
75
|
+
require_dependencies 'rack-test', :require => 'rack/test', :group => 'test'
|
|
76
|
+
require_dependencies 'cucumber', :group => 'test'
|
|
77
|
+
require_dependencies 'capybara', :group => 'test'
|
|
78
|
+
insert_test_suite_setup CUCUMBER_SETUP, :path => "features/support/env.rb"
|
|
79
|
+
create_file destination_root("features/support/url.rb"), CUCUMBER_URL
|
|
80
|
+
create_file destination_root("features/add.feature"), CUCUMBER_FEATURE
|
|
81
|
+
create_file destination_root("features/step_definitions/add_steps.rb"), CUCUMBER_STEP
|
|
82
|
+
create_file destination_root("cucumber.yml"), CUCUMBER_YML
|
|
83
|
+
require_dependencies 'rspec', :group => 'test'
|
|
84
|
+
insert_test_suite_setup RSPEC_SETUP, :path => "spec/spec_helper.rb"
|
|
85
|
+
create_file destination_root("spec/spec.rake"), RSPEC_RAKE
|
|
86
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
MINITEST_SETUP = (<<-TEST).gsub(/^ {10}/, '') unless defined?(MINITEST_SETUP)
|
|
2
|
+
RACK_ENV = 'test' unless defined?(RACK_ENV)
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
|
|
4
|
+
Dir[File.expand_path(File.dirname(__FILE__) + "/../app/helpers/**/*.rb")].each(&method(:require))
|
|
5
|
+
|
|
6
|
+
class MiniTest::Spec
|
|
7
|
+
include Rack::Test::Methods
|
|
8
|
+
|
|
9
|
+
# You can use this method to custom specify a Rack app
|
|
10
|
+
# you want rack-test to invoke:
|
|
11
|
+
#
|
|
12
|
+
# app CLASS_NAME
|
|
13
|
+
# app CLASS_NAME.tap { |a| }
|
|
14
|
+
# app(CLASS_NAME) do
|
|
15
|
+
# set :foo, :bar
|
|
16
|
+
# end
|
|
17
|
+
#
|
|
18
|
+
def app(app = nil, &blk)
|
|
19
|
+
@app ||= block_given? ? app.instance_eval(&blk) : app
|
|
20
|
+
@app ||= Tennpipes.application
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
TEST
|
|
24
|
+
|
|
25
|
+
MINITEST_RAKE = (<<-TEST).gsub(/^ {10}/, '') unless defined?(MINITEST_RAKE)
|
|
26
|
+
require 'rake/testtask'
|
|
27
|
+
|
|
28
|
+
test_tasks = Dir['test/*/'].map { |d| File.basename(d) }
|
|
29
|
+
|
|
30
|
+
test_tasks.each do |folder|
|
|
31
|
+
Rake::TestTask.new("test:\#{folder}") do |test|
|
|
32
|
+
test.pattern = "test/\#{folder}/**/*_test.rb"
|
|
33
|
+
test.verbose = true
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
desc "Run application test suite"
|
|
38
|
+
task 'test' => test_tasks.map { |f| "test:\#{f}" }
|
|
39
|
+
TEST
|
|
40
|
+
|
|
41
|
+
MINITEST_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(MINITEST_CONTROLLER_TEST)
|
|
42
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_config.rb')
|
|
43
|
+
|
|
44
|
+
describe "!PATH!" do
|
|
45
|
+
before do
|
|
46
|
+
get "!EXPANDED_PATH!"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should return hello world text" do
|
|
50
|
+
assert_equal "Hello World", last_response.body
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
TEST
|
|
54
|
+
|
|
55
|
+
MINITEST_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(MINITEST_MODEL_TEST)
|
|
56
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
|
57
|
+
|
|
58
|
+
describe "!NAME! Model" do
|
|
59
|
+
it 'can construct a new instance' do
|
|
60
|
+
@!DNAME! = !NAME!.new
|
|
61
|
+
refute_nil @!DNAME!
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
TEST
|
|
65
|
+
|
|
66
|
+
MINITEST_HELPER_TEST = (<<-TEST) unless defined?(MINITEST_HELPER_TEST)
|
|
67
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
|
68
|
+
|
|
69
|
+
describe "!NAME!" do
|
|
70
|
+
before do
|
|
71
|
+
@helpers = Class.new
|
|
72
|
+
@helpers.extend !NAME!
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def helpers
|
|
76
|
+
@helpers
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it "should return nil" do
|
|
80
|
+
assert_equal nil, helpers.foo
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
TEST
|
|
84
|
+
|
|
85
|
+
def setup_test
|
|
86
|
+
require_dependencies 'rack-test', :require => 'rack/test', :group => 'test'
|
|
87
|
+
require_dependencies 'minitest', :require => 'minitest/autorun', :group => 'test'
|
|
88
|
+
insert_test_suite_setup MINITEST_SETUP
|
|
89
|
+
create_file destination_root("test/test.rake"), MINITEST_RAKE
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def generate_controller_test(name, path)
|
|
93
|
+
minitest_contents = MINITEST_CONTROLLER_TEST.gsub(/!PATH!/, path).gsub(/!EXPANDED_PATH!/, path.gsub(/:\w+?_id/, "1"))
|
|
94
|
+
controller_test_path = File.join('test',options[:app],'controllers',"#{name.to_s.underscore}_controller_test.rb")
|
|
95
|
+
create_file destination_root(controller_test_path), minitest_contents, :skip => true
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def generate_model_test(name)
|
|
99
|
+
minitest_contents = MINITEST_MODEL_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize).gsub(/!DNAME!/, name.to_s.underscore)
|
|
100
|
+
minitest_contents.gsub!(/!PATH!/, recognize_path)
|
|
101
|
+
model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
|
|
102
|
+
create_file destination_root(model_test_path), minitest_contents, :skip => true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def generate_helper_test(name, project_name, app_name)
|
|
106
|
+
minitest_contents = MINITEST_HELPER_TEST.gsub(/!NAME!/, "#{project_name}::#{app_name}::#{name}")
|
|
107
|
+
minitest_contents.gsub!(/!PATH!/, recognize_path)
|
|
108
|
+
helper_spec_path = File.join('test', options[:app], 'helpers', "#{name.underscore}_test.rb")
|
|
109
|
+
create_file destination_root(helper_spec_path), minitest_contents, :skip => true
|
|
110
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
RIOT_SETUP = (<<-TEST).gsub(/^ {10}/, '') unless defined?(RIOT_SETUP)
|
|
2
|
+
RACK_ENV = 'test' unless defined?(RACK_ENV)
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
|
|
4
|
+
Dir[File.expand_path(File.dirname(__FILE__) + "/../app/helpers/**/*.rb")].each(&method(:require))
|
|
5
|
+
|
|
6
|
+
# Specify your app using the #app helper inside a context.
|
|
7
|
+
# Takes either an app class or a block argument.
|
|
8
|
+
# app { Tennpipes.application }
|
|
9
|
+
# app { CLASS_NAME.tap { |app| } }
|
|
10
|
+
|
|
11
|
+
class Riot::Situation
|
|
12
|
+
include Rack::Test::Methods
|
|
13
|
+
|
|
14
|
+
# You can use this method to custom specify a Rack app
|
|
15
|
+
# you want rack-test to invoke:
|
|
16
|
+
#
|
|
17
|
+
# app CLASS_NAME
|
|
18
|
+
# app CLASS_NAME.tap { |a| }
|
|
19
|
+
# app(CLASS_NAME) do
|
|
20
|
+
# set :foo, :bar
|
|
21
|
+
# end
|
|
22
|
+
#
|
|
23
|
+
def app(app = nil, &blk)
|
|
24
|
+
@app ||= block_given? ? app.instance_eval(&blk) : app
|
|
25
|
+
@app ||= Tennpipes.application
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class Riot::Context
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
TEST
|
|
33
|
+
|
|
34
|
+
RIOT_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(RIOT_CONTROLLER_TEST)
|
|
35
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_config.rb')
|
|
36
|
+
|
|
37
|
+
context "!PATH!" do
|
|
38
|
+
context "description here" do
|
|
39
|
+
setup do
|
|
40
|
+
get "!EXPANDED_PATH!"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
asserts("the response body") { last_response.body }.equals "Hello World"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
TEST
|
|
47
|
+
|
|
48
|
+
RIOT_RAKE = (<<-TEST).gsub(/^ {10}/, '') unless defined?(RIOT_RAKE)
|
|
49
|
+
require 'rake/testtask'
|
|
50
|
+
|
|
51
|
+
test_tasks = Dir['test/*/'].map { |d| File.basename(d) }
|
|
52
|
+
|
|
53
|
+
test_tasks.each do |folder|
|
|
54
|
+
Rake::TestTask.new("test:\#{folder}") do |test|
|
|
55
|
+
test.pattern = "test/\#{folder}/**/*_test.rb"
|
|
56
|
+
test.verbose = true
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
desc "Run application test suite"
|
|
61
|
+
task 'test' => test_tasks.map { |f| "test:\#{f}" }
|
|
62
|
+
TEST
|
|
63
|
+
|
|
64
|
+
RIOT_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(RIOT_MODEL_TEST)
|
|
65
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
|
66
|
+
|
|
67
|
+
context "!NAME! Model" do
|
|
68
|
+
context 'can be created' do
|
|
69
|
+
setup do
|
|
70
|
+
!NAME!.new
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
asserts("that record is not nil") { !topic.nil? }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
TEST
|
|
77
|
+
|
|
78
|
+
RIOT_HELPER_TEST = (<<-TEST) unless defined?(RIOT_HELPER_TEST)
|
|
79
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
|
80
|
+
|
|
81
|
+
describe "!NAME!" do
|
|
82
|
+
setup do
|
|
83
|
+
helpers = Class.new
|
|
84
|
+
helpers.extend !NAME!
|
|
85
|
+
[helpers.foo]
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
asserts("#foo"){ topic.first }.nil
|
|
89
|
+
end
|
|
90
|
+
TEST
|
|
91
|
+
|
|
92
|
+
def setup_test
|
|
93
|
+
require_dependencies 'rack-test', :require => 'rack/test', :group => 'test'
|
|
94
|
+
require_dependencies 'riot', :group => 'test'
|
|
95
|
+
insert_test_suite_setup RIOT_SETUP
|
|
96
|
+
create_file destination_root("test/test.rake"), RIOT_RAKE
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def generate_controller_test(name, path)
|
|
100
|
+
riot_contents = RIOT_CONTROLLER_TEST.gsub(/!PATH!/, path).gsub(/!EXPANDED_PATH!/, path.gsub(/:\w+?_id/, "1"))
|
|
101
|
+
controller_test_path = File.join('test',options[:app],'controllers',"#{name.to_s.underscore}_controller_test.rb")
|
|
102
|
+
create_file destination_root(controller_test_path), riot_contents, :skip => true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def generate_model_test(name)
|
|
106
|
+
riot_contents = RIOT_MODEL_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize)
|
|
107
|
+
riot_contents.gsub!(/!PATH!/, recognize_path)
|
|
108
|
+
model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
|
|
109
|
+
create_file destination_root(model_test_path), riot_contents, :skip => true
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def generate_helper_test(name, project_name, app_name)
|
|
113
|
+
riot_contents = RIOT_HELPER_TEST.gsub(/!NAME!/, "#{project_name}::#{app_name}::#{name}")
|
|
114
|
+
riot_contents.gsub!(/!PATH!/, recognize_path)
|
|
115
|
+
helper_spec_path = File.join('test', options[:app], 'helpers', "#{name.underscore}_test.rb")
|
|
116
|
+
create_file destination_root(helper_spec_path), riot_contents, :skip => true
|
|
117
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
RSPEC_SETUP = (<<-TEST).gsub(/^ {12}/, '') unless defined?(RSPEC_SETUP)
|
|
2
|
+
RACK_ENV = 'test' unless defined?(RACK_ENV)
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
|
|
4
|
+
Dir[File.expand_path(File.dirname(__FILE__) + "/../app/helpers/**/*.rb")].each(&method(:require))
|
|
5
|
+
|
|
6
|
+
RSpec.configure do |conf|
|
|
7
|
+
conf.include Rack::Test::Methods
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# You can use this method to custom specify a Rack app
|
|
11
|
+
# you want rack-test to invoke:
|
|
12
|
+
#
|
|
13
|
+
# app CLASS_NAME
|
|
14
|
+
# app CLASS_NAME.tap { |a| }
|
|
15
|
+
# app(CLASS_NAME) do
|
|
16
|
+
# set :foo, :bar
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
def app(app = nil, &blk)
|
|
20
|
+
@app ||= block_given? ? app.instance_eval(&blk) : app
|
|
21
|
+
@app ||= Tennpipes.application
|
|
22
|
+
end
|
|
23
|
+
TEST
|
|
24
|
+
|
|
25
|
+
RSPEC_CONTROLLER_TEST = (<<-TEST).gsub(/^ {12}/, '') unless defined?(RSPEC_CONTROLLER_TEST)
|
|
26
|
+
require 'spec_helper'
|
|
27
|
+
|
|
28
|
+
RSpec.describe "!PATH!" do
|
|
29
|
+
pending "add some examples to \#{__FILE__}" do
|
|
30
|
+
before do
|
|
31
|
+
get "!EXPANDED_PATH!"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "returns hello world" do
|
|
35
|
+
expect(last_response.body).to eq "Hello World"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
TEST
|
|
40
|
+
|
|
41
|
+
RSPEC_RAKE = (<<-TEST).gsub(/^ {12}/, '') unless defined?(RSPEC_RAKE)
|
|
42
|
+
begin
|
|
43
|
+
require 'rspec/core/rake_task'
|
|
44
|
+
|
|
45
|
+
spec_tasks = Dir['spec/*/'].each_with_object([]) do |d, result|
|
|
46
|
+
result << File.basename(d) unless Dir["\#{d}*"].empty?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
spec_tasks.each do |folder|
|
|
50
|
+
desc "Run the spec suite in \#{folder}"
|
|
51
|
+
RSpec::Core::RakeTask.new("spec:\#{folder}") do |t|
|
|
52
|
+
t.pattern = "./spec/\#{folder}/**/*_spec.rb"
|
|
53
|
+
t.rspec_opts = "--color"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
desc "Run complete application spec suite"
|
|
58
|
+
task 'spec' => spec_tasks.map { |f| "spec:\#{f}" }
|
|
59
|
+
rescue LoadError
|
|
60
|
+
puts "RSpec is not part of this bundle, skip specs."
|
|
61
|
+
end
|
|
62
|
+
TEST
|
|
63
|
+
|
|
64
|
+
RSPEC_MODEL_TEST = (<<-TEST).gsub(/^ {12}/, '') unless defined?(RSPEC_MODEL_TEST)
|
|
65
|
+
require 'spec_helper'
|
|
66
|
+
|
|
67
|
+
RSpec.describe !NAME! do
|
|
68
|
+
pending "add some examples to (or delete) \#{__FILE__}"
|
|
69
|
+
end
|
|
70
|
+
TEST
|
|
71
|
+
|
|
72
|
+
RSPEC_HELPER_TEST = (<<-TEST) unless defined?(RSPEC_HELPER_TEST)
|
|
73
|
+
require 'spec_helper'
|
|
74
|
+
|
|
75
|
+
RSpec.describe "!NAME!" do
|
|
76
|
+
pending "add some examples to (or delete) \#{__FILE__}" do
|
|
77
|
+
let(:helpers){ Class.new }
|
|
78
|
+
before { helpers.extend !NAME! }
|
|
79
|
+
subject { helpers }
|
|
80
|
+
|
|
81
|
+
it "should return nil" do
|
|
82
|
+
expect(subject.foo).to be_nil
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
TEST
|
|
87
|
+
|
|
88
|
+
def setup_test
|
|
89
|
+
require_dependencies 'rack-test', :require => 'rack/test', :group => 'test'
|
|
90
|
+
require_dependencies 'rspec', :group => 'test'
|
|
91
|
+
insert_test_suite_setup RSPEC_SETUP, :path => "spec/spec_helper.rb"
|
|
92
|
+
create_file destination_root("spec/spec.rake"), RSPEC_RAKE
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def generate_controller_test(name, path)
|
|
96
|
+
rspec_contents = RSPEC_CONTROLLER_TEST.gsub(/!PATH!/, path).gsub(/!EXPANDED_PATH!/, path.gsub(/:\w+?_id/, "1"))
|
|
97
|
+
controller_spec_path = File.join('spec',options[:app],'controllers',"#{name.to_s.underscore}_controller_spec.rb")
|
|
98
|
+
create_file destination_root(controller_spec_path), rspec_contents, :skip => true
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def generate_model_test(name)
|
|
102
|
+
rspec_contents = RSPEC_MODEL_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize).gsub(/!DNAME!/, name.to_s.underscore)
|
|
103
|
+
model_spec_path = File.join('spec',options[:app],'models',"#{name.to_s.underscore}_spec.rb")
|
|
104
|
+
create_file destination_root(model_spec_path), rspec_contents, :skip => true
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def generate_helper_test(name, project_name, app_name)
|
|
108
|
+
rspec_contents = RSPEC_HELPER_TEST.gsub(/!NAME!/, "#{project_name}::#{app_name}::#{name}")
|
|
109
|
+
helper_spec_path = File.join('spec', options[:app], 'helpers', "#{name.underscore}_spec.rb")
|
|
110
|
+
create_file destination_root(helper_spec_path), rspec_contents, :skip => true
|
|
111
|
+
end
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
SHOULDA_SETUP = (<<-TEST).gsub(/^ {10}/, '') unless defined?(SHOULDA_SETUP)
|
|
2
|
+
RACK_ENV = 'test' unless defined?(RACK_ENV)
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
|
|
4
|
+
Dir[File.expand_path(File.dirname(__FILE__) + "/../app/helpers/**/*.rb")].each(&method(:require))
|
|
5
|
+
|
|
6
|
+
require "test/unit"
|
|
7
|
+
|
|
8
|
+
class Test::Unit::TestCase
|
|
9
|
+
include Rack::Test::Methods
|
|
10
|
+
|
|
11
|
+
# You can use this method to custom specify a Rack app
|
|
12
|
+
# you want rack-test to invoke:
|
|
13
|
+
#
|
|
14
|
+
# app CLASS_NAME
|
|
15
|
+
# app CLASS_NAME.tap { |a| }
|
|
16
|
+
# app(CLASS_NAME) do
|
|
17
|
+
# set :foo, :bar
|
|
18
|
+
# end
|
|
19
|
+
#
|
|
20
|
+
def app(app = nil, &blk)
|
|
21
|
+
@app ||= block_given? ? app.instance_eval(&blk) : app
|
|
22
|
+
@app ||= Tennpipes.application
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
TEST
|
|
26
|
+
|
|
27
|
+
SHOULDA_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(SHOULDA_CONTROLLER_TEST)
|
|
28
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_config.rb')
|
|
29
|
+
|
|
30
|
+
class !NAME!ControllerTest < Test::Unit::TestCase
|
|
31
|
+
context "!NAME!Controller" do
|
|
32
|
+
setup do
|
|
33
|
+
get '/'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
should "return hello world text" do
|
|
37
|
+
assert_equal "Hello World", last_response.body
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
TEST
|
|
42
|
+
|
|
43
|
+
SHOULDA_RAKE = (<<-TEST).gsub(/^ {10}/, '') unless defined?(SHOULDA_RAKE)
|
|
44
|
+
require 'rake/testtask'
|
|
45
|
+
|
|
46
|
+
test_tasks = Dir['test/*/'].map { |d| File.basename(d) }
|
|
47
|
+
|
|
48
|
+
test_tasks.each do |folder|
|
|
49
|
+
Rake::TestTask.new("test:\#{folder}") do |test|
|
|
50
|
+
test.pattern = "test/\#{folder}/**/*_test.rb"
|
|
51
|
+
test.verbose = true
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
desc "Run application test suite"
|
|
56
|
+
task 'test' => test_tasks.map { |f| "test:\#{f}" }
|
|
57
|
+
TEST
|
|
58
|
+
|
|
59
|
+
SHOULDA_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(SHOULDA_MODEL_TEST)
|
|
60
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
|
61
|
+
|
|
62
|
+
class !NAME!Test < Test::Unit::TestCase
|
|
63
|
+
context "!NAME! Model" do
|
|
64
|
+
should 'construct new instance' do
|
|
65
|
+
@!DNAME! = !NAME!.new
|
|
66
|
+
assert_not_nil @!DNAME!
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
TEST
|
|
71
|
+
|
|
72
|
+
SHOULDA_HELPER_TEST = (<<-TEST) unless defined?(SHOULDA_HELPER_TEST)
|
|
73
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
|
74
|
+
|
|
75
|
+
class !NAME!Test < Test::Unit::TestCase
|
|
76
|
+
context "!NAME!" do
|
|
77
|
+
setup do
|
|
78
|
+
@helpers = Class.new
|
|
79
|
+
@helpers.extend !NAME!
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
should "return nil" do
|
|
83
|
+
assert_equal nil, @helpers.foo
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
TEST
|
|
88
|
+
|
|
89
|
+
def setup_test
|
|
90
|
+
require_dependencies 'rack-test', :require => 'rack/test', :group => 'test'
|
|
91
|
+
require_dependencies 'shoulda', :group => 'test'
|
|
92
|
+
insert_test_suite_setup SHOULDA_SETUP
|
|
93
|
+
create_file destination_root("test/test.rake"), SHOULDA_RAKE
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def generate_controller_test(name, path = nil)
|
|
97
|
+
shoulda_contents = SHOULDA_CONTROLLER_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize)
|
|
98
|
+
controller_test_path = File.join('test',options[:app],'controllers',"#{name.to_s.underscore}_controller_test.rb")
|
|
99
|
+
create_file destination_root(controller_test_path), shoulda_contents, :skip => true
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def generate_model_test(name)
|
|
103
|
+
shoulda_contents = SHOULDA_MODEL_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize).gsub(/!DNAME!/, name.to_s.underscore)
|
|
104
|
+
shoulda_contents.gsub!(/!PATH!/, recognize_path)
|
|
105
|
+
model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
|
|
106
|
+
create_file destination_root(model_test_path), shoulda_contents, :skip => true
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def generate_helper_test(name, project_name, app_name)
|
|
110
|
+
shoulda_contents = SHOULDA_HELPER_TEST.gsub(/!NAME!/, "#{project_name}::#{app_name}::#{name}")
|
|
111
|
+
shoulda_contents.gsub!(/!PATH!/, recognize_path)
|
|
112
|
+
helper_spec_path = File.join('test', options[:app], 'helpers', "#{name.underscore}_test.rb")
|
|
113
|
+
create_file destination_root(helper_spec_path), shoulda_contents, :skip => true
|
|
114
|
+
end
|