Last active
September 17, 2015 10:11
-
-
Save nomasprime/07a829d1cfc7f7c94816 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails/generators/active_record' | |
module ActiveRecord | |
module Generators | |
class AdminBoundsGenerator < ActiveRecord::Generators::Base | |
source_root File.expand_path('../templates', __FILE__) | |
puts 'here' | |
puts behavior | |
def copy_migration | |
migration_template 'migration.rb', "db/migrate/admin_bounds_create_#{table_name}.rb" | |
puts behavior | |
puts 'wehaoeuaoenutahoeuntaohe' | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'generators/active_record/admin_bounds_generator' | |
# if ENV['DETECTIVE'] | |
# RSpec.configure do |c| | |
# c.around(:example) do |ex| | |
# orig_stdout = $stdout | |
# ex.run | |
# expect($stdout).to be(orig_stdout) | |
# end | |
# end | |
# end | |
module ActiveRecord | |
module Generators | |
describe AdminBoundsGenerator, type: :generator do | |
destination File.expand_path('../../tmp', __FILE__) | |
before(:all) do | |
prepare_destination | |
end | |
it 'creates a migration' do | |
run_generator %w(admin_bound) | |
assert_migration 'db/migrate/admin_bounds_create_admin_bounds.rb', /def change/ | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here | |
/Users/rick/Organisations/playtimestudios/admin_bounds/lib/generators/active_record/admin_bounds_generator.rb:8:in `<class:AdminBoundsGenerator>': undefined local variable or method `behavior' for ActiveRecord::Generators::AdminBoundsGenerator:Class (NameError) | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/lib/generators/active_record/admin_bounds_generator.rb:5:in `<module:Generators>' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/lib/generators/active_record/admin_bounds_generator.rb:4:in `<module:ActiveRecord>' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/lib/generators/active_record/admin_bounds_generator.rb:3:in `<top (required)>' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/spec/generators/active_record_generator_spec.rb:2:in `require' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/spec/generators/active_record_generator_spec.rb:2:in `<top (required)>' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in `load' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in `block in load_spec_files' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in `each' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in `load_spec_files' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:102:in `setup' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:88:in `run' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/gems/rspec-core-3.3.2/exe/rspec:4:in `<top (required)>' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/bin/rspec:23:in `load' | |
from /Users/rick/Organisations/playtimestudios/admin_bounds/vendor/bundle/bin/rspec:23:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment