3 ms·
one step further: describe Article do describe '#slug' do before do subject.title = "Testing with Test::Unit" end
by pklingem 14y ago
one step further:
describe Article do
describe '#slug' do
before do
subject.title = "Testing with Test::Unit"
end
its(:slug) { should_not match(/[^\w-]/) }
its(:slug) { should_not match(/[A-Z]/) }
it 'replaces spaces with hyphens'
end
end
- pjungwir 14y agoI like and use RSpec, but I think these improvements are proving the guy's point that its DSL is forbidding for beginners. I write RSpec more like the original post because it's less magic.
- reyan 14y agoNot really. At least RSpec's creator doesn't think so (http://blog.davidchelimsky.net/2012/05/13/spec-smell-explicit-use-of-subject/ http://blog.davidchelimsky.net/2012/05/13/spec-smell-explici...).
- aaronbrethorst 14y agoneat, I didn't know you could do that. thanks for sharing!