forked from psanford/ruby-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.rb
executable file
·107 lines (95 loc) · 2.39 KB
/
example.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/ruby
# This is an example class that can be consided our unit tests
class Example
def array_of_hashes
array_of_hashes = [{
:1 => 2
}, {
:3 => 4
}]
end
def closing_paren_aligns_with_open
Example.class_method(
:arg1 => 1,
:arg2 => 2,
)
end
def double_thingy_on_same_line_is_cool
setup_db = lambda do |repo_name|
DataMapper.setup(repo_name, "sqlite::memory:")
DataMapper.repository(repo_name).adapter.resource_naming_convention = lambda do |name|
DataMapper::Inflector.underscore(DataMapper::Inflector.demodulize(name))
end
end
end
def crazy_same_line
(report, rows) = make_test_query([%w{name = Eduardo}])
assert_equal( 1, rows.length )
end
def nesting_should_happen_here
request = [{
'query' => {
"primary_table" => "customer",
'tables' => {
'customer' => {
'columns' => {
'name' => 'on',
'email' => 'on',
'age' => 'on',
'sex' => 'on',
'username' => 'on'
},
},
},
},
'render' => {
"as" => "table",
"columns" => %w{name email age sex username}
},
}]
end
def curly_multiline_block
assert_nothing_raised {
def_from_query_section(request_section)
}
request_section['query']['tables'].delete('customer')
some_other_methods
end
def list_of_lists
Nearbuy::Model::FloorplanLine.create(
:floorplan_layer => layer,
:geom => GeoRuby::SimpleFeatures::LineString.from_coordinates(
:nested => 'indent'
)
)
Nearbuy::Model::FloorplanLine.create(
:floorplan_layer => layer,
:geom => GeoRuby::SimpleFeatures::LineString.from_coordinates([
[-1, -1], [1, 1],
])
)
end
def assert_hash
assert_equal( {
"customer.name" => cust[0],
"customer.email" => cust[0] + '@example.com',
"customer.age" => cust[1],
"customer.sex" => cust[2],
"customer.username"=> nil,
}, row.data )
end
def method_with_nested_hash_args
site = Nearbuy::Model::Site.create(
:name => 'rhynchocephalian-frizzy',
:floorplan => {
:name => 'falsehood\'s-Yiddish',
},
)
end
def end_method # this should be spaced correctly
end
def double_open_parens
assert_equal( 123, Some::Thing.foo(
) )
end
end