Sha256: 4aec6c58d7270b117679ee7c8df7a0031bc03d823cf86165f74352ebdd89d5f4

Contents?: true

Size: 782 Bytes

Versions: 18

Compression:

Stored size: 782 Bytes

Contents

module ShouldaMacros
  #
  # Simple block helper for running certain tests only on specific ruby versions.
  # The given strings will be regexp-matched against RUBY_VERSION
  #
  def on_ruby(*ruby_versions)
    context "On Ruby #{RUBY_VERSION}" do
      yield
    end if ruby_versions.any? {|v| RUBY_VERSION =~ /#{v}/ }
  end
  
  def should_be(boolean_flag)
    should "be #{boolean_flag}" do
      assert_equal true, subject.send(boolean_flag)
    end
  end
  
  def should_not_be(boolean_flag)
    should "not be #{boolean_flag}" do
      assert_equal false, subject.send(boolean_flag)
    end
  end
  
  def should_have(attr_name, expectation)
    should "have #{attr_name} == #{expectation.inspect}" do
      assert_equal expectation, subject.send(attr_name)
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
challah-0.6.1 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.6.0 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.5.4 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.5.3 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.5.2 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.5.0 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.4.1 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.4.0 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.3.5 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.3.4 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.3.3 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.3.2 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.3.1 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.3.0 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.2.1 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
challah-0.2.0 vendor/bundle/gems/simplecov-0.5.4/test/shoulda_macros.rb
simplecov-0.5.4 test/shoulda_macros.rb
simplecov-0.5.3 test/shoulda_macros.rb