Sha256: 260d1cb574e81d170e90d20ed105a5e2891a5e7f471c4c8e41c25c221971a446

Contents?: true

Size: 1.55 KB

Versions: 47

Compression:

Stored size: 1.55 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'

describe "should respond_to(:sym)" do
  
  it "should pass if target responds to :sym" do
    Object.new.should respond_to(:methods)
  end
  
  it "should fail target does not respond to :sym" do
    lambda {
      Object.new.should respond_to(:some_method)
    }.should fail_with("expected target to respond to :some_method")
  end
  
end

describe "should respond_to(message1, message2)" do
  
  it "should pass if target responds to both messages" do
    Object.new.should respond_to('methods', 'inspect')
  end
  
  it "should fail target does not respond to first message" do
    lambda {
      Object.new.should respond_to('method_one', 'inspect')
    }.should fail_with('expected target to respond to "method_one"')
  end
  
  it "should fail target does not respond to second message" do
    lambda {
      Object.new.should respond_to('inspect', 'method_one')
    }.should fail_with('expected target to respond to "method_one"')
  end
  
  it "should fail target does not respond to either message" do
    lambda {
      Object.new.should respond_to('method_one', 'method_two')
    }.should fail_with('expected target to respond to "method_one", "method_two"')
  end
end

describe "should_not respond_to(:sym)" do
  
  it "should pass if target does not respond to :sym" do
    Object.new.should_not respond_to(:some_method)
  end
  
  it "should fail target responds to :sym" do
    lambda {
      Object.new.should_not respond_to(:methods)
    }.should fail_with("expected target not to respond to :methods")
  end
  
end

Version data entries

47 entries across 47 versions & 9 rubygems

Version Path
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
deckshuffler-0.0.2 vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
picolena-0.1.1 rails_plugins/rspec/spec/spec/matchers/respond_to_spec.rb
picolena-0.1.0 rails_plugins/rspec/spec/spec/matchers/respond_to_spec.rb
picolena-0.1.3 rails_plugins/rspec/spec/spec/matchers/respond_to_spec.rb
picolena-0.1.4 rails_plugins/rspec/spec/spec/matchers/respond_to_spec.rb
picolena-0.1.2 rails_plugins/rspec/spec/spec/matchers/respond_to_spec.rb
picolena-0.1.5 rails_plugins/rspec/spec/spec/matchers/respond_to_spec.rb
pictrails-0.5.0 vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
radiant-0.6.5.1 vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
radiant-0.6.5 vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
radiant-0.6.7 vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb
radiant-0.6.6 vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb