Slide 16
Slide 16 text
class PostSpec < RSpec::Core::ExampleGroup
set_it_up 'Post', [], RSpec.world.example_groups
RSpec::Core::Example.new(self, '#title= sets the title', {}, -> (example) {
post = Post.new
post.title = 'The Post Title'
RSpec::Expectations::ExpectationTarget.new(post.title).to(
RSpec::Matchers::BuiltIn::Eq.new('The Post Title'))
})
RSpec::Core::Example.new(self, 'publish! publishes the post', {}, -> (example) {
post = Post.new
post.publish!
RSpec::Expectations::ExpectationTarget.new(post).to(
RSpec::Matchers::BuiltIn::BePredicate.new(:be_published))
})
end
RSpec.world.record PostSpec