Sha256: 66d6f0f436843107659d4cbf7edbf4ebe51e34018e5dbe8aae3f43b72dd3e3f3

Contents?: true

Size: 776 Bytes

Versions: 44

Compression:

Stored size: 776 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

44 entries across 34 versions & 6 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/gems/simplecov-0.7.1/test/shoulda_macros.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-1.0.0 vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-1.0.0.beta3 vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/simplecov-0.7.1/test/shoulda_macros.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-1.0.0.beta2 vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-1.0.0.beta vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-0.9.1.beta.3 vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
devise_sociable-0.1.0 vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-0.9.1.beta vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-0.9.0 vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/simplecov-0.6.4/test/shoulda_macros.rb
challah-rolls-0.2.0 vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
challah-rolls-0.2.0 vendor/bundle/gems/simplecov-0.6.4/test/shoulda_macros.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/simplecov-0.6.4/test/shoulda_macros.rb
challah-0.8.3 vendor/bundle/gems/simplecov-0.6.4/test/shoulda_macros.rb
challah-0.8.3 vendor/bundle/gems/simplecov-0.7.1/test/shoulda_macros.rb
simplecov-0.7.1 test/shoulda_macros.rb