fog 0.3.31 → 0.3.32
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +3 -0
- data/.gitignore +10 -0
- data/Gemfile.lock +1 -4
- data/README.rdoc +29 -37
- data/Rakefile +5 -25
- data/bin/fog +1 -3
- data/examples/dns_methods.rb +389 -0
- data/examples/storage.rb +103 -0
- data/fog.gemspec +4 -778
- data/lib/fog.rb +5 -66
- data/lib/fog/aws.rb +3 -0
- data/lib/fog/aws/bin.rb +7 -2
- data/lib/fog/aws/cdn.rb +2 -2
- data/lib/fog/aws/compute.rb +2 -2
- data/lib/fog/aws/dns.rb +101 -0
- data/lib/fog/aws/elb.rb +2 -2
- data/lib/fog/aws/iam.rb +2 -2
- data/lib/fog/aws/models/compute/image.rb +1 -0
- data/lib/fog/aws/models/compute/server.rb +1 -1
- data/lib/fog/aws/models/compute/servers.rb +1 -13
- data/lib/fog/aws/parsers/compute/describe_images.rb +36 -34
- data/lib/fog/aws/parsers/dns/change_resource_record_sets.rb +26 -0
- data/lib/fog/aws/parsers/dns/create_hosted_zone.rb +55 -0
- data/lib/fog/aws/parsers/dns/delete_hosted_zone.rb +25 -0
- data/lib/fog/aws/parsers/dns/get_change.rb +26 -0
- data/lib/fog/aws/parsers/dns/get_hosted_zone.rb +43 -0
- data/lib/fog/aws/parsers/dns/list_hosted_zones.rb +35 -0
- data/lib/fog/aws/parsers/dns/list_resource_record_sets.rb +46 -0
- data/lib/fog/aws/requests/compute/describe_images.rb +1 -0
- data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +90 -0
- data/lib/fog/aws/requests/dns/create_hosted_zone.rb +68 -0
- data/lib/fog/aws/requests/dns/delete_hosted_zone.rb +48 -0
- data/lib/fog/aws/requests/dns/get_change.rb +47 -0
- data/lib/fog/aws/requests/dns/get_hosted_zone.rb +51 -0
- data/lib/fog/aws/requests/dns/list_hosted_zones.rb +63 -0
- data/lib/fog/aws/requests/dns/list_resource_record_sets.rb +68 -0
- data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/sync_clock.rb +28 -0
- data/lib/fog/aws/simpledb.rb +2 -2
- data/lib/fog/aws/storage.rb +5 -3
- data/lib/fog/bluebox.rb +2 -0
- data/lib/fog/bluebox/compute.rb +2 -2
- data/lib/fog/brightbox.rb +2 -0
- data/lib/fog/brightbox/compute.rb +2 -2
- data/lib/fog/core.rb +21 -1
- data/lib/fog/core/bin.rb +3 -1
- data/lib/fog/core/compute.rb +1 -0
- data/lib/fog/core/credentials.rb +72 -50
- data/lib/fog/core/deprecation.rb +11 -5
- data/lib/fog/core/mock.rb +34 -0
- data/lib/fog/core/model.rb +9 -1
- data/lib/fog/core/service.rb +40 -26
- data/lib/fog/core/storage.rb +1 -0
- data/lib/fog/core/time.rb +21 -0
- data/lib/fog/core/wait_for.rb +17 -0
- data/lib/fog/go_grid.rb +2 -0
- data/lib/fog/go_grid/compute.rb +2 -2
- data/lib/fog/google.rb +2 -0
- data/lib/fog/google/requests/storage/get_bucket.rb +6 -5
- data/lib/fog/google/requests/storage/get_object_url.rb +4 -4
- data/lib/fog/google/requests/storage/put_object_url.rb +4 -4
- data/lib/fog/google/storage.rb +4 -3
- data/lib/fog/linode.rb +3 -0
- data/lib/fog/linode/bin.rb +5 -3
- data/lib/fog/linode/compute.rb +6 -2
- data/lib/fog/linode/dns.rb +80 -0
- data/lib/fog/linode/requests/dns/domain_create.rb +52 -0
- data/lib/fog/linode/requests/dns/domain_delete.rb +35 -0
- data/lib/fog/linode/requests/dns/domain_list.rb +50 -0
- data/lib/fog/linode/requests/dns/domain_resource_create.rb +53 -0
- data/lib/fog/linode/requests/dns/domain_resource_delete.rb +36 -0
- data/lib/fog/linode/requests/dns/domain_resource_list.rb +48 -0
- data/lib/fog/linode/requests/dns/domain_resource_update.rb +54 -0
- data/lib/fog/linode/requests/dns/domain_update.rb +48 -0
- data/lib/fog/local.rb +2 -0
- data/lib/fog/local/storage.rb +3 -3
- data/lib/fog/new_servers.rb +2 -0
- data/lib/fog/new_servers/compute.rb +2 -2
- data/lib/fog/rackspace.rb +2 -0
- data/lib/fog/rackspace/cdn.rb +2 -2
- data/lib/fog/rackspace/compute.rb +2 -2
- data/lib/fog/rackspace/storage.rb +2 -2
- data/lib/fog/slicehost.rb +3 -0
- data/lib/fog/slicehost/bin.rb +2 -0
- data/lib/fog/slicehost/compute.rb +2 -2
- data/lib/fog/slicehost/dns.rb +84 -0
- data/lib/fog/slicehost/parsers/dns/create_record.rb +26 -0
- data/lib/fog/slicehost/parsers/dns/create_zone.rb +26 -0
- data/lib/fog/slicehost/parsers/dns/get_record.rb +26 -0
- data/lib/fog/slicehost/parsers/dns/get_records.rb +30 -0
- data/lib/fog/slicehost/parsers/dns/get_zone.rb +26 -0
- data/lib/fog/slicehost/parsers/dns/get_zones.rb +30 -0
- data/lib/fog/slicehost/requests/compute/create_slice.rb +2 -2
- data/lib/fog/slicehost/requests/compute/delete_slice.rb +3 -17
- data/lib/fog/slicehost/requests/dns/create_record.rb +61 -0
- data/lib/fog/slicehost/requests/dns/create_zone.rb +54 -0
- data/lib/fog/slicehost/requests/dns/delete_record.rb +31 -0
- data/lib/fog/slicehost/requests/dns/delete_zone.rb +31 -0
- data/lib/fog/slicehost/requests/dns/get_record.rb +40 -0
- data/lib/fog/slicehost/requests/dns/get_records.rb +41 -0
- data/lib/fog/slicehost/requests/dns/get_zone.rb +40 -0
- data/lib/fog/slicehost/requests/dns/get_zones.rb +38 -0
- data/lib/fog/terremark.rb +2 -0
- data/lib/fog/terremark/ecloud.rb +2 -4
- data/lib/fog/vcloud.rb +4 -2
- data/lib/fog/vcloud/bin.rb +3 -1
- data/lib/fog/vcloud/mock_data_classes.rb +77 -11
- data/lib/fog/vcloud/terremark/ecloud.rb +22 -7
- data/lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb +60 -0
- data/lib/fog/vcloud/terremark/ecloud/models/backup_internet_services.rb +36 -0
- data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +28 -13
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +2 -2
- data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/network.rb +4 -1
- data/lib/fog/vcloud/terremark/ecloud/models/server.rb +5 -5
- data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +6 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/add_backup_internet_service.rb +111 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +2 -4
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +1 -3
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +39 -27
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +1 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +21 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +2 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +34 -17
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +12 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +15 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +1 -12
- data/lib/fog/zerigo.rb +15 -0
- data/lib/fog/zerigo/bin.rb +25 -0
- data/lib/fog/zerigo/dns.rb +96 -0
- data/lib/fog/zerigo/parsers/dns/count_hosts.rb +24 -0
- data/lib/fog/zerigo/parsers/dns/count_zones.rb +24 -0
- data/lib/fog/zerigo/parsers/dns/create_host.rb +26 -0
- data/lib/fog/zerigo/parsers/dns/create_zone.rb +26 -0
- data/lib/fog/zerigo/parsers/dns/find_hosts.rb +30 -0
- data/lib/fog/zerigo/parsers/dns/get_host.rb +26 -0
- data/lib/fog/zerigo/parsers/dns/get_zone.rb +56 -0
- data/lib/fog/zerigo/parsers/dns/get_zone_stats.rb +26 -0
- data/lib/fog/zerigo/parsers/dns/list_hosts.rb +30 -0
- data/lib/fog/zerigo/parsers/dns/list_zones.rb +30 -0
- data/lib/fog/zerigo/requests/dns/count_hosts.rb +36 -0
- data/lib/fog/zerigo/requests/dns/count_zones.rb +36 -0
- data/lib/fog/zerigo/requests/dns/create_host.rb +70 -0
- data/lib/fog/zerigo/requests/dns/create_zone.rb +97 -0
- data/lib/fog/zerigo/requests/dns/delete_host.rb +32 -0
- data/lib/fog/zerigo/requests/dns/delete_zone.rb +33 -0
- data/lib/fog/zerigo/requests/dns/find_hosts.rb +63 -0
- data/lib/fog/zerigo/requests/dns/get_host.rb +47 -0
- data/lib/fog/zerigo/requests/dns/get_zone.rb +57 -0
- data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +44 -0
- data/lib/fog/zerigo/requests/dns/list_hosts.rb +48 -0
- data/lib/fog/zerigo/requests/dns/list_zones.rb +53 -0
- data/lib/fog/zerigo/requests/dns/update_host.rb +60 -0
- data/lib/fog/zerigo/requests/dns/update_zone.rb +78 -0
- data/spec/spec_helper.rb +0 -5
- data/spec/vcloud/spec_helper.rb +3 -2
- data/spec/vcloud/terremark/ecloud/models/backup_internet_service_spec.rb +49 -0
- data/spec/vcloud/terremark/ecloud/models/backup_internet_services_spec.rb +29 -0
- data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +32 -13
- data/spec/vcloud/terremark/ecloud/models/network_spec.rb +7 -4
- data/spec/vcloud/terremark/ecloud/models/server_spec.rb +20 -0
- data/spec/vcloud/terremark/ecloud/requests/add_backup_internet_service_spec.rb +60 -0
- data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +3 -0
- data/spec/vcloud/terremark/ecloud/requests/configure_network_ip_spec.rb +55 -0
- data/spec/vcloud/terremark/ecloud/requests/delete_vapp_spec.rb +9 -0
- data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +60 -14
- data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +2 -0
- data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +3 -3
- data/tests/aws/requests/compute/image_tests.rb +15 -14
- data/tests/aws/requests/dns/dns_tests.rb +276 -0
- data/tests/brightbox/requests/compute/account_tests.rb +20 -9
- data/tests/brightbox/requests/compute/api_client_tests.rb +12 -4
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +20 -6
- data/tests/brightbox/requests/compute/image_tests.rb +9 -4
- data/tests/brightbox/requests/compute/interface_tests.rb +8 -2
- data/tests/brightbox/requests/compute/server_tests.rb +17 -5
- data/tests/brightbox/requests/compute/server_type_tests.rb +8 -4
- data/tests/brightbox/requests/compute/user_tests.rb +13 -5
- data/tests/brightbox/requests/compute/zone_tests.rb +8 -4
- data/tests/core/attribute_tests.rb +45 -0
- data/tests/helper.rb +0 -2
- data/tests/linode/requests/dns/dns_tests.rb +262 -0
- data/tests/rackspace/requests/compute/address_tests.rb +1 -1
- data/tests/rackspace/requests/compute/image_tests.rb +1 -1
- data/tests/slicehost/requests/dns_tests/dns_tests.rb +279 -0
- data/tests/zerigo/helper.rb +0 -0
- data/tests/zerigo/requests/dns/dns_tests.rb +374 -0
- metadata +280 -36
- data/spec/compact_progress_bar_formatter.rb +0 -195
- data/spec/core/attributes_spec.rb +0 -52
- data/spec/lorem.txt +0 -1
@@ -1,195 +0,0 @@
|
|
1
|
-
# Copyright (c) 2008 Nicholas A. Evans
|
2
|
-
# http://ekenosen.net/nick/devblog/2008/12/better-progress-bar-for-rspec/
|
3
|
-
#
|
4
|
-
# With some tweaks (slow spec profiler, growl support)
|
5
|
-
# By Nick Zadrozny
|
6
|
-
# http://gist.github.com/71340
|
7
|
-
#
|
8
|
-
# Further tweaks (formatador, elapsed time instead of eta)
|
9
|
-
# By geemus (Wesley Beary)
|
10
|
-
# http://gist.github.com/266221
|
11
|
-
#
|
12
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
13
|
-
# a copy of this software and associated documentation files (the
|
14
|
-
# "Software"), to deal in the Software without restriction, including
|
15
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
16
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
17
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
18
|
-
# the following conditions:
|
19
|
-
#
|
20
|
-
# The above copyright notice and this permission notice shall be
|
21
|
-
# included in all copies or substantial portions of the Software.
|
22
|
-
#
|
23
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
24
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
25
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
26
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
27
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
28
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
29
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
30
|
-
|
31
|
-
require 'spec/runner/formatter/base_text_formatter'
|
32
|
-
require "rubygems"
|
33
|
-
require 'formatador'
|
34
|
-
|
35
|
-
module Spec
|
36
|
-
module Runner
|
37
|
-
module Formatter
|
38
|
-
class CompactProgressBarFormatter < BaseTextFormatter
|
39
|
-
# Threshold for slow specs, in seconds.
|
40
|
-
# Anything that takes longer than this will be printed out
|
41
|
-
# It would be great to get this down to 0.5 or less...
|
42
|
-
SLOW_SPEC_THRESHOLD = 2.0
|
43
|
-
|
44
|
-
# Keep track the slowest specs and print a report at the end
|
45
|
-
SLOW_SPEC_REPORT = 3
|
46
|
-
|
47
|
-
attr_reader :total, :current
|
48
|
-
|
49
|
-
def start(example_count)
|
50
|
-
@current = 0
|
51
|
-
@started_at = Time.now
|
52
|
-
@total = example_count
|
53
|
-
@error_state = :all_passing
|
54
|
-
@slow_specs = []
|
55
|
-
@formatador = Formatador.new
|
56
|
-
@formatador.display_line
|
57
|
-
end
|
58
|
-
|
59
|
-
def example_started(example)
|
60
|
-
super
|
61
|
-
@start_time = Time.now
|
62
|
-
end
|
63
|
-
|
64
|
-
def example_passed(example)
|
65
|
-
elapsed = Time.now - @start_time
|
66
|
-
profile_example(example_group.description, example.description, elapsed)
|
67
|
-
increment
|
68
|
-
end
|
69
|
-
|
70
|
-
# third param is optional, because earlier versions of rspec sent only two args
|
71
|
-
def example_pending(example, message, pending_caller=nil)
|
72
|
-
immediately_dump_pending(example.description, message, pending_caller)
|
73
|
-
mark_error_state_pending
|
74
|
-
increment
|
75
|
-
end
|
76
|
-
|
77
|
-
def example_failed(example, counter, failure)
|
78
|
-
immediately_dump_failure(counter, failure)
|
79
|
-
notify_failure(counter, failure)
|
80
|
-
mark_error_state_failed
|
81
|
-
increment
|
82
|
-
end
|
83
|
-
|
84
|
-
def start_dump
|
85
|
-
@formatador.display_line("\n")
|
86
|
-
report_slow_specs
|
87
|
-
end
|
88
|
-
|
89
|
-
def dump_failure(*args)
|
90
|
-
# no-op; we summarized failures as we were running
|
91
|
-
end
|
92
|
-
|
93
|
-
def method_missing(sym, *args)
|
94
|
-
# ignore
|
95
|
-
end
|
96
|
-
|
97
|
-
def notify(title, message, priority)
|
98
|
-
title = title.gsub(/\s+/, ' ').gsub(/"/,'\"').gsub(/'/, "\'")
|
99
|
-
message = message.gsub(/\s+/, ' ').gsub(/"/,'\"').gsub(/'/, "\'").gsub(/`/,'\`')
|
100
|
-
notify_command = case RUBY_PLATFORM
|
101
|
-
when /darwin/
|
102
|
-
"test -x `which growlnotify` && growlnotify -n autotest -p #{priority} -m \"#{message}\" \"#{title}\""
|
103
|
-
when /linux/
|
104
|
-
"test -x `which notify-send` && notify-send \"#{title}\" \"#{message}\""
|
105
|
-
end
|
106
|
-
# puts notify_command # use this for debugging purposes
|
107
|
-
system notify_command if notify_command
|
108
|
-
end
|
109
|
-
|
110
|
-
def notify_failure(counter, failure)
|
111
|
-
notify failure.header, failure.exception.message, 2
|
112
|
-
end
|
113
|
-
|
114
|
-
# stolen and slightly modified from BaseTextFormatter#dump_failure
|
115
|
-
def immediately_dump_failure(counter, failure)
|
116
|
-
@formatador.redisplay("#{' ' * progress_bar.length}\n")
|
117
|
-
@formatador.redisplay("[red]#{counter.to_s})[/]")
|
118
|
-
@formatador.display_line("[red]#{failure.header}[/]")
|
119
|
-
@formatador.indent do
|
120
|
-
@formatador.display_line("[red]#{failure.exception.message}[/]")
|
121
|
-
@formatador.display_line
|
122
|
-
failure.exception.backtrace.each do |line|
|
123
|
-
@formatador.display_line("[red]#{line}[/]")
|
124
|
-
end
|
125
|
-
@formatador.display_line
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
# stolen and modified from BaseTextFormatter#dump_pending
|
130
|
-
def immediately_dump_pending(desc, msg, called_from)
|
131
|
-
@formatador.indent do
|
132
|
-
@formatador.redisplay("#{' ' * progress_bar.length}\r")
|
133
|
-
@formatador.display_line("[yellow]PENDING SPEC:[/] #{desc} (#{msg})\n")
|
134
|
-
end
|
135
|
-
# output.puts " Called from #{called_from}" if called_from
|
136
|
-
end
|
137
|
-
|
138
|
-
def increment
|
139
|
-
@current += 1
|
140
|
-
@formatador.redisplay(progress_bar)
|
141
|
-
end
|
142
|
-
|
143
|
-
def mark_error_state_failed
|
144
|
-
@error_state = :some_failed
|
145
|
-
end
|
146
|
-
|
147
|
-
def mark_error_state_pending
|
148
|
-
@error_state = :some_pending unless @error_state == :some_failed
|
149
|
-
end
|
150
|
-
|
151
|
-
def progress_bar
|
152
|
-
color = case @error_state
|
153
|
-
when :some_failed
|
154
|
-
'red'
|
155
|
-
when :some_pending
|
156
|
-
'yellow'
|
157
|
-
else
|
158
|
-
'green'
|
159
|
-
end
|
160
|
-
ratio = "#{(' ' * (@total.to_s.size - @current.to_s.size))}#{@current}/#{@total}"
|
161
|
-
fraction = "[#{color}]#{(' ' * (@total.to_s.size - @current.to_s.size))}#{@current}/#{@total}[/]"
|
162
|
-
percent = @current.to_f / @total.to_f
|
163
|
-
progress = "[_white_]|[/][#{color}][_#{color}_]#{'*' * (percent * 50).ceil}[/]#{' ' * (50 - (percent * 50).ceil)}[_white_]|[/]"
|
164
|
-
microseconds = Time.now - @started_at
|
165
|
-
minutes = (microseconds / 60).round.to_s
|
166
|
-
seconds = (microseconds % 60).round.to_s
|
167
|
-
elapsed = "#{minutes}:#{'0' if seconds.size < 2}#{seconds}"
|
168
|
-
[fraction, progress, elapsed, ''].join(' ')
|
169
|
-
end
|
170
|
-
|
171
|
-
def profile_example(group, example, elapsed)
|
172
|
-
@slow_specs = (@slow_specs + [[elapsed, group, example]]).sort.reverse[0, SLOW_SPEC_REPORT]
|
173
|
-
print_warning_if_really_slow(group, example, elapsed)
|
174
|
-
end
|
175
|
-
|
176
|
-
def print_warning_if_really_slow(group, example, elapsed)
|
177
|
-
if elapsed > SLOW_SPEC_THRESHOLD
|
178
|
-
@formatador.indent do
|
179
|
-
@formatador.redisplay("#{' ' * progress_bar.length}\r")
|
180
|
-
@formatador.display_line("[yellow]SLOW SPEC (#{sprintf("%.4f", elapsed)})[/]: #{group} #{example}\n")
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
def report_slow_specs
|
186
|
-
@formatador.display_line("[yellow]Top #{@slow_specs.size} slowest specs:[/]")
|
187
|
-
@slow_specs.each do |elapsed, group, example|
|
188
|
-
@formatador.display_line("[yellow] #{yellow(sprintf('%.4f', elapsed))} #{group} #{example}[/]")
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
class FogAttributeTestModel < Fog::Model
|
4
|
-
attribute :key_id, :aliases => "key", :squash => "id"
|
5
|
-
attribute :time, :type => :time
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'Fog::Attributes' do
|
9
|
-
|
10
|
-
describe ".attribute" do
|
11
|
-
describe "squashing a value" do
|
12
|
-
it "should accept squashed key as symbol" do
|
13
|
-
data = {"key" => {:id => "value"}}
|
14
|
-
model = FogAttributeTestModel.new
|
15
|
-
model.merge_attributes(data)
|
16
|
-
model.key_id.should == "value"
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should accept squashed key as string" do
|
20
|
-
data = {"key" => {"id" => "value"}}
|
21
|
-
model = FogAttributeTestModel.new
|
22
|
-
model.merge_attributes(data)
|
23
|
-
model.key_id.should == "value"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "when merging a time field" do
|
28
|
-
it "should accept nil as a suitable setting" do
|
29
|
-
data = {"time" => nil}
|
30
|
-
model = FogAttributeTestModel.new
|
31
|
-
model.merge_attributes(data)
|
32
|
-
model.time.should be_nil
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should accept empty string as a suitable setting" do
|
36
|
-
data = {"time" => ""}
|
37
|
-
model = FogAttributeTestModel.new
|
38
|
-
model.merge_attributes(data)
|
39
|
-
model.time.should == ""
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should parse strings to get a Datetime" do
|
43
|
-
test_time = Time.parse("2010-11-12T13:14:15")
|
44
|
-
data = {"time" => test_time.to_s}
|
45
|
-
model = FogAttributeTestModel.new
|
46
|
-
model.merge_attributes(data)
|
47
|
-
model.time.should == test_time
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
data/spec/lorem.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|