expectations 0.1.7 → 0.1.8

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/README CHANGED
@@ -114,10 +114,12 @@ expectations can be used for state based and behavior based testing.
114
114
  String
115
115
  end
116
116
 
117
+ # State based test with XML strings, whitespace between tags is ignored
117
118
  expect xml("<a><foo>bar</foo></a>") do
118
119
  "<a>\n\t<foo>bar</foo> \n</a>"
119
120
  end
120
121
 
122
+ # State based test with XML strings, whitespace between tags is ignored
121
123
  expect xml(<<-eos) do
122
124
  <one>
123
125
  <two>
@@ -128,7 +130,18 @@ expectations can be used for state based and behavior based testing.
128
130
  eos
129
131
  "<one><two><three>4</three>
130
132
  <five> 6 </five>
131
- </two></one>"
133
+ </two></one>"
134
+ end
135
+
136
+ # this is normally defined in the file specific to the class
137
+ klass = Class.new do
138
+ def save(arg)
139
+ record.save(arg)
140
+ end
141
+ end
142
+ # State based delegation test
143
+ expect klass.new.to_delegate(:save).to(:record) do |instance|
144
+ instance.save(1)
132
145
  end
133
146
 
134
147
  end
@@ -1,7 +1,7 @@
1
1
  class Expectations::XmlString < String
2
2
 
3
3
  def expectations_equal_to(other)
4
- not Regexp.new(normalize(self)).match(normalize(other)).nil?
4
+ not Regexp.new(Regexp.escape(normalize(self))).match(normalize(other)).nil?
5
5
  end
6
6
 
7
7
  def inspect
data/rakefile.rb CHANGED
@@ -46,7 +46,7 @@ specification = Gem::Specification.new do |s|
46
46
  expect NoMethodError do
47
47
  Object.invalid_method_call
48
48
  end."
49
- s.version = "0.1.7"
49
+ s.version = "0.1.8"
50
50
  s.author = 'Jay Fields'
51
51
  s.description = "A lightweight unit testing framework. Tests (expectations) will be written as follows
52
52
  expect 2 do
@@ -53,6 +53,10 @@ Expectations do
53
53
  Expectations::XmlString.new("<fragment>content</fragment>").expectations_equal_to "<container><fragment>content</fragment></container>"
54
54
  end
55
55
 
56
+ expect true do
57
+ Expectations::XmlString.new('<?xml version="1.0"?>').expectations_equal_to '<?xml version="1.0"?>'
58
+ end
59
+
56
60
  expect "[as xml] <fragment>content</fragment>" do
57
61
  Expectations::XmlString.new(" \t<fragment>content</fragment>\n ").inspect
58
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expectations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Fields
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-15 00:00:00 -10:00
12
+ date: 2008-02-24 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15