mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 07:40:12 +01:00
Added Rspec and Webrat plugins and started porting Selenium on Rails tests to Rspec Plain Text Stories driving Webrat driving Selenium.
This commit is contained in:
parent
0600756bbf
commit
0f7d6f7a1d
602 changed files with 47788 additions and 29 deletions
18
vendor/plugins/rspec-rails/generators/rspec_model/USAGE
vendored
Executable file
18
vendor/plugins/rspec-rails/generators/rspec_model/USAGE
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
Description:
|
||||
The rspec_model generator creates stubs for a new model.
|
||||
|
||||
The generator takes a model name as its argument. The model name may be
|
||||
given in CamelCase or under_score and should not be suffixed with 'Model'.
|
||||
|
||||
The generator creates a model class in app/models, an RSpec spec in
|
||||
spec/models, database fixtures in spec/fixtures/plural_name.yml, and a migration
|
||||
in db/migrate.
|
||||
|
||||
Example:
|
||||
./script/generate rspec_model Account
|
||||
|
||||
This will create an Account model:
|
||||
Model: app/models/account.rb
|
||||
Spec: spec/models/account_spec.rb
|
||||
Fixtures: spec/fixtures/accounts.yml
|
||||
Migration: db/migrate/XXX_add_accounts.rb
|
||||
30
vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
vendored
Executable file
30
vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
vendored
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
require 'rails_generator/generators/components/model/model_generator'
|
||||
|
||||
class RspecModelGenerator < ModelGenerator
|
||||
|
||||
def manifest
|
||||
|
||||
record do |m|
|
||||
# Check for class naming collisions.
|
||||
m.class_collisions class_path, class_name
|
||||
|
||||
# Model, spec, and fixture directories.
|
||||
m.directory File.join('app/models', class_path)
|
||||
m.directory File.join('spec/models', class_path)
|
||||
m.directory File.join('spec/fixtures', class_path)
|
||||
|
||||
# Model class, spec and fixtures.
|
||||
m.template 'model:model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
||||
m.template 'model:fixtures.yml', File.join('spec/fixtures', class_path, "#{table_name}.yml")
|
||||
m.template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
|
||||
|
||||
unless options[:skip_migration]
|
||||
m.migration_template 'model:migration.rb', 'db/migrate', :assigns => {
|
||||
:migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
|
||||
}, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
11
vendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb
vendored
Executable file
11
vendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb
vendored
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
|
||||
|
||||
describe <%= class_name %> do
|
||||
before(:each) do
|
||||
@<%= file_name %> = <%= class_name %>.new
|
||||
end
|
||||
|
||||
it "should be valid" do
|
||||
@<%= file_name %>.should be_valid
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue