terraformation 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -5
- data/bin/terrarails +49 -13
- data/rails_generators/terracontroller/templates/controller_spec.rb.erb +1 -1
- data/rails_generators/terracontroller/templates/view_spec.rb.erb +1 -1
- data/rails_generators/terraformation/templates/cucumber +10 -0
- data/rails_generators/terraformation/templates/env.rb +46 -0
- data/rails_generators/terraformation/templates/gitignore +1 -0
- data/rails_generators/terraformation/templates/rspec.rake +142 -0
- data/rails_generators/terraformation/templates/spec_helper.rb +0 -1
- data/rails_generators/terraformation/templates/web_steps.rb +129 -0
- data/rails_generators/terraformation/terraformation_generator.rb +13 -14
- data/rails_generators/terrahelper/templates/helper_spec.rb.erb +1 -1
- data/rails_generators/terramodel/templates/model_spec.rb.erb +1 -1
- data/rails_generators/terrascaffold/templates/controller_spec.rb.erb +1 -1
- data/rails_generators/terrascaffold/templates/view_edit.html_spec.rb.erb +1 -1
- data/rails_generators/terrascaffold/templates/view_index.html_spec.rb.erb +1 -1
- data/rails_generators/terrascaffold/templates/view_new.html_spec.rb.erb +1 -1
- data/rails_generators/terrascaffold/templates/view_show.html_spec.rb.erb +1 -1
- metadata +19 -47
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'fileutils'
|
|
4
4
|
|
5
5
|
spec = Gem::Specification.new do |s|
|
6
6
|
s.name = "terraformation"
|
7
|
-
s.version = "0.
|
7
|
+
s.version = "0.2.0"
|
8
8
|
s.summary = "Generators with a Hashrocket twist"
|
9
9
|
s.email = "info@hashrocket.com"
|
10
10
|
s.homepage = "http://github.com/hashrocket/terraformation"
|
@@ -13,10 +13,6 @@ spec = Gem::Specification.new do |s|
|
|
13
13
|
s.files = %w( LICENSE README.rdoc Rakefile ) + Dir["{bin,rails_generators}/**/*"].sort
|
14
14
|
s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
|
15
15
|
s.executables = ["terrarails"]
|
16
|
-
s.add_dependency("haml", "2.2.14")
|
17
|
-
s.add_dependency("rspec-rails", "1.2.9")
|
18
|
-
s.add_dependency("cucumber", "0.4.4")
|
19
|
-
s.add_dependency("webrat", "0.5.3")
|
20
16
|
end
|
21
17
|
|
22
18
|
Rake::GemPackageTask.new(spec) do |package|
|
data/bin/terrarails
CHANGED
@@ -35,6 +35,7 @@ end
|
|
35
35
|
unless File.exist?('config/database.example.yml')
|
36
36
|
file 'config/database.example.yml', File.read('config/database.yml')
|
37
37
|
end
|
38
|
+
adapter = YAML.load(File.read('config/database.yml'))['development']['adapter']
|
38
39
|
|
39
40
|
unlink 'test/performance/browsing_test.rb'
|
40
41
|
%w(test/fixtures test/functional test/integration test/performance test/unit).each do |d|
|
@@ -68,24 +69,59 @@ if File.size('doc/README_FOR_APP') == 211
|
|
68
69
|
file 'doc/README_FOR_APP', "= #{application_name}\n"
|
69
70
|
end
|
70
71
|
|
71
|
-
added_cucumber = !File.directory?('features')
|
72
|
-
generate 'terraformation', '--skip', '--full'
|
73
|
-
|
74
72
|
gsub_file 'app/helpers/application_helper.rb', /\A# Methods added to this .*\n/, ''
|
75
|
-
gsub_file 'config/environment.rb', /(?:^\s*# config\.gem .*\n)+/, <<-EOS
|
76
|
-
config.gem 'haml', :version => '2.2.14'
|
77
|
-
config.gem 'rspec-rails', :version => '1.2.9', :lib => false
|
78
|
-
config.gem 'cucumber', :version => '0.4.4', :lib => false
|
79
|
-
config.gem 'webrat', :version => '0.5.3', :lib => false
|
80
|
-
EOS
|
81
73
|
gsub_file 'config/routes.rb', /^(ActionController::Routing::Routes\.draw do \|map\|\n)(?:^\s*\n|^\s*#.*\n)*/, '\\1'
|
82
74
|
|
83
|
-
|
84
|
-
|
75
|
+
version = File.read('config/environment.rb')[/^RAILS_GEM_VERSION = ['"](.*?)['"]/, 1]
|
76
|
+
gsub_file 'config/environment.rb', /(?:^\s*# config\.gem .*\n)+/, ''
|
77
|
+
gsub_file 'config/environment.rb', /^#.*\nRAILS_GEM_VERSION.*\n\n/, ''
|
78
|
+
|
79
|
+
file 'config/preinitializer.rb', <<-EOS
|
80
|
+
begin
|
81
|
+
# Require the preresolved locked set of gems.
|
82
|
+
require File.expand_path('../../.bundle/environment', __FILE__)
|
83
|
+
rescue LoadError
|
84
|
+
# Fallback on doing the resolve at runtime.
|
85
|
+
require "rubygems"
|
86
|
+
require "bundler"
|
87
|
+
Bundler.setup
|
88
|
+
end
|
89
|
+
EOS
|
90
|
+
gsub_file 'config/boot.rb', / +load_initializer\s+Rails::Initializer\.run\(:set_load_path\)\s+end/, <<-EOS
|
91
|
+
load_initializer
|
92
|
+
extend_environment
|
93
|
+
Rails::Initializer.run(:set_load_path)
|
94
|
+
end
|
95
|
+
|
96
|
+
def extend_environment
|
97
|
+
Rails::Initializer.class_eval do
|
98
|
+
old_load = instance_method(:load_environment)
|
99
|
+
define_method(:load_environment) do
|
100
|
+
Bundler.require :default, Rails.env
|
101
|
+
old_load.bind(self).call
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
EOS
|
85
106
|
|
86
|
-
|
87
|
-
|
107
|
+
unless File.exist?('Gemfile')
|
108
|
+
file 'Gemfile', "source :gemcutter\n\n" + [
|
109
|
+
"gem 'rails', '#{version}'",
|
110
|
+
"gem '#{{'postgresql'=>'pg', 'sqlite3'=>'sqlite3-ruby'}[adapter] || adapter}'",
|
111
|
+
"gem 'haml', '~> 3.0.4'"
|
112
|
+
].sort.join("\n") + "\n\n" + <<-EOS
|
113
|
+
group :test do
|
114
|
+
gem 'rspec-rails', '1.3.2'
|
88
115
|
end
|
116
|
+
EOS
|
117
|
+
end
|
118
|
+
|
119
|
+
system 'bundle', 'install'
|
120
|
+
|
121
|
+
generate 'terraformation', '--skip', '--full', '--no-cucumber', '--no-blueprint'
|
122
|
+
|
123
|
+
reformat(*Dir.glob('config/environments/*.rb'))
|
124
|
+
reformat 'config/environment.rb', 'config/routes.rb', 'config/boot.rb', 'config/initializers/session_store.rb', 'script/about'
|
89
125
|
|
90
126
|
unless File.directory?('.git')
|
91
127
|
git :init
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
4
|
+
if vendored_cucumber_bin
|
5
|
+
load File.expand_path(vendored_cucumber_bin)
|
6
|
+
else
|
7
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
8
|
+
require 'cucumber'
|
9
|
+
load Cucumber::BINARY
|
10
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
ENV["RAILS_ENV"] ||= "cucumber"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
3
|
+
|
4
|
+
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
5
|
+
require 'cucumber/rails/world'
|
6
|
+
require 'cucumber/rails/active_record'
|
7
|
+
require 'cucumber/web/tableish'
|
8
|
+
|
9
|
+
require 'capybara/rails'
|
10
|
+
require 'capybara/cucumber'
|
11
|
+
require 'capybara/session'
|
12
|
+
Capybara.default_selector = :xpath
|
13
|
+
|
14
|
+
# If you set this to false, any error raised from within your app will bubble
|
15
|
+
# up to your step definition and out to cucumber unless you catch it somewhere
|
16
|
+
# on the way. You can make Rails rescue errors and render error pages on a
|
17
|
+
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
18
|
+
#
|
19
|
+
# If you set this to true, Rails will rescue all errors and render error
|
20
|
+
# pages, more or less in the same way your application would behave in the
|
21
|
+
# default production environment. It's not recommended to do this for all
|
22
|
+
# of your scenarios, as this makes it hard to discover errors in your application.
|
23
|
+
ActionController::Base.allow_rescue = false
|
24
|
+
|
25
|
+
# If you set this to true, each scenario will run in a database transaction.
|
26
|
+
# You can still turn off transactions on a per-scenario basis, simply tagging
|
27
|
+
# a feature or scenario with the @no-txn tag. If you are using Capybara,
|
28
|
+
# tagging with @culerity or @javascript will also turn transactions off.
|
29
|
+
#
|
30
|
+
# If you set this to false, transactions will be off for all scenarios,
|
31
|
+
# regardless of whether you use @no-txn or not.
|
32
|
+
#
|
33
|
+
# Beware that turning transactions off will leave data in your database
|
34
|
+
# after each scenario, which can lead to hard-to-debug failures in
|
35
|
+
# subsequent scenarios. If you do this, we recommend you create a Before
|
36
|
+
# block that will explicitly put your database in a known state.
|
37
|
+
Cucumber::Rails::World.use_transactional_fixtures = true
|
38
|
+
# How to clean your database when transactions are turned off. See
|
39
|
+
# http://github.com/bmabey/database_cleaner for more info.
|
40
|
+
if defined?(ActiveRecord::Base)
|
41
|
+
begin
|
42
|
+
require 'database_cleaner'
|
43
|
+
DatabaseCleaner.strategy = :truncation
|
44
|
+
rescue LoadError => ignore_if_database_cleaner_not_present
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
2
|
+
rspec_gem_dir = nil
|
3
|
+
Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
|
4
|
+
rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
|
5
|
+
end
|
6
|
+
rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
|
7
|
+
|
8
|
+
if rspec_gem_dir && (test ?d, rspec_plugin_dir)
|
9
|
+
raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
if rspec_gem_dir
|
13
|
+
$LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
|
14
|
+
elsif File.exist?(rspec_plugin_dir)
|
15
|
+
$LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Don't load rspec if running "rake gems:*"
|
19
|
+
unless ARGV.any? {|a| a =~ /^gems/}
|
20
|
+
|
21
|
+
begin
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
rescue MissingSourceFile
|
24
|
+
module Spec
|
25
|
+
module Rake
|
26
|
+
class SpecTask
|
27
|
+
def initialize(name)
|
28
|
+
task name do
|
29
|
+
# if rspec-rails is a configured gem, this will output helpful material and exit ...
|
30
|
+
require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment"))
|
31
|
+
|
32
|
+
# ... otherwise, do this:
|
33
|
+
raise <<-MSG
|
34
|
+
|
35
|
+
#{"*" * 80}
|
36
|
+
* You are trying to run an rspec rake task defined in
|
37
|
+
* #{__FILE__},
|
38
|
+
* but rspec can not be found in vendor/gems, vendor/plugins or system gems.
|
39
|
+
#{"*" * 80}
|
40
|
+
MSG
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
|
49
|
+
task :noop do
|
50
|
+
end
|
51
|
+
|
52
|
+
task :default => :spec
|
53
|
+
task :stats => "spec:statsetup"
|
54
|
+
|
55
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
56
|
+
Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
|
57
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
58
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
59
|
+
end
|
60
|
+
|
61
|
+
namespace :spec do
|
62
|
+
desc "Run all specs in spec directory with RCov (excluding plugin specs)"
|
63
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
64
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
65
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
66
|
+
t.rcov = true
|
67
|
+
t.rcov_opts = lambda do
|
68
|
+
IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "Print Specdoc for all specs (excluding plugin specs)"
|
73
|
+
Spec::Rake::SpecTask.new(:doc) do |t|
|
74
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
75
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
76
|
+
end
|
77
|
+
|
78
|
+
desc "Print Specdoc for all plugin examples"
|
79
|
+
Spec::Rake::SpecTask.new(:plugin_doc) do |t|
|
80
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
81
|
+
t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
|
82
|
+
end
|
83
|
+
|
84
|
+
[:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
|
85
|
+
desc "Run the code examples in spec/#{sub}"
|
86
|
+
Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
|
87
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
88
|
+
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
desc "Run the code examples in vendor/plugins (except RSpec's own)"
|
93
|
+
Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
|
94
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
95
|
+
t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
|
96
|
+
end
|
97
|
+
|
98
|
+
namespace :plugins do
|
99
|
+
desc "Runs the examples for rspec_on_rails"
|
100
|
+
Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
|
101
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
102
|
+
t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Setup specs for stats
|
107
|
+
task :statsetup do
|
108
|
+
require 'code_statistics'
|
109
|
+
::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
|
110
|
+
::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
|
111
|
+
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
|
112
|
+
::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
|
113
|
+
::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
|
114
|
+
::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
|
115
|
+
::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
|
116
|
+
::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
|
117
|
+
::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
|
118
|
+
::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
|
119
|
+
::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
|
120
|
+
::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
|
121
|
+
::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
|
122
|
+
::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration')
|
123
|
+
end
|
124
|
+
|
125
|
+
namespace :db do
|
126
|
+
namespace :fixtures do
|
127
|
+
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
|
128
|
+
task :load => :environment do
|
129
|
+
ActiveRecord::Base.establish_connection(Rails.env)
|
130
|
+
base_dir = File.join(Rails.root, 'spec', 'fixtures')
|
131
|
+
fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
|
132
|
+
|
133
|
+
require 'active_record/fixtures'
|
134
|
+
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
|
135
|
+
Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'cgi'
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
4
|
+
|
5
|
+
Given /^I am on (.+)$/ do |page_name|
|
6
|
+
visit path_to(page_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
When /^I go to (.+)$/ do |page_name|
|
10
|
+
visit path_to(page_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^I press "([^\"]*)"$/ do |button, selector|
|
14
|
+
click_button(button)
|
15
|
+
end
|
16
|
+
|
17
|
+
When /^I follow "([^\"]*)"$/ do |link, selector|
|
18
|
+
click_link(link)
|
19
|
+
end
|
20
|
+
|
21
|
+
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value, selector|
|
22
|
+
fill_in(field, :with => value)
|
23
|
+
end
|
24
|
+
|
25
|
+
When /^I fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field, selector|
|
26
|
+
fill_in(field, :with => value)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Use this to fill in an entire form with data from a table. Example:
|
30
|
+
#
|
31
|
+
# When I fill in the following:
|
32
|
+
# | Account Number | 5002 |
|
33
|
+
# | Expiry date | 2009-11-01 |
|
34
|
+
# | Note | Nice guy |
|
35
|
+
# | Wants Email? | |
|
36
|
+
#
|
37
|
+
# TODO: Add support for checkbox, select og option
|
38
|
+
# based on naming conventions.
|
39
|
+
#
|
40
|
+
When /^I fill in the following:$/ do |selector, fields|
|
41
|
+
fields.rows_hash.each do |name, value|
|
42
|
+
When %{I fill in "#{name}" with "#{value}"}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field, selector|
|
47
|
+
select(value, :from => field)
|
48
|
+
end
|
49
|
+
|
50
|
+
When /^I check "([^\"]*)"$/ do |field, selector|
|
51
|
+
check(field)
|
52
|
+
end
|
53
|
+
|
54
|
+
When /^I uncheck "([^\"]*)"$/ do |field, selector|
|
55
|
+
uncheck(field)
|
56
|
+
end
|
57
|
+
|
58
|
+
When /^I choose "([^\"]*)"$/ do |field, selector|
|
59
|
+
choose(field)
|
60
|
+
end
|
61
|
+
|
62
|
+
When /^I attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field, selector|
|
63
|
+
attach_file(field, path)
|
64
|
+
end
|
65
|
+
|
66
|
+
Then /^I should see JSON:$/ do |expected_json|
|
67
|
+
require 'json'
|
68
|
+
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
69
|
+
actual = JSON.pretty_generate(JSON.parse(response.body))
|
70
|
+
expected.should == actual
|
71
|
+
end
|
72
|
+
|
73
|
+
Then /^I should see "([^\"]*)"$/ do |text, selector|
|
74
|
+
page.should have_content(text)
|
75
|
+
end
|
76
|
+
|
77
|
+
Then /^I should see \/([^\/]*)\/$/ do |regexp, selector|
|
78
|
+
regexp = Regexp.new(regexp)
|
79
|
+
page.should have_xpath('//*', :text => regexp)
|
80
|
+
end
|
81
|
+
|
82
|
+
Then /^I should not see "([^\"]*)"$/ do |text, selector|
|
83
|
+
page.should have_no_content(text)
|
84
|
+
end
|
85
|
+
|
86
|
+
Then /^I should not see \/([^\/]*)\/$/ do |regexp, selector|
|
87
|
+
regexp = Regexp.new(regexp)
|
88
|
+
page.should have_no_xpath('//*', :text => regexp)
|
89
|
+
end
|
90
|
+
|
91
|
+
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, selector, value|
|
92
|
+
field = find_field(field)
|
93
|
+
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
94
|
+
field_value.should =~ /#{value}/
|
95
|
+
end
|
96
|
+
|
97
|
+
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, selector, value|
|
98
|
+
field = find_field(field)
|
99
|
+
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
100
|
+
field_value.should_not =~ /#{value}/
|
101
|
+
end
|
102
|
+
|
103
|
+
Then /^the "([^\"]*)" checkbox should be checked$/ do |label, selector|
|
104
|
+
field_checked = find_field(label)['checked']
|
105
|
+
field_checked.should == 'checked'
|
106
|
+
end
|
107
|
+
|
108
|
+
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label, selector|
|
109
|
+
field_checked = find_field(label)['checked']
|
110
|
+
field_checked.should_not == 'checked'
|
111
|
+
end
|
112
|
+
|
113
|
+
Then /^I should be on (.+)$/ do |page_name|
|
114
|
+
current_path = URI.parse(current_url).path
|
115
|
+
current_path.should == path_to(page_name)
|
116
|
+
end
|
117
|
+
|
118
|
+
Then /^I should have the following query string:$/ do |expected_pairs|
|
119
|
+
query = URI.parse(current_url).query
|
120
|
+
actual_params = query ? CGI.parse(query) : {}
|
121
|
+
expected_params = {}
|
122
|
+
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
123
|
+
|
124
|
+
actual_params.should == expected_params
|
125
|
+
end
|
126
|
+
|
127
|
+
Then /^show me the page$/ do
|
128
|
+
save_and_open_page
|
129
|
+
end
|
@@ -35,34 +35,33 @@ class TerraformationGenerator < Rails::Generator::Base
|
|
35
35
|
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
36
36
|
if option?(:rspec) || option?(:cucumber)
|
37
37
|
m.directory 'lib/tasks'
|
38
|
-
m.file 'clear_test_default.rake',
|
38
|
+
m.file 'clear_test_default.rake', 'lib/tasks/clear_test_default.rake'
|
39
39
|
end
|
40
40
|
|
41
41
|
if option?(:rspec)
|
42
|
-
m.file 'rspec
|
42
|
+
m.file 'rspec.rake', 'lib/tasks/rspec.rake'
|
43
43
|
|
44
|
-
m.file 'rspec:script/autospec',
|
45
|
-
m.file 'rspec:script/spec',
|
44
|
+
m.file 'rspec:script/autospec', 'script/autospec', script_options
|
45
|
+
m.file 'rspec:script/spec', 'script/spec', script_options
|
46
46
|
|
47
47
|
m.directory 'spec'
|
48
|
-
m.file 'rcov.opts',
|
49
|
-
m.file 'spec.opts',
|
50
|
-
m.file 'spec_helper.rb',
|
48
|
+
m.file 'rcov.opts', 'spec/rcov.opts'
|
49
|
+
m.file 'spec.opts', 'spec/spec.opts'
|
50
|
+
m.file 'spec_helper.rb', 'spec/spec_helper.rb'
|
51
51
|
end
|
52
52
|
|
53
53
|
if option?(:cucumber)
|
54
|
-
|
55
|
-
m.file 'cucumber
|
56
|
-
m.file '
|
57
|
-
m.file 'cucumber_environment.rb', 'config/environments/cucumber.rb'
|
54
|
+
m.file 'cucumber.rake', 'lib/tasks/cucumber.rake'
|
55
|
+
m.file 'cucumber', 'script/cucumber', script_options
|
56
|
+
m.file 'cucumber_environment.rb', 'config/environments/cucumber.rb'
|
58
57
|
|
59
58
|
m.directory 'features'
|
60
59
|
m.directory 'features/support'
|
61
60
|
m.directory 'features/step_definitions'
|
62
61
|
|
63
|
-
m.
|
64
|
-
m.file 'paths.rb',
|
65
|
-
m.template '
|
62
|
+
m.file 'env.rb', 'features/support/env.rb'
|
63
|
+
m.file 'paths.rb', 'features/support/paths.rb'
|
64
|
+
m.template 'web_steps.rb', 'features/step_definitions/web_steps.rb'
|
66
65
|
|
67
66
|
%w(config/database.yml config/database.example.yml config/database.yml.example).each do |file|
|
68
67
|
path = destination_path(file)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].include?(attribute.type) } -%>
|
4
4
|
describe "/<%= plural_name %>/edit.html" do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].include?(attribute.type) } -%>
|
4
4
|
describe "/<%= plural_name %>/index.html" do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].include?(attribute.type) } -%>
|
4
4
|
describe "/<%= plural_name %>/new.html" do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].include?(attribute.type) } -%>
|
4
4
|
describe "/<%= plural_name %>/show.html" do
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraformation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Hashrocket
|
@@ -9,49 +14,10 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-05-17 00:00:00 -04:00
|
13
18
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: haml
|
17
|
-
type: :runtime
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - "="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 2.2.14
|
24
|
-
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: rspec-rails
|
27
|
-
type: :runtime
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.2.9
|
34
|
-
version:
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: cucumber
|
37
|
-
type: :runtime
|
38
|
-
version_requirement:
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - "="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 0.4.4
|
44
|
-
version:
|
45
|
-
- !ruby/object:Gem::Dependency
|
46
|
-
name: webrat
|
47
|
-
type: :runtime
|
48
|
-
version_requirement:
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.5.3
|
54
|
-
version:
|
19
|
+
dependencies: []
|
20
|
+
|
55
21
|
description:
|
56
22
|
email: info@hashrocket.com
|
57
23
|
executables:
|
@@ -81,15 +47,19 @@ files:
|
|
81
47
|
- rails_generators/terraformation/templates/blueprint/print.css
|
82
48
|
- rails_generators/terraformation/templates/blueprint/screen.css
|
83
49
|
- rails_generators/terraformation/templates/clear_test_default.rake
|
50
|
+
- rails_generators/terraformation/templates/cucumber
|
84
51
|
- rails_generators/terraformation/templates/cucumber.rake
|
85
52
|
- rails_generators/terraformation/templates/cucumber_environment.rb
|
53
|
+
- rails_generators/terraformation/templates/env.rb
|
86
54
|
- rails_generators/terraformation/templates/gitignore
|
87
55
|
- rails_generators/terraformation/templates/jquery.js
|
88
56
|
- rails_generators/terraformation/templates/null_gitignore
|
89
57
|
- rails_generators/terraformation/templates/paths.rb
|
90
58
|
- rails_generators/terraformation/templates/rcov.opts
|
59
|
+
- rails_generators/terraformation/templates/rspec.rake
|
91
60
|
- rails_generators/terraformation/templates/spec.opts
|
92
61
|
- rails_generators/terraformation/templates/spec_helper.rb
|
62
|
+
- rails_generators/terraformation/templates/web_steps.rb
|
93
63
|
- rails_generators/terraformation/terraformation_generator.rb
|
94
64
|
- rails_generators/terraforming.rb
|
95
65
|
- rails_generators/terrahelper/USAGE
|
@@ -117,7 +87,7 @@ files:
|
|
117
87
|
- rails_generators/terrascaffold/templates/view_show.html_spec.rb.erb
|
118
88
|
- rails_generators/terrascaffold/terrascaffold_generator.rb
|
119
89
|
- rails_generators/terraview/terraview_generator.rb
|
120
|
-
has_rdoc:
|
90
|
+
has_rdoc: true
|
121
91
|
homepage: http://github.com/hashrocket/terraformation
|
122
92
|
licenses: []
|
123
93
|
|
@@ -130,18 +100,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
100
|
requirements:
|
131
101
|
- - ">="
|
132
102
|
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 0
|
133
105
|
version: "0"
|
134
|
-
version:
|
135
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
107
|
requirements:
|
137
108
|
- - ">="
|
138
109
|
- !ruby/object:Gem::Version
|
110
|
+
segments:
|
111
|
+
- 0
|
139
112
|
version: "0"
|
140
|
-
version:
|
141
113
|
requirements: []
|
142
114
|
|
143
115
|
rubyforge_project:
|
144
|
-
rubygems_version: 1.3.
|
116
|
+
rubygems_version: 1.3.6
|
145
117
|
signing_key:
|
146
118
|
specification_version: 3
|
147
119
|
summary: Generators with a Hashrocket twist
|