TODO: Write a gem description
Add this line to your application's Gemfile:
gem 'digress'
And then execute:
$ bundle
Or install it yourself as:
$ gem install digress
describe "digress in a pipeline" do
it "never runs the block if given false" do
expect(TestLiterateBuilder.new
.digress(false) { |b| b.increment }
.value
).to eq 0
end
it "runs the block if given a truthy value" do
expect(TestLiterateBuilder.new
.digress(true) { |b| b.increment }
.value
).to eq 1
end
it "is easily chainable" do
expect(TestLiterateBuilder.new
.digress(true) { |b| b.increment }
.digress(1 == 1) { |b| b.increment }
.digress("not a nil value") { |b| b.increment }
.value
).to eq 3
end
it "can use a proc as its bool value" do
lt2 = ->(i) { i.value < 2 }
expect(TestLiterateBuilder.new
.digress(lt2) { |b| b.increment }
.digress(lt2) { |b| b.increment }
.digress(lt2) { |b| b.increment }
.digress(lt2) { |b| b.increment }
.digress(lt2) { |b| b.increment }
.digress(lt2) { |b| b.increment }
.value
).to eq 2
end
end
- Fork it ( https://github.com/cschneid/digress/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request