Sha256: d6d6896bbf01aaf78f0e1d3ea18829bbf6386da731373d767496d6586a3ff49d

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

# scaffold resources
resources_path = '/tmp/crosstie/resources.yml'
if File.exist? resources_path
  YAML.load(File.read(resources_path)).each do |resource, fields|
    generate "scaffold", resource, *fields
    rake "db:migrate"
    inject_into_file "spec/controllers/#{resource.tableize}_controller_spec.rb", after: "RSpec.describe #{resource.pluralize.camelize}Controller, :type => :controller do\n" do
<<-EOF

  before { sign_in_user }
EOF
    end

    gsub_file "spec/controllers/#{resource.tableize}_controller_spec.rb",
        'skip("Add a hash of attributes valid for your model")',
        "FactoryGirl.build(:#{resource}).attributes"
  end

  File.delete resources_path

  run "bundle exec annotate"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crosstie-0.0.4 lib/crosstie/templates/resources.rb
crosstie-0.0.3 lib/crosstie/templates/resources.rb