Sha256: 39bb587f40ae931e288cdc643e1e64188275c680bedbacd389bda2a4434e5126

Contents?: true

Size: 1.54 KB

Versions: 136

Compression:

Stored size: 1.54 KB

Contents

describe "This example" do
  
  it "should show that a NoMethodError is raised but an Exception was expected" do
    proc { ''.nonexistent_method }.should raise_error
  end
  
  it "should pass" do
    proc { ''.nonexistent_method }.should raise_error(NoMethodError)
  end
  
  it "should show that a NoMethodError is raised but a SyntaxError was expected" do
    proc { ''.nonexistent_method }.should raise_error(SyntaxError)
  end
  
  it "should show that nothing is raised when SyntaxError was expected" do
    proc { }.should raise_error(SyntaxError)
  end

  it "should show that a NoMethodError is raised but a Exception was expected" do
    proc { ''.nonexistent_method }.should_not raise_error
  end
  
  it "should show that a NoMethodError is raised" do
    proc { ''.nonexistent_method }.should_not raise_error(NoMethodError)
  end
  
  it "should also pass" do
    proc { ''.nonexistent_method }.should_not raise_error(SyntaxError)
  end
  
  it "should show that a NoMethodError is raised when nothing expected" do
    proc { ''.nonexistent_method }.should_not raise_error(Exception)
  end
  
  it "should show that the wrong message was received" do
    proc { raise StandardError.new("what is an enterprise?") }.should raise_error(StandardError, "not this")
  end
  
  it "should show that the unexpected error/message was thrown" do
    proc { raise StandardError.new("abc") }.should_not raise_error(StandardError, "abc")
  end
  
  it "should pass too" do
    proc { raise StandardError.new("abc") }.should_not raise_error(StandardError, "xyz")
  end
  
end

Version data entries

136 entries across 136 versions & 22 rubygems

Version Path
has_finder-0.1.1 spec/rails/vendor/plugins/rspec/failing_examples/raising_example.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec/failing_examples/raising_example.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec/failing_examples/raising_example.rb
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/failing_examples/raising_example.rb
picolena-0.1.1 rails_plugins/rspec/failing_examples/raising_example.rb
picolena-0.1.0 rails_plugins/rspec/failing_examples/raising_example.rb
picolena-0.1.4 rails_plugins/rspec/failing_examples/raising_example.rb
picolena-0.1.3 rails_plugins/rspec/failing_examples/raising_example.rb
picolena-0.1.2 rails_plugins/rspec/failing_examples/raising_example.rb
picolena-0.1.5 rails_plugins/rspec/failing_examples/raising_example.rb
pictrails-0.5.0 vendor/plugins/rspec/failing_examples/raising_example.rb
radiant-0.6.5.1 vendor/plugins/rspec/failing_examples/raising_example.rb
radiant-0.6.5 vendor/plugins/rspec/failing_examples/raising_example.rb
radiant-0.6.6 vendor/plugins/rspec/failing_examples/raising_example.rb
radiant-0.6.7 vendor/plugins/rspec/failing_examples/raising_example.rb
radiant-0.6.8 vendor/plugins/rspec/failing_examples/raising_example.rb
radiant-0.6.9 vendor/plugins/rspec/failing_examples/raising_example.rb
rspec-0.0.10 failing_examples/raising_example.rb
rspec-1.1.10 failing_examples/raising_example.rb
rspec-1.1.12 examples/failing/raising_example.rb