expect { some_method }.to raise_error
RSpec 1 Syntax:
lambda { some_method }.should raise_error
See the documentation (for RSpec 1 syntax) and RSpec 2 documentation for more.
Related Contents:
- Begin, Rescue and Ensure in Ruby?
- How to run a single RSpec test?
- Trouble comparing time with RSpec
- RSpec: how to test if a method was called?
- All Ruby tests raising: undefined method `authenticate’ for nil:NilClass
- How to check a checkbox in capybara?
- rspec 3 – stub a class method
- RSpec controller testing – blank response.body
- How to test exception raising in Rails/RSpec?
- Rails 4: How to reset test database?
- Speeding up RSpec tests in a large Rails application
- undefined method `visit’ when using RSpec and Capybara in rails
- Difference between an it block and a specify block in RSpec
- Rspec 3 how to test flash messages
- Rspec Output Format: Documentation
- What is the purpose of a `transient do` block in FactoryBot factories?
- Suppress Ruby warnings when running specs
- Shoulda/RSpec matchers – conditional validation
- Controller spec unknown keyword: id
- How to stub ApplicationController method in request spec
- Guard with RSpec on Rails 4 giving a lot of warnings
- RSpec any_instance deprecation: how to fix it?
- Running a spec in RubyMine results in “cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter (LoadError)”
- Rails : RuntimeError – can’t modify frozen Array when running rspec in rails
- How to test rendering a partial with RSpec
- Minitest and Rspec [closed]
- is Rails.cache purged between tests?
- Why is RSpec so slow under Rails?
- Why not use shared ActiveRecord connections for Rspec + Selenium?
- What does “WARN Could not determine content-length of response body.” mean and how to I get rid of it?
- unable to install pg gem
- Ruby: Is there an opposite of include? for Ruby Arrays?
- How to clear all the jobs from Sidekiq?
- What does %i or %I do in Ruby?
- Is there a Ruby, or Ruby-ism for not_nil? opposite of nil? method?
- RuboCop: Line is too long ← How to Ignore?
- Why can’t I install Rails on Lion using RVM?
- In Rails, what’s the difference between find_each and where?
- How to say “any_instance” “should_receive” any number of times in RSpec
- Write to rails console
- Ruby on Rails 3 : “superclass mismatch for class …”
- Reading the first line of a file in Ruby
- Rails: An elegant way to display a message when there are no elements in database
- Why is it best to store a telephone number as a string vs. integer?
- Capistrano asks for password when deploying, despite SSH keys
- Capistrano SSH::AuthenticationFailed, not prompting for password
- Ruby on Rails “invalid byte sequence in UTF-8” due to bot
- Rails generate has_many association
- Ruby 1.87 vs 1.92 Date.parse
- ruby/ruby on rails memory leak detection