Skip to content

Commit

Permalink
remove Test::Spec generators, closes #1516
Browse files Browse the repository at this point in the history
  • Loading branch information
ujifgc committed Jan 3, 2014
1 parent 3f2fe84 commit 9826aa1
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 126 deletions.
2 changes: 1 addition & 1 deletion padrino-gen/README.rdoc
Expand Up @@ -38,7 +38,7 @@ You can also instruct the generator to skip a certain component to avoid using o

The available components and their default options are listed below:

test:: none (default), bacon, shoulda, cucumber, testspec, riot, rspec, minitest, steak
test:: none (default), bacon, shoulda, cucumber, riot, rspec, minitest, steak
renderer:: slim (default), erb, erubis, liquid, haml
stylesheet:: none (default), less, compass, sass, scss
mock:: none (default), mocha, rr
Expand Down

This file was deleted.

8 changes: 0 additions & 8 deletions padrino-gen/test/test_controller_generator.rb
Expand Up @@ -115,14 +115,6 @@ def teardown
assert_match_in_file(/describe "DemoItemsController" do/m, @controller_test_path.gsub('app', 'subby'))
end

should "generate controller test for testspec" do
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec') }
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
capture_io { generate(:controller, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") }
assert_match_in_file(/(\/\.\.){2}/m, @controller_test_path.gsub('app','subby'))
assert_match_in_file(/context "DemoItemsController" do/m, @controller_test_path.gsub('app','subby'))
end

should "generate controller test for rspec" do
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=rspec') }
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
Expand Down
21 changes: 0 additions & 21 deletions padrino-gen/test/test_model_generator.rb
Expand Up @@ -489,27 +489,6 @@ def teardown
assert_match_in_file(/assert_not_nil @some_person/m, "#{@apptmp}/sample_project/test/subby/models/some_person_test.rb")
assert_match_in_file(/'(\/\.\.){2}\/test/m, "#{@apptmp}/sample_project/test/subby/models/some_person_test.rb")
end

# TESTSPEC
should "generate test file for testspec" do
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec', '-d=activerecord') }
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
capture_io { generate(:model, 'SomeUser', "-r=#{@apptmp}/sample_project") }
assert_match_in_file(/context "SomeUser Model"/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
assert_match_in_file(/@some_user = SomeUser.new/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
assert_match_in_file(/@some_user\.should\.not\.be\.nil/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
assert_match_in_file(/'(\/\.\.){1}\/test/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
end

should "generate test file for testspec in specified app" do
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec', '-d=activerecord') }
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
capture_io { generate(:model, 'SomeUser', "-a=/subby", "-r=#{@apptmp}/sample_project") }
assert_match_in_file(/context "SomeUser Model"/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
assert_match_in_file(/@some_user = SomeUser.new/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
assert_match_in_file(/@some_user\.should\.not\.be\.nil/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
assert_match_in_file(/'(\/\.\.){2}\/test/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
end
end

context "the model destroy option" do
Expand Down
15 changes: 0 additions & 15 deletions padrino-gen/test/test_project_generator.rb
Expand Up @@ -582,21 +582,6 @@ def teardown
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
end # minitest

should "properly generate for testspec" do
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=testspec', '--script=none') }
assert_match(/applying.*?testspec.*?test/, out)
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
assert_match_in_file(/:require => 'rack\/test'/, "#{@apptmp}/sample_project/Gemfile")
assert_match_in_file(/:group => 'test'/, "#{@apptmp}/sample_project/Gemfile")
assert_match_in_file(/gem 'test-spec'.*?:require => 'test\/spec'/, "#{@apptmp}/sample_project/Gemfile")
assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
assert_match_in_file(/Test::Unit::TestCase/, "#{@apptmp}/sample_project/test/test_config.rb")
assert_match_in_file(/gem 'test-spec'.*?:require => 'test\/spec'/, "#{@apptmp}/sample_project/Gemfile")
assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
assert_match_in_file(/Rake::TestTask\.new\("test:\#/,"#{@apptmp}/sample_project/test/test.rake")
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
end

should "properly generate for cucumber" do
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=cucumber', '--script=none') }
assert_match(/applying.*?cucumber.*?test/, out)
Expand Down

0 comments on commit 9826aa1

Please sign in to comment.