tdd - Want to add rspec to my rails 3 app, what do I need to do? -
i updated gemfile with:
group :development, :test gem 'rspec' gem 'webrat' gem 'rspec-rails' end
and ran bundle install.
now have homecontroller, manually created this:
/spec/controllers/home_controller_spec.rb
i don't have page started test off with:
require 'spec_helper' describe homecontroller describe "get 'about'" "should successful" 'about' response.should be_success end end end
now did:
rspec spec/
do need update other files rspec work, don't understand error message.
update
i changed if it, i'm getting:
file load -- spec_helper (loaderror) /users/someuser/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /users/someuser/dev/rscs/example.com/spec/controllers/home_controller_spec.rb:1 /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327:in `load' /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327:in `load_spec_files' /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327:in `map' /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327:in `load_spec_files' /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/command_line.rb:18:in `run' /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:55:in `run_in_process' /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:46:in `run' /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:10:in `autorun' /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/bin/rspec:19
see top line of backtrace.
/users/someuser/dev/rscs/example.com/spec/controllers/home_controller_spec.rb:6: syntax error, unexpected kdo, expecting kthen or ':' or '\n' or ';' (syntaxerror)
that error message points syntax error in spec file—namely, on line 6, there do
not expected. that's should check first.
if "should successful"
i'm betting meant if
it
;) it
rspec method defining particular aspect of class test, , it, unlike if
operator, can take block.
Comments
Post a Comment