assert_xpath 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/assert_xpath.rb +0 -41
- metadata +2 -2
data/lib/assert_xpath.rb
CHANGED
@@ -662,50 +662,9 @@ module AssertXPath
|
|
662
662
|
# CONSIDER that should report serious HTML deformities
|
663
663
|
end # CONSIDER how to tidy <% escaped %> eRB code??
|
664
664
|
|
665
|
-
# ERGO new module for these...
|
666
|
-
# See: http://www.oreillynet.com/onlamp/blog/2007/07/assert_latest_and_greatest.html
|
667
|
-
|
668
|
-
def assert_flunked(gripe, &block) #:nodoc:
|
669
|
-
assert_raise_message Test::Unit::AssertionFailedError, gripe, &block
|
670
|
-
end # ERGO move to assert{ 2.0 }, reflect, and leave there!
|
671
|
-
|
672
|
-
def deny_flunked(gripe, &block) #:nodoc:
|
673
|
-
deny_raise_message Test::Unit::AssertionFailedError, gripe, &block
|
674
|
-
end # ERGO move to assert{ 2.0 }, reflect, and leave there!
|
675
|
-
|
676
|
-
def assert_latest(model, message = nil, &block)
|
677
|
-
get_latest(model, &block) or flunk_latest(model, message, true, block)
|
678
|
-
end
|
679
|
-
|
680
|
-
def deny_latest(model, message = nil, &block)
|
681
|
-
get_latest(model, &block) and flunk_latest(model, message, false, block)
|
682
|
-
end
|
683
|
-
|
684
|
-
def get_latest(model, &block)
|
685
|
-
max_id = model.maximum(:id) || 0
|
686
|
-
block.call
|
687
|
-
all = model.find( :all,
|
688
|
-
:conditions => "id > #{max_id}",
|
689
|
-
:order => "id asc" )
|
690
|
-
return *all # <-- returns nil for [],
|
691
|
-
# one object for [x],
|
692
|
-
# or an array with more than one item
|
693
|
-
end
|
694
|
-
|
695
665
|
# FIXME write a plugin for cruisecontrol.rb
|
696
666
|
# that links metrics to Gruff per project
|
697
667
|
# (and link from assert2.rf.org to rf.org/projects/assert2
|
698
|
-
|
699
|
-
def flunk_latest(model, message, polarity, block)
|
700
|
-
rationale = "should#{ ' not' unless polarity
|
701
|
-
} create new #{ model.name.pluralize
|
702
|
-
} in block:\n\t\t#{
|
703
|
-
reflect_source(&block).gsub("\n", "\n\t\t")
|
704
|
-
}\n"
|
705
|
-
# RubyNodeReflector::RubyReflector.new(block, false).result }"
|
706
|
-
# note we don't evaluate...
|
707
|
-
flunk build_message(message, rationale)
|
708
|
-
end
|
709
668
|
|
710
669
|
private
|
711
670
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert_xpath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phlip
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-03-
|
12
|
+
date: 2008-03-08 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|