spec/rspec/the_spec.rb in rspec-the-0.0.1 vs spec/rspec/the_spec.rb in rspec-the-0.0.2

- old
+ new

@@ -1,12 +1,22 @@ require 'rspec/the' +require 'counter' -module RSpec - describe The do - describe '#the' do - context 'basic usage' do - let(:foo) { :bar } - the(:foo) { is_expected.to eq :bar } - end +describe RSpec::The do + describe '#the' do + context 'basic usage' do + let(:counter) { Counter.new } + before { expect(counter.next).to eq 1 } + let(:next) { counter.next } + the(:next) { is_expected.to eq 2 } + after { expect(counter.next).to eq 3 } + end + + context '#are_expected' do + let(:counter) { Counter.new } + before { expect(counter.next).to eq 1 } + let(:nexts) { 5.times.inject([]) { |acc| acc << counter.next } } + the(:nexts) { are_expected.to eq [2, 3, 4, 5, 6] } + after { expect(counter.next).to eq 7 } end end end