method
its
1.3.1 -
Show latest stable
- Class:
Spec::Example::Subject::ExampleGroupMethods
its(attribute, &block)public
No documentation available.
# File lib/spec/example/subject.rb, line 23
def its(attribute, &block)
describe(attribute) do
example do
self.class.class_eval do
define_method(:subject) do
super().send(attribute)
end
end
instance_eval(&block)
end
end
end 1Note
Sample
Here is a sample usage of its,
==== Code example
describe '#rate_for_date' do
context 'with date with in the range' do
subject do
FactoryGirl.build(:allocated_room_rate,
start_date: Time.zone.now,
end_date: 2.day.from_now,
price: 1000)
end
its(:daily_rate) { should == 500 }
end
end