Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'steak-2'

  • Loading branch information...
commit 8a93a15286c8f043cfead60fcce2ddfd75dc0860 2 parents 5f7a4bd + 8dffe27
@cavalle authored
Showing with 2,789 additions and 1,446 deletions.
  1. +4 −4 .gitignore
  2. +10 −2 Gemfile
  3. +107 −88 Gemfile.lock
  4. +0 −27 History.md
  5. +1 −1  MIT-LICENSE → LICENSE
  6. +110 −0 README.md
  7. +0 −203 README.rdoc
  8. +5 −19 Rakefile
  9. +0 −1  generators/acceptance_spec/USAGE
  10. +0 −9 generators/acceptance_spec/acceptance_spec_generator.rb
  11. +0 −12 generators/acceptance_spec/templates/acceptance_spec.rb
  12. +0 −8 generators/steak/USAGE
  13. +0 −26 generators/steak/steak_generator.rb
  14. +0 −18 generators/steak/templates/acceptance_helper.rb
  15. +0 −5 generators/steak/templates/helpers.rb
  16. +0 −44 generators/steak/templates/steak.rake
  17. +12 −0 lib/generators/steak/install_generator.rb
  18. +11 −0 lib/generators/steak/spec_generator.rb
  19. +13 −0 lib/generators/steak/templates/acceptance_spec.rb
  20. +4 −0 lib/generators/steak/templates/spec/acceptance/acceptance_helper.rb
  21. 0  lib/generators/steak/templates/spec/acceptance/support/.gitignore
  22. +6 −0 lib/generators/steak/templates/spec/acceptance/support/helpers.rb
  23. +1 −1  lib/{rspec-2/rails/generators/templates → generators/steak/templates/spec/acceptance/support}/paths.rb
  24. +0 −17 lib/rspec-1/steak.rb
  25. +0 −31 lib/rspec-2/rails/generators/install_generator.rb
  26. +0 −36 lib/rspec-2/rails/generators/spec_generator.rb
  27. +0 −5 lib/rspec-2/rails/generators/templates/acceptance_helper.rb
  28. +0 −12 lib/rspec-2/rails/generators/templates/acceptance_spec.rb
  29. +0 −5 lib/rspec-2/rails/generators/templates/helpers.rb
  30. +0 −14 lib/rspec-2/rails/railtie.rb
  31. +0 −14 lib/rspec-2/rails/tasks/steak.rake
  32. +0 −31 lib/rspec-2/steak.rb
  33. +4 −10 lib/steak.rb
  34. +12 −0 lib/steak/acceptance_example_group.rb
  35. +7 −0 lib/steak/railtie.rb
  36. +3 −0  lib/steak/version.rb
  37. +14 −0 lib/tasks/steak_tasks.rake
  38. +75 −0 spec/acceptance/creating_specs_spec.rb
  39. +33 −0 spec/acceptance/getting_started_spec.rb
  40. +40 −0 spec/acceptance/rake_support_spec.rb
  41. +0 −98 spec/acceptance/rspec-1/acceptance_helper.rb
  42. +0 −44 spec/acceptance/rspec-1/acceptance_spec_generator_spec.rb
  43. +0 −76 spec/acceptance/rspec-1/basic_spec.rb
  44. +0 −39 spec/acceptance/rspec-1/rails_spec.rb
  45. +0 −96 spec/acceptance/rspec-1/steak_generator_spec.rb
  46. +0 −81 spec/acceptance/rspec-2/acceptance_helper.rb
  47. +0 −121 spec/acceptance/rspec-2/basic_spec.rb
  48. +0 −88 spec/acceptance/rspec-2/rails_spec.rb
  49. +0 −62 spec/acceptance/rspec-2/steak_install_generator_spec.rb
  50. +0 −77 spec/acceptance/rspec-2/steak_spec_generator_spec.rb
  51. +5 −0 spec/fixtures/rails_project/.gitignore
  52. +55 −0 spec/fixtures/rails_project/Gemfile
  53. +261 −0 spec/fixtures/rails_project/README
  54. +7 −0 spec/fixtures/rails_project/Rakefile
  55. BIN  spec/fixtures/rails_project/app/assets/images/rails.png
  56. +9 −0 spec/fixtures/rails_project/app/assets/javascripts/application.js
  57. +7 −0 spec/fixtures/rails_project/app/assets/stylesheets/application.css
  58. +3 −0  spec/fixtures/rails_project/app/controllers/application_controller.rb
  59. +2 −0  spec/fixtures/rails_project/app/helpers/application_helper.rb
  60. 0  spec/fixtures/rails_project/app/mailers/.gitkeep
  61. 0  spec/fixtures/rails_project/app/models/.gitkeep
  62. +14 −0 spec/fixtures/rails_project/app/views/layouts/application.html.erb
  63. +4 −0 spec/fixtures/rails_project/config.ru
  64. +49 −0 spec/fixtures/rails_project/config/application.rb
  65. +6 −0 spec/fixtures/rails_project/config/boot.rb
  66. +48 −0 spec/fixtures/rails_project/config/database.yml
  67. +5 −0 spec/fixtures/rails_project/config/environment.rb
  68. +24 −0 spec/fixtures/rails_project/config/environments/development.rb
  69. +52 −0 spec/fixtures/rails_project/config/environments/production.rb
  70. +39 −0 spec/fixtures/rails_project/config/environments/test.rb
  71. +7 −0 spec/fixtures/rails_project/config/initializers/backtrace_silencers.rb
  72. +10 −0 spec/fixtures/rails_project/config/initializers/inflections.rb
  73. +5 −0 spec/fixtures/rails_project/config/initializers/mime_types.rb
  74. +7 −0 spec/fixtures/rails_project/config/initializers/secret_token.rb
  75. +8 −0 spec/fixtures/rails_project/config/initializers/session_store.rb
  76. +12 −0 spec/fixtures/rails_project/config/initializers/wrap_parameters.rb
  77. +5 −0 spec/fixtures/rails_project/config/locales/en.yml
  78. +58 −0 spec/fixtures/rails_project/config/routes.rb
  79. +7 −0 spec/fixtures/rails_project/db/seeds.rb
  80. +2 −0  spec/fixtures/rails_project/doc/README_FOR_APP
  81. 0  spec/fixtures/rails_project/lib/tasks/.gitkeep
  82. 0  spec/fixtures/rails_project/log/.gitkeep
  83. +26 −0 spec/fixtures/rails_project/public/404.html
  84. +26 −0 spec/fixtures/rails_project/public/422.html
  85. +26 −0 spec/fixtures/rails_project/public/500.html
  86. 0  spec/fixtures/rails_project/public/favicon.ico
  87. +241 −0 spec/fixtures/rails_project/public/index.html
  88. +5 −0 spec/fixtures/rails_project/public/robots.txt
  89. +6 −0 spec/fixtures/rails_project/script/rails
  90. 0  spec/fixtures/rails_project/test/fixtures/.gitkeep
  91. 0  spec/fixtures/rails_project/test/functional/.gitkeep
  92. 0  spec/fixtures/rails_project/test/integration/.gitkeep
  93. +12 −0 spec/fixtures/rails_project/test/performance/browsing_test.rb
  94. +13 −0 spec/fixtures/rails_project/test/test_helper.rb
  95. 0  spec/fixtures/rails_project/test/unit/.gitkeep
  96. 0  spec/fixtures/rails_project/vendor/assets/stylesheets/.gitkeep
  97. 0  spec/fixtures/rails_project/vendor/plugins/.gitkeep
  98. +5 −0 spec/fixtures/rails_project_with_steak/.gitignore
  99. +1 −0  spec/fixtures/rails_project_with_steak/.rspec
  100. +58 −0 spec/fixtures/rails_project_with_steak/Gemfile
  101. +261 −0 spec/fixtures/rails_project_with_steak/README
  102. +7 −0 spec/fixtures/rails_project_with_steak/Rakefile
  103. BIN  spec/fixtures/rails_project_with_steak/app/assets/images/rails.png
  104. +9 −0 spec/fixtures/rails_project_with_steak/app/assets/javascripts/application.js
  105. +7 −0 spec/fixtures/rails_project_with_steak/app/assets/stylesheets/application.css
  106. +3 −0  spec/fixtures/rails_project_with_steak/app/controllers/application_controller.rb
  107. +2 −0  spec/fixtures/rails_project_with_steak/app/helpers/application_helper.rb
  108. 0  spec/fixtures/rails_project_with_steak/app/mailers/.gitkeep
  109. 0  spec/fixtures/rails_project_with_steak/app/models/.gitkeep
  110. +14 −0 spec/fixtures/rails_project_with_steak/app/views/layouts/application.html.erb
  111. +4 −0 spec/fixtures/rails_project_with_steak/config.ru
  112. +49 −0 spec/fixtures/rails_project_with_steak/config/application.rb
  113. +6 −0 spec/fixtures/rails_project_with_steak/config/boot.rb
  114. +48 −0 spec/fixtures/rails_project_with_steak/config/database.yml
  115. +5 −0 spec/fixtures/rails_project_with_steak/config/environment.rb
  116. +24 −0 spec/fixtures/rails_project_with_steak/config/environments/development.rb
  117. +52 −0 spec/fixtures/rails_project_with_steak/config/environments/production.rb
  118. +39 −0 spec/fixtures/rails_project_with_steak/config/environments/test.rb
  119. +7 −0 spec/fixtures/rails_project_with_steak/config/initializers/backtrace_silencers.rb
  120. +10 −0 spec/fixtures/rails_project_with_steak/config/initializers/inflections.rb
  121. +5 −0 spec/fixtures/rails_project_with_steak/config/initializers/mime_types.rb
  122. +7 −0 spec/fixtures/rails_project_with_steak/config/initializers/secret_token.rb
  123. +8 −0 spec/fixtures/rails_project_with_steak/config/initializers/session_store.rb
  124. +12 −0 spec/fixtures/rails_project_with_steak/config/initializers/wrap_parameters.rb
  125. +5 −0 spec/fixtures/rails_project_with_steak/config/locales/en.yml
  126. +58 −0 spec/fixtures/rails_project_with_steak/config/routes.rb
  127. +15 −0 spec/fixtures/rails_project_with_steak/db/schema.rb
  128. +7 −0 spec/fixtures/rails_project_with_steak/db/seeds.rb
  129. +2 −0  spec/fixtures/rails_project_with_steak/doc/README_FOR_APP
  130. 0  spec/fixtures/rails_project_with_steak/lib/tasks/.gitkeep
  131. 0  spec/fixtures/rails_project_with_steak/log/.gitkeep
  132. +26 −0 spec/fixtures/rails_project_with_steak/public/404.html
  133. +26 −0 spec/fixtures/rails_project_with_steak/public/422.html
  134. +26 −0 spec/fixtures/rails_project_with_steak/public/500.html
  135. 0  spec/fixtures/rails_project_with_steak/public/favicon.ico
  136. +241 −0 spec/fixtures/rails_project_with_steak/public/index.html
  137. +5 −0 spec/fixtures/rails_project_with_steak/public/robots.txt
  138. +6 −0 spec/fixtures/rails_project_with_steak/script/rails
  139. +4 −0 spec/fixtures/rails_project_with_steak/spec/acceptance/acceptance_helper.rb
  140. 0  spec/fixtures/rails_project_with_steak/spec/acceptance/support/.gitignore
  141. +6 −0 spec/fixtures/rails_project_with_steak/spec/acceptance/support/helpers.rb
  142. +1 −1  {generators/steak/templates → spec/fixtures/rails_project_with_steak/spec/acceptance/support}/paths.rb
  143. +27 −0 spec/fixtures/rails_project_with_steak/spec/spec_helper.rb
  144. 0  spec/fixtures/rails_project_with_steak/test/fixtures/.gitkeep
  145. 0  spec/fixtures/rails_project_with_steak/test/functional/.gitkeep
  146. 0  spec/fixtures/rails_project_with_steak/test/integration/.gitkeep
  147. +12 −0 spec/fixtures/rails_project_with_steak/test/performance/browsing_test.rb
  148. +13 −0 spec/fixtures/rails_project_with_steak/test/test_helper.rb
  149. 0  spec/fixtures/rails_project_with_steak/test/unit/.gitkeep
  150. 0  spec/fixtures/rails_project_with_steak/vendor/assets/stylesheets/.gitkeep
  151. 0  spec/fixtures/rails_project_with_steak/vendor/plugins/.gitkeep
  152. +7 −0 spec/spec_helper.rb
  153. +73 −0 spec/support/helpers.rb
  154. +30 −0 spec/support/refresh_fixtures_task.rb
  155. +18 −20 steak.gemspec
View
8 .gitignore
@@ -1,5 +1,5 @@
+pkg/*
*.gem
-pkg
-rdoc
-webrat-*.html
-.bundle
+.bundle
+tmp
+*.rbc
View
12 Gemfile
@@ -1,2 +1,10 @@
-source :rubygems
-gemspec
+source 'http://rubygems.org'
+gemspec
+
+gem 'rails', '>= 3.1.0.rc1'
+
+gem 'sqlite3', :platforms => :ruby
+gem 'jdbc-sqlite3', :platforms => :jruby
+gem 'activerecord-jdbc-adapter', :platforms => :jruby
+
+gem 'ruby-debug', :platforms => :mri_18
View
195 Gemfile.lock
@@ -1,124 +1,143 @@
PATH
remote: .
specs:
- steak (1.0.1)
- rspec (>= 1.3)
+ steak (2.0.0.beta1)
+ capybara (>= 1.0.0.beta1)
+ rspec-rails (>= 2.5.0)
GEM
remote: http://rubygems.org/
specs:
- abstract (1.0.0)
- actionmailer (3.0.3)
- actionpack (= 3.0.3)
- mail (~> 2.2.9)
- actionpack (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- builder (~> 2.1.2)
- erubis (~> 2.6.6)
- i18n (~> 0.4)
- rack (~> 1.2.1)
- rack-mount (~> 0.6.13)
- rack-test (~> 0.5.6)
- tzinfo (~> 0.3.23)
- activemodel (3.0.3)
- activesupport (= 3.0.3)
- builder (~> 2.1.2)
- i18n (~> 0.4)
- activerecord (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- arel (~> 2.0.2)
- tzinfo (~> 0.3.23)
- activeresource (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- activesupport (3.0.3)
- arel (2.0.4)
- builder (2.1.2)
- capybara (0.4.0)
- celerity (>= 0.7.9)
- culerity (>= 0.2.4)
+ actionmailer (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ mail (~> 2.3.0)
+ actionpack (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6.0beta1)
+ rack (~> 1.3.0.beta2)
+ rack-cache (~> 1.0.1)
+ rack-mount (~> 0.8.1)
+ rack-test (~> 0.6.0)
+ sprockets (~> 2.0.0.beta.5)
+ tzinfo (~> 0.3.27)
+ activemodel (3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ bcrypt-ruby (~> 2.1.4)
+ builder (~> 3.0.0)
+ i18n (~> 0.6.0beta1)
+ activerecord (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ arel (~> 2.1.1)
+ tzinfo (~> 0.3.27)
+ activerecord-jdbc-adapter (1.1.1)
+ activeresource (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ activesupport (3.1.0.rc1)
+ multi_json (~> 1.0)
+ arel (2.1.1)
+ bcrypt-ruby (2.1.4)
+ bcrypt-ruby (2.1.4-java)
+ builder (3.0.0)
+ capybara (1.0.0.beta1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.27)
- xpath (~> 0.1.2)
- celerity (0.8.4)
- childprocess (0.1.4)
- ffi (~> 0.6.3)
- culerity (0.2.12)
+ xpath (~> 0.1.4)
+ childprocess (0.1.9)
+ ffi (~> 1.0.6)
+ columnize (0.3.2)
diff-lcs (1.1.2)
- erubis (2.6.6)
- abstract (>= 1.0.0)
- ffi (0.6.3)
- rake (>= 0.8.7)
- i18n (0.4.2)
- json_pure (1.4.6)
- mail (2.2.10)
- activesupport (>= 2.3.6)
- i18n (~> 0.4.1)
+ erubis (2.7.0)
+ ffi (1.0.9)
+ hike (1.0.0)
+ i18n (0.6.0)
+ jdbc-sqlite3 (3.6.14.2.056-java)
+ json_pure (1.5.1)
+ linecache (0.43)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
+ multi_json (1.0.3)
nokogiri (1.4.4)
polyglot (0.3.1)
- rack (1.2.1)
- rack-mount (0.6.13)
+ rack (1.3.0)
+ rack-cache (1.0.2)
+ rack (>= 0.4)
+ rack-mount (0.8.1)
rack (>= 1.0.0)
- rack-test (0.5.6)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.0)
rack (>= 1.0)
- rails (3.0.3)
- actionmailer (= 3.0.3)
- actionpack (= 3.0.3)
- activerecord (= 3.0.3)
- activeresource (= 3.0.3)
- activesupport (= 3.0.3)
+ rails (3.1.0.rc1)
+ actionmailer (= 3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activerecord (= 3.1.0.rc1)
+ activeresource (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
bundler (~> 1.0)
- railties (= 3.0.3)
- railties (3.0.3)
- actionpack (= 3.0.3)
- activesupport (= 3.0.3)
+ railties (= 3.1.0.rc1)
+ railties (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
- thor (~> 0.14.4)
- rake (0.8.7)
- rspec (2.1.0)
- rspec-core (~> 2.1.0)
- rspec-expectations (~> 2.1.0)
- rspec-mocks (~> 2.1.0)
- rspec-core (2.1.0)
- rspec-expectations (2.1.0)
+ thor (~> 0.14.6)
+ rake (0.9.1)
+ rspec (2.6.0)
+ rspec-core (~> 2.6.0)
+ rspec-expectations (~> 2.6.0)
+ rspec-mocks (~> 2.6.0)
+ rspec-core (2.6.3)
+ rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.1.0)
- rspec-rails (2.1.0)
- rspec (~> 2.1.0)
+ rspec-mocks (2.6.0)
+ rspec-rails (2.6.1)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ railties (~> 3.0)
+ rspec (~> 2.6.0)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
rubyzip (0.9.4)
- selenium-webdriver (0.1.0)
- childprocess (= 0.1.4)
- ffi (~> 0.6.3)
+ selenium-webdriver (0.2.1)
+ childprocess (>= 0.1.7)
+ ffi (>= 1.0.7)
json_pure
rubyzip
- sqlite3-ruby (1.3.2)
+ sprockets (2.0.0.beta.9)
+ hike (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.3)
thor (0.14.6)
+ tilt (1.3.2)
treetop (1.4.9)
polyglot (>= 0.3.1)
- tzinfo (0.3.23)
- webrat (0.7.2)
- nokogiri (>= 1.2.0)
- rack (>= 1.0)
- rack-test (>= 0.5.3)
- xpath (0.1.2)
+ tzinfo (0.3.27)
+ xpath (0.1.4)
nokogiri (~> 1.3)
PLATFORMS
+ java
ruby
DEPENDENCIES
- capybara
- rails (>= 3.0.0)
- rspec (>= 1.3)
- rspec-rails (>= 2.0.0)
- sqlite3-ruby
+ activerecord-jdbc-adapter
+ jdbc-sqlite3
+ rails (>= 3.1.0.rc1)
+ ruby-debug
+ sqlite3
steak!
- webrat
View
27 History.md
@@ -1,27 +0,0 @@
-# Steak Release History #
-
-## Version 1.1.0 / 2011-01-15 ##
-
-[full changelog](https://github.com/cavalle/steak/compare/v1.0.1...v1.1.0)
-
-### Enhancements ###
-
-* If rspec-rails is present, a Steak spec now inherits from RequestExampleGroup which already takes care of including Webrat or Capybara. That means that `acceptance_helper.rb` no longer needs to include or initialize them (only change the default configuration if necessary)
-* Ensure that rake works in environments without rspec gem installed
-
-### Bugfixes ###
-
-* Prevents the generator from emptying spec/acceptance when running 'rails destroy steak:spec'.
-
-
-## Version 1.0.1 / 2010-12-26 ##
-
-[full changelog](https://github.com/cavalle/steak/compare/v1.0.0...v1.0.1)
-
-### Bugfixes ###
-
-* Fix `be_` and `have_` matchers not working with rspec 1.3
-
-## Version 1.0.0 / 2010-10-22 ##
-
-First stable version of Steak. [Announcement](http://groups.google.com/group/steakrb/browse_thread/thread/b90c86d0b7464a56)
View
2  MIT-LICENSE → LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2009 Luismi Cavallé
+Copyright (c) 2009-2011 Luismi Cavallé
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
110 README.md
@@ -0,0 +1,110 @@
+## TODO
+* Rake stats
+* Manual test different scenarios: rspec-rails already present, upgrade from Steak-1…
+
+# Steak
+
+The delicious combination of RSpec and Capybara for Acceptance BDD
+
+![Steak!!](http://dl.dropbox.com/u/645329/steak_small.jpg "Steak!!")
+
+## What is Steak?
+
+Steak is a minimal extension of RSpec-Rails that adds several conveniences to do acceptance testing of Rails applications using Capybara. It's an alternative to Cucumber in plain Ruby. This is how and acceptance spec looks like in Steak:
+
+ feature 'Main page' do
+
+ background do
+ create_user :login => 'jdoe'
+ end
+
+ scenario 'should show existing quotes' do
+ create_quote :text => 'The language of friendship is not words, but meanings',
+ :author => 'Henry David Thoreau'
+
+ login_as 'jdoe'
+ visit '/'
+
+ within('.quote') do
+ page.should have_content('The language of friendship is not words, but meanings')
+ page.should have_content('Henry David Thoreau')
+ end
+ end
+
+ end
+
+No givens, whens or thens. No steps, no english, just Ruby. The delicious combination of RSpec and Capybara. That's Steak!
+
+## Why Steak?
+
+If, after all, this is just RSpec + Capybara, why does Steak even exist? Do I really need it?
+
+Basically Steak exists for three reasons:
+
+1. **Making a point**. First of all, Steak proposes that using RSpec and Capybara for acceptance testing is a sensible alternative to Cucumber. It also sets a name to refer to that approach.
+1. **Adding convenience**. As a gem, Steak aims to make the experience as convenient as possible. It provides Rails integration testing support and several generators and rake tasks so that setting up a new project or creating and running specs are quick and seamless tasks. A natural extension of RSpec-Rails.
+1. **Building a community**. No development approach or ruby gem is really valuable without an active community behind it. The mailing list, the IRC channel, the wiki or the twitter account are useful tools to build a community of users that help each other by sharing knowledge, resources and best practices.
+
+## Getting Started
+
+_NOTE: The latest version of Steak assumes that you're testing a Rails 3 application, with RSpec 2 and Capybara. For Rails 2, RSpec 1 or Webrat you should use Steak 1.x (or consider upgrading to non-obsolete technologies ;P)_
+
+It's super-easy to get you started. Just add the gem to your `Gemfile`
+
+ group :test, :development do
+ gem 'steak'
+ # ...
+
+…and then install the gem and run the generator:
+
+ $ bundle
+ $ rails g steak:install
+
+You're now set up! Take a look at the default directory structure you've got under `spec/acceptance`. It will help you organize the helpers and configurations for your acceptance specs.
+
+Note that Steak is the only dependency you really need, you can safely remove any reference to `capybara`, `rspec-rails` or `rspec` from your `Gemfile`, they will be included by Steak. Also note that, unless previously executed, Steak will run the RSpec generator so you don't need to invoke it.
+
+## Creating and running specs
+
+You can create your specs by hand, however you may prefer to use the generator:
+
+ $ rails g steak:spec my_first_feature
+
+To run your acceptance specs you just do like with any other spec…
+
+ $ rspec spec/acceptance/my_first_feature_spec.rb
+
+…or using rake:
+
+ $ rake spec:acceptance
+
+## Resources
+
+* [Source code](http://github.com/cavalle/steak) – Lurking and forking
+* [Issues](http://github.com/cavalle/steak/issues) – Bugs and feature requests
+* [Google Group](http://groups.google.com/group/steakrb) & [IRC channel](irc://irc.freenode.net/jenkinsci) – Help and discussion
+* [Twitter](http://twitter.com/steakrb) – Announcements and mentions
+* [Wiki](https://github.com/cavalle/steak/wiki) – Tutorials, docs and other resources
+
+## Credits
+
+Steak was created by [Luismi Cavallé](http://lmcavalle.com) and improved thanks to the love from:
+
+* Álvaro Bautista
+* Felipe Talavera
+* Paco Guzmán
+* Jeff Kreeftmeijer
+* Jaime Iniesta
+* Emili Parreño
+* Andreas Wolff
+* Wincent Colaiuta
+* Falk Pauser
+* Francesc Esplugas
+* Raúl Murciano
+* Enable Interactive
+* Vojto Rinik
+* Fred Wu
+* Sergio Espeja
+* Joao Carlos
+
+Copyright © 2009 - 2011 Luismi Cavallé, released under the MIT license
View
203 README.rdoc
@@ -1,203 +0,0 @@
-= Steak
-
-Minimalist acceptance testing on top of RSpec
-
-http://dl.dropbox.com/u/645329/steak_small.jpg
-
-== What is Steak?
-
-Steak is an Acceptance BDD solution (like Cucumber) but in plain Ruby. This
-is how an acceptance spec looks like in Steak:
-
- feature "Main page" do
-
- background do
- create_user :login => "jdoe"
- login_as "jdoe"
- end
-
- scenario "should show existing quotes" do
- create_quote :text => "The language of friendship is not words, but meanings",
- :author => "Henry David Thoreau"
-
- visit "/"
-
- page.should have_css(".quote", :count => 1)
- within(:css, ".quote") do
- page.should have_css(".text", :text => "The language of friendship is not words, but meanings")
- page.should have_css(".author", :text => "Henry David Thoreau")
- end
- end
-
- end
-
-No explicit givens, whens or thens. No steps, no english, just Ruby: RSpec,
-Steak and, in this example, some factories and Capybara. That's all.
-
-If you are not in Rails but use RSpec, then Steak is just some aliases
-providing you with the language of acceptance testing (+feature+, +scenario+,
-+background+). If you are in Rails, you also have a couple of generators, a
-rake task and full Rails integration testing (meaning Webrat support, for
-instance)
-
-== Why Steak?
-
-If, after all, this is just RSpec + Capybara, why does Steak even exist? Do I really need it?
-
-Basically Steak exists for three reasons:
-
-1. *Making a point*. First of all, Steak proposes that using RSpec and Capybara for acceptance testing is a sensible alternative to Cucumber. It also sets a name to refer to that approach.
-2. *Adding convenience*. As a gem, Steak aims to make the experience as convenient as possible. It provides several Rails generators and Rake tasks so that setting up a new project or creating and running specs are quick and seamless tasks. A natural extension of RSpec-Rails.
-3. *Building a community*. No development approach or ruby gem is really valuable without an active community behind it. The mailing list, the IRC channel, the wiki or the twitter account are useful tools to build a community of users that help each other by sharing knowledge, resources and best practices.
-
-== Getting started
-
-=== Not in Rails
-
-Just install and require the damned gem!
-
- $ gem install steak
-
-Then in your spec or spec helper:
-
- require 'steak'
-
-That's all. You don't really need to require RSpec.
-
-=== In Rails 3
-
-Add this to your project's <tt>Gemfile</tt>:
-
- group :development, :test do
- gem 'rspec-rails'
- gem 'steak'
- gem 'capybara'
-
- # Other usual suspects:
- # gem 'delorean'
- # gem 'database_cleaner'
- # gem 'spork'
- end
-
-And install:
-
- $ bundle install
-
-Run the generators:
-
- $ rails g rspec:install
- $ rails g steak:install
-
-That will create some basic helper files and directory structure under the
-<tt>spec/acceptance</tt> directory, already configured for +Capybara+.
-
-Spend one minute on getting familiar with the structure and files you've got.
-
-Now you may want to create your first acceptance spec:
-
- $ rails generate steak:spec this_is_my_first_feature
-
-You run your acceptance specs just like your regular specs. Individually...
-
- $ rspec spec/acceptance/this_is_my_first_feature_spec.rb
-
-...or all together:
-
- $ rspec spec/acceptance
-
-...you can also do:
-
- $ rake spec:acceptance
-
-=== In Rails 2.x
-
-You need to setup rspec-rails before installing Steak. Make sure you use rspec(-rails) 1.x versions and not 2.x which don't work with Rails 2.3. You may want to use bundler and/or rvm to make sure the right versions of the gems are used.
-
-Assuming you have already setup rspec-rails 1.x, add this to your project's
-<tt>config/environments/test.rb</tt>:
-
- config.gem "steak", :lib => false
-
-Install the gem from the command line:
-
- $ RAILS_ENV=test rake gems:install
-
-Run the generator:
-
- $ script/generate steak
-
-That will create some basic helper files and directory structure under the
-<tt>spec/acceptance</tt> directory, already configured for +Capybara+. If you want to
-use +Webrat+, just pass it to the generator:
-
- $ script/generate steak --webrat
-
-Spend one minute on getting familiar with the structure and files you've got.
-
-Now you may want to create your first acceptance spec:
-
- $ script/generate acceptance_spec this_is_my_first_feature
-
-You run your acceptance specs just like your regular specs. Individually...
-
- $ spec spec/acceptance/this_is_my_first_feature_spec.rb
-
-...or all together:
-
- $ spec spec/acceptance
-
-...you can also do:
-
- $ rake spec:acceptance
-
-== RSpec & Metadata
-
-Steak scenarios are just regular RSpec examples with their metadata attribute
-<tt>:type</tt> set to <tt>:acceptance</tt>. That's useful if you want to make sure you
-include helpers or set hooks only for your acceptance specs and not for the
-rest of the specs in your suite.
-
-You'd do it this way:
-
- RSpec.configure do |config|
- # include MyHelpers module in every acceptance spec
- config.include MyHelpers, :type => :acceptance
-
- config.before(:each, :type => :acceptance) do
- # Some code to run before any acceptance spec
- end
- end
-
-== Resources
-
-- Source: http://github.com/cavalle/steak
-- Issues: http://github.com/cavalle/steak/issues
-- Group: http://groups.google.com/group/steakrb
-- IRC channel: #steakrb on freenode
-- Twitter: http://twitter.com/steakrb
-- Tutorial: http://jeffkreeftmeijer.com/2010/steak-because-cucumber-is-for-vegetarians/
-- Hashtag: #steakrb
-- More resources: http://wiki.github.com/cavalle/steak/resources
-
-== Credits
-
-Steak was created by Luismi Cavallé and improved thanks to the love from:
-
-- Álvaro Bautista
-- Felipe Talavera
-- Paco Guzmán
-- Jeff Kreeftmeijer
-- Jaime Iniesta
-- Emili Parreño
-- Andreas Wolff
-- Wincent Colaiuta
-- Falk Pauser
-- Francesc Esplugas
-- Raúl Murciano
-- Enable Interactive
-- Vojto Rinik
-- Fred Wu
-- Sergio Espeja
-- Joao Carlos
-
-Copyright (c) 2009, 2010 Luismi Cavallé, released under the MIT license
View
24 Rakefile
@@ -1,23 +1,9 @@
-require 'rake'
-require 'rake/rdoctask'
-require 'rspec/core'
+require 'bundler'
require 'rspec/core/rake_task'
+require './spec/support/refresh_fixtures_task'
-desc 'Default: run specs.'
-task :default => :spec
+Bundler::GemHelper.install_tasks
-desc 'Run specs for the steak plugin.'
-RSpec::Core::RakeTask.new(:spec) do |t|
- t.skip_bundler = true
- t.pattern = FileList["spec/**/*_spec.rb"]
-end
+RSpec::Core::RakeTask.new(:spec)
-desc 'Generate documentation for the steak plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'Steak'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.options << '--charset' << 'utf-8'
- rdoc.rdoc_files.include('README.rdoc')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
+task :default => :spec
View
1  generators/acceptance_spec/USAGE
@@ -1 +0,0 @@
-s
View
9 generators/acceptance_spec/acceptance_spec_generator.rb
@@ -1,9 +0,0 @@
-class AcceptanceSpecGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- m.directory File.join('spec/acceptance', class_path)
- file_name.gsub!(/_spec$/,"")
- m.template 'acceptance_spec.rb', File.join('spec/acceptance', class_path, "#{file_name}_spec.rb")
- end
- end
-end
View
12 generators/acceptance_spec/templates/acceptance_spec.rb
@@ -1,12 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')
-
-feature "Feature name", %q{
- In order to ...
- As a ...
- I want to ...
-} do
-
- scenario "Scenario name" do
- true.should == true
- end
-end
View
8 generators/steak/USAGE
@@ -1,8 +0,0 @@
-Description:
- Sets up Steak in your Rails project. This will generate the spec/acceptance directory
- and the necessary files.
-
- If you haven't already, You should also run `./script/generate rspec` to complete the set up.
-
-Examples:
- `./script/generate steak`
View
26 generators/steak/steak_generator.rb
@@ -1,26 +0,0 @@
-class SteakGenerator < Rails::Generator::Base
- default_options :driver => 'capybara'
-
- def initialize(runtime_args, runtime_options = {})
- puts "Defaulting to Capybara..." if runtime_args.empty?
- super
- end
-
- def manifest
- record do |m|
- m.directory 'spec/acceptance/support'
- m.directory 'lib/tasks'
- m.template "acceptance_helper.rb", "spec/acceptance/acceptance_helper.rb"
- m.file "helpers.rb", "spec/acceptance/support/helpers.rb"
- m.file "paths.rb", "spec/acceptance/support/paths.rb"
- m.file "steak.rake", "lib/tasks/steak.rake"
- end
- end
-
- def add_options!(opt)
- opt.separator ''
- opt.separator 'Options:'
- opt.on('--capybara', 'Use Capybara (default).') { |v| options[:driver] = 'capybara' }
- opt.on('--webrat', 'Use Webrat.') { |v| options[:driver] = 'webrat' }
- end
-end
View
18 generators/steak/templates/acceptance_helper.rb
@@ -1,18 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
-require "steak"
-<%- if options[:driver] == 'webrat' %>
-require "webrat"
-
-Webrat.configure do |config|
- config.mode = :rails
-end
-<%- else -%>
-require 'capybara/rails'
-
-Spec::Runner.configure do |config|
- config.include Capybara
-end
-<%- end -%>
-
-# Put your acceptance spec helpers inside /spec/acceptance/support
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
View
5 generators/steak/templates/helpers.rb
@@ -1,5 +0,0 @@
-module HelperMethods
- # Put helper methods you need to be available in all tests here.
-end
-
-Spec::Runner.configuration.include(HelperMethods)
View
44 generators/steak/templates/steak.rake
@@ -1,44 +0,0 @@
-unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
-
-begin
- require 'spec/rake/spectask'
-rescue MissingSourceFile
- module Spec
- module Rake
- class SpecTask
- def initialize(name)
- task name do
- # if rspec-rails is a configured gem, this will output helpful material and exit ...
- require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment"))
-
- # ... otherwise, do this:
- raise <<-MSG
-
-#{"*" * 80}
-* You are trying to run an rspec rake task defined in
-* #{__FILE__},
-* but rspec can not be found in vendor/gems, vendor/plugins or system gems.
-#{"*" * 80}
-MSG
- end
- end
- end
- end
- end
-end
-
-namespace :spec do
- desc "Run the code examples in spec/acceptance"
- Spec::Rake::SpecTask.new(:acceptance => "db:test:prepare") do |t|
- t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
- t.spec_files = FileList["spec/acceptance/**/*_spec.rb"]
- end
-
- # Setup stats to include acceptance specs
- task :statsetup do
- require 'code_statistics'
- ::STATS_DIRECTORIES << %w(Acceptance\ specs spec/acceptance) if File.exist?('spec/acceptance')
- ::CodeStatistics::TEST_TYPES << "Acceptance specs" if File.exist?('spec/acceptance')
- end
-end
-end
View
12 lib/generators/steak/install_generator.rb
@@ -0,0 +1,12 @@
+module Steak
+ module Generators
+ class InstallGenerator < Rails::Generators::Base
+ source_root File.join(File.dirname(__FILE__), 'templates')
+
+ def main
+ generate 'rspec:install'
+ directory 'spec/acceptance'
+ end
+ end
+ end
+end
View
11 lib/generators/steak/spec_generator.rb
@@ -0,0 +1,11 @@
+module Steak
+ module Generators
+ class SpecGenerator < Rails::Generators::NamedBase
+ source_root File.join(File.dirname(__FILE__), 'templates')
+
+ def main
+ template 'acceptance_spec.rb', File.join('spec/acceptance', class_path, "#{file_name}_spec.rb")
+ end
+ end
+ end
+end
View
13 lib/generators/steak/templates/acceptance_spec.rb
@@ -0,0 +1,13 @@
+require 'acceptance/acceptance_helper'
+
+feature '<%= human_name %>', %q{
+ In order to ...
+ As a ...
+ I want ...
+} do
+
+ scenario 'first scenario' do
+ true.should == true
+ end
+
+end
View
4 lib/generators/steak/templates/spec/acceptance/acceptance_helper.rb
@@ -0,0 +1,4 @@
+require 'spec_helper'
+
+# Put your acceptance spec helpers inside spec/acceptance/support
+Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
View
0  lib/generators/steak/templates/spec/acceptance/support/.gitignore
No changes.
View
6 lib/generators/steak/templates/spec/acceptance/support/helpers.rb
@@ -0,0 +1,6 @@
+module HelperMethods
+ # Put helper methods you need to be available in all acceptance specs here.
+
+end
+
+RSpec.configuration.include HelperMethods, :type => :acceptance
View
2  lib/rspec-2/rails/generators/templates/paths.rb → .../steak/templates/spec/acceptance/support/paths.rb
@@ -6,4 +6,4 @@ def homepage
end
end
-RSpec.configuration.include NavigationHelpers, :type => :acceptance
+RSpec.configuration.include NavigationHelpers, :type => :acceptance
View
17 lib/rspec-1/steak.rb
@@ -1,17 +0,0 @@
-module Spec::Example::ExampleGroupMethods
- alias scenario example
- alias background before
-end
-
-class << self
- alias feature describe
-end
-
-if defined?(Spec::Rails)
- module Spec::Rails::Example
- class AcceptanceExampleGroup < IntegrationExampleGroup
- include ActionController::RecordIdentifier
- Spec::Example::ExampleGroupFactory.register(:acceptance, self)
- end
- end
-end
View
31 lib/rspec-2/rails/generators/install_generator.rb
@@ -1,31 +0,0 @@
-require 'rails/generators'
-
-module Steak
- class InstallGenerator < Rails::Generators::Base
- source_root File.join(File.dirname(__FILE__), 'templates')
-
- desc <<-DESC
-Description:
- Sets up Steak in your Rails project. This will generate the
- spec/acceptance directory and the necessary files.
-
- If you haven't already, You should also run
- `rails generate rspec:install` to complete the set up.
-
-Examples:
- `rails generate steak:install`
-DESC
-
- def initialize(args=[], options={}, config={})
- puts "Defaulting to Capybara..." if options.empty?
- super
- end
-
- def manifest
- empty_directory 'spec/acceptance/support'
- template "acceptance_helper.rb", "spec/acceptance/acceptance_helper.rb"
- copy_file "helpers.rb", "spec/acceptance/support/helpers.rb"
- copy_file "paths.rb", "spec/acceptance/support/paths.rb"
- end
- end
-end
View
36 lib/rspec-2/rails/generators/spec_generator.rb
@@ -1,36 +0,0 @@
-require 'rails/generators'
-require 'active_support/inflector/inflections'
-
-module Steak
- class SpecGenerator < Rails::Generators::NamedBase
- source_root File.join(File.dirname(__FILE__), 'templates')
-
- desc <<-DESC
-Description:
- Create an acceptance spec for the feature NAME in the
- 'spec/acceptance' folder.
-
-Example:
- `rails generate steak:spec checkout`
-
- Creates an acceptance spec for the "checkout" feature:
- spec/acceptance/checkout_spec.rb
-DESC
-
- def manifest
- if behavior == :invoke
- empty_directory File.join('spec/acceptance', class_path)
- end
-
- file_name.gsub!(/_spec$/, "")
-
- @feature_name = file_name.titleize
- @relative_path = "../" * class_path.size
-
- target = File.join('spec/acceptance', class_path,
- "#{file_name}_spec.rb")
-
- template 'acceptance_spec.rb', target
- end
- end
-end
View
5 lib/rspec-2/rails/generators/templates/acceptance_helper.rb
@@ -1,5 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
-require "steak"
-
-# Put your acceptance spec helpers inside /spec/acceptance/support
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
View
12 lib/rspec-2/rails/generators/templates/acceptance_spec.rb
@@ -1,12 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/<%= @relative_path %>acceptance_helper')
-
-feature "<%= @feature_name %>", %q{
- In order to ...
- As a ...
- I want to ...
-} do
-
- scenario "Scenario name" do
- true.should == true
- end
-end
View
5 lib/rspec-2/rails/generators/templates/helpers.rb
@@ -1,5 +0,0 @@
-module HelperMethods
- # Put helper methods you need to be available in all tests here.
-end
-
-RSpec.configuration.include HelperMethods, :type => :acceptance
View
14 lib/rspec-2/rails/railtie.rb
@@ -1,14 +0,0 @@
-require 'steak'
-require 'rails'
-
-module Steak
- class Railtie < ::Rails::Railtie
- rake_tasks do
- load File.dirname(__FILE__) + "/tasks/steak.rake"
- end
- generators do
- require File.dirname(__FILE__) + "/generators/install_generator"
- require File.dirname(__FILE__) + "/generators/spec_generator"
- end
- end
-end
View
14 lib/rspec-2/rails/tasks/steak.rake
@@ -1,14 +0,0 @@
-require 'rspec/core/rake_task'
-
-namespace :spec do
- desc "Run the code examples in spec/acceptance"
- RSpec::Core::RakeTask.new(:acceptance => "db:test:prepare") do |t|
- t.pattern = "spec/acceptance/**/*_spec.rb"
- end
-
- task :statsetup do
- require 'rails/code_statistics'
- ::STATS_DIRECTORIES << %w(Acceptance\ specs spec/acceptance) if File.exist?('spec/acceptance')
- ::CodeStatistics::TEST_TYPES << "Acceptance specs" if File.exist?('spec/acceptance')
- end
-end
View
31 lib/rspec-2/steak.rb
@@ -1,31 +0,0 @@
-require File.dirname(__FILE__) + '/rails/railtie' if defined?(Rails)
-
-module Steak
- module AcceptanceExampleGroup
- def self.included(base)
- base.instance_eval do
- alias scenario example
- alias background before
-
- if defined?(RSpec::Rails)
- include RSpec::Rails::RequestExampleGroup
- include Rack::Test::Methods
- metadata[:type] = :acceptance
- end
- end
- end
- end
-
- module DSL
- def feature(*args, &block)
- args << {} unless args.last.is_a?(Hash)
- args.last.update :type => :acceptance, :steak => true, :caller => caller
- describe(*args, &block)
- end
- end
-end
-
-extend Steak::DSL
-
-RSpec.configuration.include Steak::AcceptanceExampleGroup, :type => :acceptance
-
View
14 lib/steak.rb
@@ -1,11 +1,5 @@
-begin
- require 'rspec/core'
-rescue LoadError
- require 'spec'
-end
+require 'capybara/rspec'
+require 'rspec-rails'
-if defined?(RSpec::Core)
- require 'rspec-2/steak'
-else
- require 'rspec-1/steak'
-end
+require 'steak/railtie'
+require 'steak/acceptance_example_group'
View
12 lib/steak/acceptance_example_group.rb
@@ -0,0 +1,12 @@
+module Steak
+ module AcceptanceExampleGroup
+ extend ActiveSupport::Concern
+
+ included do
+ include RSpec::Rails::RequestExampleGroup
+ metadata[:type] = :acceptance
+ end
+ end
+end
+
+RSpec.configuration.include Steak::AcceptanceExampleGroup, :capybara_feature => true
View
7 lib/steak/railtie.rb
@@ -0,0 +1,7 @@
+module Steak
+ class Railtie < ::Rails::Railtie
+ rake_tasks do
+ load 'tasks/steak_tasks.rake'
+ end
+ end
+end
View
3  lib/steak/version.rb
@@ -0,0 +1,3 @@
+module Steak
+ VERSION = '2.0.0.beta1'
+end
View
14 lib/tasks/steak_tasks.rake
@@ -0,0 +1,14 @@
+namespace :spec do
+ desc 'Run the acceptance specs in spec/acceptance'
+ RSpec::Core::RakeTask.new(:acceptance => 'db:test:prepare') do |t|
+ t.pattern = 'spec/acceptance/**/*_spec.rb'
+ end
+
+ task :statsetup do
+ if File.exist?('spec/acceptance')
+ require 'rails/code_statistics'
+ ::STATS_DIRECTORIES << ['Acceptance specs', 'spec/acceptance']
+ ::CodeStatistics::TEST_TYPES << 'Acceptance specs'
+ end
+ end
+end
View
75 spec/acceptance/creating_specs_spec.rb
@@ -0,0 +1,75 @@
+require 'spec_helper'
+
+feature 'Creating acceptance specs', %q{
+ In order to not having to do it manually
+ As a lazy Rails developer
+ I want empty new specs to be generated for me
+} do
+
+ scenario 'using the spec generator' do
+ new_project_from :rails_project_with_steak
+
+ run 'rails g steak:spec my_first_feature'
+
+ path('spec/acceptance/my_first_feature_spec.rb').should exist
+ content_of('spec/acceptance/my_first_feature_spec.rb').should include("require 'acceptance/acceptance_helper'")
+ content_of('spec/acceptance/my_first_feature_spec.rb').should include("feature 'My first feature'")
+
+ run 'rspec spec/acceptance/my_first_feature_spec.rb'
+
+ output.should =~ /1 example, 0 failures/
+ end
+
+ scenario 'under a subdirectory' do
+ new_project_from :rails_project_with_steak
+
+ run 'rails g steak:spec subdir/my_first_feature'
+
+ content_of('spec/acceptance/subdir/my_first_feature_spec.rb').should include("feature 'My first feature'")
+
+ run 'rspec spec/acceptance/subdir/my_first_feature_spec.rb'
+
+ output.should =~ /1 example, 0 failures/
+ end
+
+ scenario 'with Capybara and paths' do
+ new_project_from :rails_project_with_steak
+
+ create_file 'spec/acceptance/capybara_spec.rb', <<-RSPEC
+ require 'acceptance/acceptance_helper'
+
+ feature 'Capybara and paths' do
+ scenario 'should visit homepage' do
+ visit homepage
+
+ page.should have_content("Ruby on Rails: Welcome aboard")
+ end
+ end
+ RSPEC
+
+ run 'rspec spec/acceptance/capybara_spec.rb'
+
+ output.should =~ /1 example, 0 failures/
+ end
+
+ scenario 'with Rails integration testing support' do
+ new_project_from :rails_project_with_steak
+
+ create_file 'spec/acceptance/integration_spec.rb', <<-RSPEC
+ require 'acceptance/acceptance_helper'
+
+ feature 'Capybara and paths' do
+ scenario 'should visit homepage' do
+ get '/'
+
+ status.should == 200
+ end
+ end
+ RSPEC
+
+ run 'rspec spec/acceptance/integration_spec.rb'
+
+ output.should =~ /1 example, 0 failures/
+ end
+
+end
View
33 spec/acceptance/getting_started_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+feature 'Getting started', %q{
+ In order to start coding my awesome new project
+ As a Rails developer
+ I want set up my project for Acceptance BDD
+} do
+
+ scenario 'from an empty Rails project' do
+ new_project_from :rails_project
+
+ append_to 'Gemfile', <<-GEMS
+ group :test, :development do
+ gem 'steak', :path => '#{root_path}'
+ end
+ GEMS
+
+ run 'bundle --local'
+ run 'rails g steak:install'
+
+ # rspec-rails should be present
+ path('spec').should exist
+ path('spec/spec_helper.rb').should exist
+
+ # steak should be present
+ path('spec/acceptance').should exist
+ path('spec/acceptance/acceptance_helper.rb').should exist
+ path('spec/acceptance/support').should exist
+ path('spec/acceptance/support/helpers.rb').should exist
+ path('spec/acceptance/support/paths.rb').should exist
+ end
+
+end
View
40 spec/acceptance/rake_support_spec.rb
@@ -0,0 +1,40 @@
+require 'spec_helper'
+
+feature 'Rake support', %q{
+ In order to conveniently run my specs along with the rest of my test suite
+ As a Rails developer
+ I want rake support in Steak
+} do
+
+ background do
+ new_project_from :rails_project_with_steak
+ create_file 'spec/models/model_spec.rb', <<-RSPEC
+ require 'spec_helper'
+
+ describe Object do
+ it { should respond_to :to_s }
+ end
+ RSPEC
+ run 'rails g steak:spec my_spec'
+ end
+
+ scenario 'to run acceptance specs as part of the test suite' do
+ run 'rake spec'
+ output.should =~ /2 examples, 0 failures/
+
+ run 'rake'
+ output.should =~ /2 examples, 0 failures/
+ end
+
+ scenario 'to run only acceptance specs' do
+ run 'rake spec:acceptance'
+ output.should =~ /1 example, 0 failures/
+ end
+
+ scenario "to get stats" do
+ run 'rake stats'
+ output.should =~ /Model specs \D+ 5 /
+ output.should =~ /Acceptance specs \D+ [1-9]+ /
+ end
+
+end
View
98 spec/acceptance/rspec-1/acceptance_helper.rb
@@ -1,98 +0,0 @@
-require 'rubygems'
-require 'rspec'
-require File.dirname(__FILE__) + "/../../../lib/steak"
-require 'tempfile'
-require 'shellwords'
-
-module RSpec_1
- module Factories
- def create_spec(options)
- options = {:content => options} unless options.is_a?(Hash)
- path = (options[:path] || current_dir) + "/#{String.random}_spec.rb"
- File.open(path, "w") do |file|
- file.write options[:content]
- end
- path
- end
-
- def create_rails_app(options = {})
- path = current_dir + "/rails_app_#{String.random}"
- FileUtils.rm_rf path
- run "rails #{path}"
- FileUtils.rm path + '/public/index.html'
- File.open(path + "/config/environments/test.rb", "a") do |file|
- file.write <<-CONFIG
- config.gem 'rspec-rails', :lib => false
- CONFIG
- end
- FileUtils.cp_r steak_dir, path + "/vendor/plugins/steak"
-
- Dir.chdir path do
- run "script/generate rspec"
- end
-
- unless options[:setup_steak] == false
- Dir.chdir path do
- run "script/generate steak"
- end
- end
-
- path
- end
-
- end
-
- module HelperMethods
- def run(cmd)
- puts cmd if trace?
- `rvm @steak-rspec-1 exec #{cmd} 2>&1`.tap do |o|
- puts o if trace? and o
- end
- end
-
- def trace?
- ENV['TRACE']
- end
-
- def run_spec(file_path)
- run "spec #{file_path}"
- end
-
- def current_dir
- Dir.tmpdir + "/steak_rspec_1"
- end
-
- def steak_dir
- File.expand_path(File.dirname(__FILE__) + "/../../../")
- end
- end
-
- def self.gemset_create(gemset, *gems)
- `rvm gemset create #{gemset}`
- gems.each do |name|
- name = Shellwords.escape(name)
- `rvm @#{gemset} gem search #{name} -i || rvm @#{gemset} gem install #{name}`
- end
- end
-
- RSpec.configure do |config|
- config.include Factories, :example_group => { :file_path => /rspec-1/}
- config.include HelperMethods, :example_group => { :file_path => /rspec-1/}
- config.before :suite do
- gemset_create "steak-rspec-1", "rspec-rails -v '~> 1'",
- "rails -v '~> 2'",
- "webrat",
- "capybara",
- "sqlite3-ruby",
- "rake",
- "test-unit -v '1.2.3'"
- end
- end
-end
-
-class String
- CHARS = ('a'..'z').to_a + ('A'..'Z').to_a
- def self.random(size = 8)
- (0..size).map{ CHARS[rand(CHARS.length)] }.join
- end
-end
View
44 spec/acceptance/rspec-1/acceptance_spec_generator_spec.rb
@@ -1,44 +0,0 @@
-require File.dirname(__FILE__) + "/acceptance_helper.rb"
-
-feature "Acceptance spec generator for rails", %q{
- In order to quickly add a new acceptance spec
- As a developer
- I want to run a generator that creates it for me
-} do
-
- background do
- @rails_app = create_rails_app
- end
-
- scenario "Adding new acceptance spec" do
- Dir.chdir @rails_app do
- run "script/generate acceptance_spec document_creation"
- end
-
- File.exist?(@rails_app + "/spec/acceptance/document_creation_spec.rb").should be_true
- end
-
- scenario "Adding new acceptance spec (plural name)" do
- Dir.chdir @rails_app do
- run "script/generate acceptance_spec creating_documents"
- end
-
- File.exist?(@rails_app + "/spec/acceptance/creating_documents_spec.rb").should be_true
- end
-
- scenario "Adding new acceptance spec (pascalized name)" do
- Dir.chdir @rails_app do
- run "script/generate acceptance_spec DocumentCreation"
- end
-
- File.exist?(@rails_app + "/spec/acceptance/document_creation_spec.rb").should be_true
- end
-
- scenario "Adding new acceptance spec (name ending with _spec)" do
- Dir.chdir @rails_app do
- run "script/generate acceptance_spec document_creation_spec"
- end
-
- File.exist?(@rails_app + "/spec/acceptance/document_creation_spec.rb").should be_true
- end
-end
View
76 spec/acceptance/rspec-1/basic_spec.rb
@@ -1,76 +0,0 @@
-require File.dirname(__FILE__) + "/acceptance_helper.rb"
-
-feature "Acceptance spec execution", %q{
- In order to write better software
- As a ruby developer
- I want to execute acceptance specs
-} do
-
- scenario "Minimal acceptance spec" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- feature "Minimal spec" do
- scenario "First scenario" do
- true.should be_true
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Minimal acceptance spec that fails" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- feature "Minimal spec" do
- scenario "First scenario" do
- true.should be_false
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 1 failure/
- end
-
- scenario "Acceptance spec with background" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- feature "Minimal spec" do
- background do
- @value = 17
- end
- scenario "First scenario" do
- @value.should == 17
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Steak should not pollute Object methods namespace" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
-
- class Wadus
- def call_feature
- feature
- end
-
- def method_missing(meth, *args, &blk)
- return "Hello!"
- end
- end
-
- feature "Wadus class" do
- scenario "should not be polluted by Steak" do
- w = Wadus.new
- w.should_not respond_to(:feature)
- w.call_feature.should == "Hello!"
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-end
View
39 spec/acceptance/rspec-1/rails_spec.rb
@@ -1,39 +0,0 @@
-require File.dirname(__FILE__) + "/acceptance_helper.rb"
-
-feature "Acceptance spec execution", %q{
- In order to write better web apps
- As a rails developer
- I want to execute acceptance specs
-} do
-
- scenario "Minimal acceptance spec" do
- rails_app = create_rails_app
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.dirname(__FILE__) + "/acceptance_helper.rb"
- feature "Minimal spec" do
- scenario "First scenario" do
- Rails.env.should be_test
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Integration stuff" do
- rails_app = create_rails_app
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.dirname(__FILE__) + "/acceptance_helper.rb"
- feature "Minimal spec" do
- scenario "First scenario" do
- get "/"
- response.should have_text(/No route matches/)
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-end
View
96 spec/acceptance/rspec-1/steak_generator_spec.rb
@@ -1,96 +0,0 @@
-require File.dirname(__FILE__) + "/acceptance_helper.rb"
-
-feature "Steak generator for rails", %q{
- In order to quickly start to hack my rails project with steak
- As a developer
- I want to run a generator that sets everything up for me
-} do
-
- scenario "Running generator in an empty project" do
- rails_app = create_rails_app(:setup_steak => false)
-
- Dir.chdir rails_app do
- run "script/generate steak"
- end
-
- File.exist?(rails_app + "/spec/acceptance/acceptance_helper.rb").should be_true
- File.exist?(rails_app + "/spec/acceptance/support/helpers.rb").should be_true
- File.exist?(rails_app + "/spec/acceptance/support/paths.rb").should be_true
- File.exist?(rails_app + "/lib/tasks/steak.rake").should be_true
- end
-
- scenario "Running generator with capybara by default" do
- rails_app = create_rails_app(:setup_steak => false)
-
- Dir.chdir rails_app do
- run "script/generate steak"
- end
-
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.expand_path(File.dirname(__FILE__) + "/acceptance_helper.rb")
- feature "Capybara spec" do
- scenario "First scenario" do
- visit "/"
- page.should have_content('No route matches')
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Running generator with webrat" do
- rails_app = create_rails_app(:setup_steak => false)
-
- Dir.chdir rails_app do
- run "script/generate steak --webrat"
- end
-
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.expand_path(File.dirname(__FILE__) + "/acceptance_helper.rb")
- feature "Capybara spec" do
- scenario "First scenario" do
- visit "/"
- response.should contain('No route matches')
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Running rake stats" do
- rails_app = create_rails_app
-
- Dir.chdir rails_app do
- run "script/generate steak"
- run("rake stats").should =~ /Acceptance specs/
- end
- end
-
- scenario "Running specs with rake" do
- rails_app = create_rails_app(:setup_steak => true)
-
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.expand_path(File.dirname(__FILE__) + "/acceptance_helper.rb")
- feature "Basic spec" do
- scenario "First scenario" do
- true.should == true
- end
- end
- SPEC
-
- Dir.chdir rails_app do
- run "rake db:migrate db:test:prepare"
-
- output = run "rake spec:acceptance"
- output.should =~ /1 example, 0 failures/
-
- output = run "rake"
- output.should =~ /1 example, 0 failures/
- end
- end
-end
View
81 spec/acceptance/rspec-2/acceptance_helper.rb
@@ -1,81 +0,0 @@
-require 'rubygems'
-require 'rspec'
-require File.dirname(__FILE__) + "/../../../lib/steak"
-require 'tempfile'
-
-module RSpec_2
- module Factories
- def create_spec(options)
- options = {:content => options} unless options.is_a?(Hash)
- path = (options[:path] || Dir.tmpdir) + "/#{String.random}_spec.rb"
- File.open(path, "w") do |file|
- file.write options[:content]
- end
- path
- end
-
- def create_rails_app(options = {})
- options[:browser_simulator] ||= "capybara"
-
- path = File.join(Dir.tmpdir, String.random, "rails_app")
- FileUtils.rm_rf path
- run "rails new #{path}"
- FileUtils.rm_rf path + '/public/index.html'
- File.open(File.join(path, "Gemfile"), "a") do |file|
- file.write %{
- gem 'rspec-rails', '>= 2.0.0.a9'
- gem '#{options[:browser_simulator]}'
- gem 'steak', :path => '#{File.expand_path(File.dirname(__FILE__) + '/../../..')}'
- }
- end
-
- run "bundle install"
-
- Dir.chdir path do
- run "rails generate rspec:install"
- if options[:scaffold]
- run "rails generate scaffold #{options[:scaffold]}"
- run "rake db:migrate db:test:prepare"
- end
- end
-
- unless options[:setup_steak] == false
- Dir.chdir path do
- run "rails generate steak:install"
- end
- end
-
- path
- end
-
- end
-
- module HelperMethods
- def run(cmd)
- `#{cmd} 2>&1`.tap do |o|
- puts o if ENV['TRACE']
- end
- end
-
- def run_spec(file_path, app_base=Dir.pwd)
- Dir.chdir app_base do
- run("rspec #{file_path}")
- end
- end
- end
-
- RSpec.configure do |config|
- config.include Factories, :example_group => {:file_path => /rspec-2/}
- config.include HelperMethods, :example_group => {:file_path => /rspec-2/}
- end
-end
-
-class String
- unless const_defined?("CHARS")
- CHARS = ('a'..'z').to_a + ('A'..'Z').to_a
- end
-
- def self.random(size = 8)
- (0..size).map{ CHARS[rand(CHARS.length)] }.join
- end
-end
View
121 spec/acceptance/rspec-2/basic_spec.rb
@@ -1,121 +0,0 @@
-require File.dirname(__FILE__) + "/acceptance_helper.rb"
-
-feature "Acceptance spec execution", %q{
- In order to write better software
- As a ruby developer
- I want to execute acceptance specs
-} do
-
- scenario "Minimal acceptance spec" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- feature "Minimal spec" do
- scenario "First scenario" do
- true.should be_true
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Minimal acceptance spec that fails" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- feature "Minimal spec" do
- scenario "First scenario" do
- true.should be_false
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 1 failure/
- end
-
- scenario "Acceptance spec with background" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- feature "Minimal spec" do
- background do
- @value = 17
- end
- scenario "First scenario" do
- @value.should == 17
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Acceptance spec metadata" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- feature "Minimal spec" do
- scenario "should have acceptance metadata" do
- example.metadata[:type].should == :acceptance
- example.metadata[:steak].should be_true
- example.metadata[:file_path].should == __FILE__
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Regular specs doesn't have acceptance metadata" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- describe "Regular spec" do
- it "should not have acceptance metadata" do
- example.metadata[:type].should_not == :acceptance
- example.metadata[:steak].should_not be_true
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Feature-level file path metadata filtering" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
- RSpec.configuration.before(:each, :example_group => {:file_path => __FILE__}) do
- @executed = true
- end
- feature "Minimal spec" do
- scenario "should have run the before block" do
- @executed.should be_true
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Steak should not pollute Object methods namespace" do
- spec_file = create_spec <<-SPEC
- require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
-
- class Wadus
- def call_feature
- feature
- end
-
- def method_missing(meth, *args, &blk)
- return "Hello!"
- end
- end
-
- feature "Wadus class" do
- scenario "should not be polluted by Steak" do
- w = Wadus.new
- w.should_not respond_to(:feature)
- w.call_feature.should == "Hello!"
- end
- end
- SPEC
- output = run_spec spec_file
- output.should =~ /1 example, 0 failures/
- end
-end
View
88 spec/acceptance/rspec-2/rails_spec.rb
@@ -1,88 +0,0 @@
-require File.dirname(__FILE__) + "/acceptance_helper.rb"
-
-feature "Acceptance spec execution", %q{
- In order to write better web apps
- As a rails developer
- I want to execute acceptance specs
-} do
-
- scenario "Minimal acceptance spec" do
- rails_app = create_rails_app
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.dirname(__FILE__) + "/acceptance_helper.rb"
- feature "Minimal spec" do
- scenario "First scenario" do
- ::Rails.env.should == "test"
- end
- end
- SPEC
- output = run_spec spec_file, File.join(File.dirname(spec_file), '../..')
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Integration stuff" do
- rails_app = create_rails_app
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.dirname(__FILE__) + "/acceptance_helper.rb"
- feature "Minimal spec" do
- scenario "First scenario" do
- get "/"
- last_response.body.should =~ /Not Found/
- end
- end
- SPEC
- output = run_spec spec_file, File.join(File.dirname(spec_file), '../..')
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Path helpers are available" do
- rails_app = create_rails_app
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.dirname(__FILE__) + "/acceptance_helper.rb"
- feature "Minimal spec" do
- scenario "First scenario" do
- homepage.should == "/"
- end
- end
- SPEC
- output = run_spec spec_file, File.join(File.dirname(spec_file), '../..')
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Running rake stats" do
- rails_app = create_rails_app
-
- Dir.chdir rails_app do
- run "rails generate steak:install"
- run("rake stats").should =~ /Acceptance specs/
- end
- end
-
- scenario "Running specs with rake" do
- rails_app = create_rails_app
-
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.dirname(__FILE__) + "/acceptance_helper.rb"
- feature "Basic spec" do
- scenario "First scenario" do
- true.should == true
- end
- end
- SPEC
-
- Dir.chdir rails_app do
- run "rake db:migrate db:test:prepare"
-
- output = run("rake spec:acceptance")
- output.should =~ /1 example, 0 failures/
-
- output = run("rake")
- output.should =~ /1 example, 0 failures/
- end
- end
-
-end
View
62 spec/acceptance/rspec-2/steak_install_generator_spec.rb
@@ -1,62 +0,0 @@
-require File.dirname(__FILE__) + "/acceptance_helper.rb"
-
-feature "Steak generator for rails", %q{
- In order to quickly start to hack my rails project with steak
- As a developer
- I want to run a generator that sets everything up for me
-} do
-
- scenario "Running generator in an empty project" do
-
- rails_app = create_rails_app(:setup_steak => false)
-
- Dir.chdir rails_app do
- run "rails generate steak:install"
- end
-
- File.exist?(rails_app + "/spec/acceptance/acceptance_helper.rb").should be_true
- File.exist?(rails_app + "/spec/acceptance/support/helpers.rb").should be_true
- File.exist?(rails_app + "/spec/acceptance/support/paths.rb").should be_true
-
- end
-
- scenario "Running generator with capybara by default" do
- rails_app = create_rails_app(:setup_steak => false, :scaffold => :users)
-
- Dir.chdir rails_app do
- run "rails generate steak:install"
- end
-
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.dirname(__FILE__) + "/acceptance_helper.rb"
- feature "Capybara spec" do
- scenario "First scenario" do
- visit "/users"
- page.should have_content('Listing users')
- end
- end
- SPEC
- output = run_spec spec_file, rails_app
- output.should =~ /1 example, 0 failures/
- end
-
- scenario "Running generator with webrat" do
- rails_app = create_rails_app(:browser_simulator => :webrat, :scaffold => :users)
-
- spec_file = create_spec :path => rails_app + "/spec/acceptance",
- :content => <<-SPEC
- require File.dirname(__FILE__) + "/acceptance_helper.rb"
- feature "Webrat spec" do
- scenario "First scenario" do
- visit "/users"
- response_body.should contain('Listing users')
- end
- end
- SPEC
-
- output = run_spec spec_file, rails_app
- output.should =~ /1 example, 0 failures/
- end
-
-end
View
77 spec/acceptance/rspec-2/steak_spec_generator_spec.rb
@@ -1,77 +0,0 @@
-require File.dirname(__FILE__) + "/acceptance_helper.rb"
-
-feature "Acceptance spec generator for rails", %q{
- In order to quickly add a new acceptance spec
- As a developer
- I want to run a generator that creates it for me
-} do
-
- background do
- @rails_app = create_rails_app
- end
-
- scenario "Adding new acceptance spec" do
- Dir.chdir @rails_app do
- run "rails generate steak:spec document_creation"
- end
-
- File.exist?(
- @rails_app + "/spec/acceptance/document_creation_spec.rb"
- ).should be_true
- end
-
- scenario "Adding new acceptance spec (plural name)" do
- Dir.chdir @rails_app do
- run "rails generate steak:spec creating_documents"
- end
-
- File.exist?(
- @rails_app + "/spec/acceptance/creating_documents_spec.rb"
- ).should be_true
- end
-
- scenario "Adding new acceptance spec (pascalized name)" do
- Dir.chdir @rails_app do
- run "rails generate steak:spec DocumentCreation"
- end
-
- File.exist?(
- @rails_app + "/spec/acceptance/document_creation_spec.rb"
- ).should be_true
- end
-
- scenario "Adding new acceptance spec (name ending with _spec)" do
- Dir.chdir @rails_app do
- run "rails generate steak:spec document_creation_spec"
- end
-
- File.exist?(
- @rails_app + "/spec/acceptance/document_creation_spec.rb"
- ).should be_true
- end
-
- scenario "Adding new acceptance spec (namespaced)" do
- Dir.chdir @rails_app do
- run "rails generate steak:spec document/creation_spec"
- end
-
- file_path = @rails_app + "/spec/acceptance/document/creation_spec.rb"
-
- File.exist?(file_path).should be_true
- File.read(file_path).should include("/../acceptance_helper")
- end
-
- scenario "Removing an acceptance spec" do
- Dir.chdir @rails_app do
- run "rails generate steak:spec document_creation"
- run "rails destroy steak:spec document_creation"
- end
-
- spec_dir = @rails_app + "/spec/acceptance/"
-
- File.exist?(spec_dir + "document_creation_spec.rb").should be_false
- File.exist?(spec_dir + "accepta