lib/rspec/its.rb in rspec-its-1.0.0 vs lib/rspec/its.rb in rspec-its-1.0.1
- old
+ new
@@ -77,11 +77,11 @@
# subject { Person.new }
# before { subject.age = 25 }
# its(:age) { should eq(25) }
# end
def its(attribute, &block)
- describe(attribute) do
+ describe(attribute.to_s) do
if Array === attribute
let(:__its_subject) { subject[*attribute] }
else
let(:__its_subject) do
attribute_chain = attribute.to_s.split('.')
@@ -101,17 +101,20 @@
def should_not(matcher=nil, message=nil)
RSpec::Expectations::NegativeExpectationHandler.handle_matcher(__its_subject, matcher, message)
end
- example(&block)
+ its_caller = caller.select {|file_line| file_line !~ %r(/lib/rspec/its) }
+ example(nil, :caller => its_caller, &block)
+
end
end
end
end
RSpec.configure do |rspec|
rspec.extend RSpec::Its
+ rspec.backtrace_exclusion_patterns << %r(/lib/rspec/its)
end
RSpec::SharedContext.send(:include, RSpec::Its)