Sha256: c0d0fc04e9568bfe16a0d3a78893125301999546171e46e1c394cc1c98d0e03b

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

shared 'Ask' do
  before {
    extend Checked::Ask::DSL
  }
end

describe "ask empty?" do
  
  behaves_like 'Ask'

  it "returns true if string is :empty? after applying :strip" do
    ask?(" \n ", :empty?).should.be === true
  end
  
  it "returns false if string is not :empty? after applying :strip" do
    ask?(" n ", :empty?).should.be === false
  end
  
  
end # === describe Ask Strings

describe "Ask :includes" do
  
  behaves_like 'Ask'
  
  it "returns true if string contains a Regexp matcher" do
    Checked::Ask.new(" :a ") { |a|
      a.< :includes?, / :a /
    }.true?.should.be == true
  end
  
  it "returns false if string excludes a Regexp matcher" do
    Checked::Ask.new(" :a ") { |a|
      a.< :includes?, / :b /
    }.true?.should.be == false
  end
  
end # === describe Ask :includes

describe "Ask :excludes" do
  
  behaves_like 'Ask'
  
  it "returns true if string excludes a Regexp matcher" do
    Checked::Ask.new(" :a ") { |a|
      a.< :excludes?, / :b /
    }.true?.should.be == true
  end
  
  it 'returns false if string includes a Regexp matcher' do
    Checked::Ask.new(" :a ") { |a|
      a.< :excludes?, / :a /
    }.true?.should.be == false
  end
  
end # === describe Ask :excludes

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
Checked-0.1.4 spec/tests/Ask_Strings.rb
Checked-0.1.3 spec/tests/Ask_Strings.rb
Checked-0.1.2 spec/tests/Ask_Strings.rb
Checked-0.1.1 spec/tests/Ask_Strings.rb
Checked-0.1.0 spec/tests/Ask_Strings.rb