Sha256: d8437884596637e0236b77715fc0dca39ad8650d8210b198a587980f7db12826
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module Padrino module Generators module Components module Tests module TestspecGen TESTSPEC_SETUP = (<<-TEST).gsub(/^ {10}/, '') class Test::Unit::TestCase include Rack::Test::Methods def app CLASS_NAME.tap { |app| app.set :environment, :test } end end TEST def setup_test require_dependencies 'test/spec', :env => :testing insert_test_suite_setup TESTSPEC_SETUP end TESTSPEC_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '') require File.dirname(__FILE__) + '/../test_config.rb' context "!NAME!Controller" do setup { get('/') } specify "returns hello world" do last_response.body.should.equal "Hello World" end end TEST # Generates a controller test given the controllers name def generate_controller_test(name, root) testspec_contents = TESTSPEC_CONTROLLER_TEST.gsub(/!NAME!/, name.to_s.camelize) create_file File.join(root, "test/controllers/#{name}_controller_test.rb"), testspec_contents end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
padrino-gen-0.1.2 | lib/generators/components/tests/testspec_test_gen.rb |