merb_helpers 0.4.0 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
data/specs/spec_helper.rb DELETED
@@ -1,99 +0,0 @@
1
- $TESTING=true
2
- $:.push File.join(File.dirname(__FILE__), '..', 'lib')
3
- require 'rubygems'
4
- require 'merb'
5
- # require 'merb/test/rspec'
6
-
7
- class FakeModel
8
- def self.columns
9
- [FakeColumn.new(:foo, :string),
10
- FakeColumn.new(:foobad, :string),
11
- FakeColumn.new(:bar, :integer),
12
- FakeColumn.new(:barbad, :integer),
13
- FakeColumn.new(:baz, :boolean),
14
- FakeColumn.new(:bazbad, :boolean),
15
- FakeColumn.new(:bat, :boolean),
16
- FakeColumn.new(:batbad, :boolean)
17
- ]
18
- end
19
-
20
- def valid?
21
- false
22
- end
23
-
24
- def new_record?
25
- false
26
- end
27
-
28
- def errors
29
- FakeErrors.new(self)
30
- end
31
-
32
- def foo
33
- "foowee"
34
- end
35
-
36
- alias_method :foobad, :foo
37
-
38
- def bar
39
- 7
40
- end
41
- alias_method :barbad, :bar
42
-
43
- def baz
44
- true
45
- end
46
- alias_method :bazbad, :baz
47
-
48
- def bat
49
- false
50
- end
51
- alias_method :batbad, :bat
52
-
53
- def nothing
54
- nil
55
- end
56
- end
57
-
58
- class FakeModel2 < FakeModel
59
-
60
- def foo
61
- "foowee2"
62
- end
63
- alias_method :foobad, :foo
64
-
65
- def new_record?
66
- true
67
- end
68
-
69
- end
70
-
71
- class FakeErrors
72
-
73
- def initialize(model)
74
- @model = model
75
- end
76
-
77
- def on(name)
78
- name.to_s.include?("bad")
79
- end
80
-
81
- end
82
-
83
- class FakeColumn
84
- attr_accessor :name, :type
85
- def initialize(name, type)
86
- @name, @type = name, type
87
- end
88
- end
89
-
90
-
91
-
92
-
93
- describe "FakeBufferConsumer", :shared => true do
94
-
95
- before :each do
96
- @obj = FakeModel.new
97
- def _buffer(buf = "") @buffer ||= "" end
98
- end
99
- end