citygrid_api 0.0.5 → 0.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.sass-cache/7a5a675d951455410512a59af5ab2d160bd1735c/test.scssc +0 -0
- data/Gemfile +10 -8
- data/Gemfile.lock +24 -9
- data/README +21 -0
- data/citygrid_api.gemspec +77 -17
- data/citygrid_api.yml.sample +33 -0
- data/config.ru +2 -0
- data/dashboard.rb +110 -0
- data/lib/citygrid/abstraction/collection.rb +1 -1
- data/lib/citygrid/abstraction/super_hash.rb +2 -0
- data/lib/citygrid/api/ad_center/account.rb +26 -0
- data/lib/citygrid/api/ad_center/account_manager.rb +8 -0
- data/lib/citygrid/api/ad_center/ad_group.rb +8 -0
- data/lib/citygrid/api/ad_center/ad_group_ad.rb +8 -0
- data/lib/citygrid/api/ad_center/ad_group_criterion.rb +8 -0
- data/lib/citygrid/api/ad_center/ad_group_geo.rb +8 -0
- data/lib/citygrid/api/ad_center/authentication.rb +20 -0
- data/lib/citygrid/api/ad_center/billing.rb +8 -0
- data/lib/citygrid/api/ad_center/budget.rb +9 -0
- data/lib/citygrid/api/ad_center/call_detail.rb +25 -0
- data/lib/citygrid/api/ad_center/campaign.rb +8 -0
- data/lib/citygrid/api/ad_center/category.rb +9 -0
- data/lib/citygrid/api/ad_center/geolocation.rb +9 -0
- data/lib/citygrid/api/ad_center/image.rb +30 -0
- data/lib/citygrid/api/ad_center/method_of_payment.rb +10 -0
- data/lib/citygrid/api/ad_center/performance.rb +17 -0
- data/lib/citygrid/api/ad_center/places.rb +8 -0
- data/lib/citygrid/api/ad_center/user.rb +8 -0
- data/lib/citygrid/api/ad_center.rb +20 -0
- data/lib/citygrid/api/content/offers.rb +14 -9
- data/lib/citygrid/api/content/places/detail.rb +5 -11
- data/lib/citygrid/api/content/places/search.rb +5 -11
- data/lib/citygrid/api/content/places.rb +30 -14
- data/lib/citygrid/api/content/reviews.rb +5 -10
- data/lib/citygrid/api/content.rb +12 -3
- data/lib/citygrid/api/response.rb +2 -2
- data/lib/citygrid/api.rb +190 -3
- data/lib/citygrid/details.rb +1 -1
- data/lib/citygrid/listing.rb +7 -2
- data/lib/citygrid/offers.rb +4 -0
- data/lib/citygrid/reviews.rb +4 -0
- data/lib/citygrid/search.rb +6 -0
- data/lib/citygrid.rb +117 -12
- data/lib/dashboard/sinatra_partial.rb +17 -0
- data/lib/dashboard/stored_reporter.rb +101 -0
- data/lib/dashboard/test_result.rb +8 -0
- data/lib/request_ext.rb +32 -0
- data/public/javascript/dashboard.js +5 -0
- data/test/api/ad_center/test_account.rb +120 -0
- data/test/api/ad_center/test_ad_group.rb +50 -0
- data/test/api/ad_center/test_ad_group_ad.rb +27 -0
- data/test/api/ad_center/test_ad_group_criterion.rb +37 -0
- data/test/api/ad_center/test_ad_group_geo.rb +19 -0
- data/test/api/ad_center/test_authentication.rb +22 -0
- data/test/api/ad_center/test_billing.rb +14 -0
- data/test/api/ad_center/test_budget.rb +13 -0
- data/test/api/ad_center/test_call_detail.rb +36 -0
- data/test/api/ad_center/test_campaign.rb +27 -0
- data/test/api/ad_center/test_category.rb +37 -0
- data/test/api/ad_center/test_geolocation.rb +19 -0
- data/test/api/ad_center/test_image.rb +17 -0
- data/test/api/ad_center/test_method_of_payment.rb +51 -0
- data/test/api/ad_center/test_places.rb +79 -0
- data/test/api/ad_center/test_reports.rb +37 -0
- data/test/api/content/test_offers.rb +28 -0
- data/test/api/content/test_places.rb +66 -0
- data/test/helper.rb +67 -14
- data/test/test_config.rb +11 -0
- data/test/test_details.rb +14 -5
- data/test/test_img.jpg +0 -0
- data/test/test_img_big.png +0 -0
- data/test/test_listing.rb +64 -64
- data/test/test_search.rb +21 -1
- data/test/test_super_array.rb +1 -1
- data/test/test_super_hash.rb +1 -1
- data/views/_context_result.haml +25 -0
- data/views/_request.haml +3 -0
- data/views/_test_result.haml +4 -0
- data/views/stylesheets/test.scss +53 -0
- data/views/test.haml +8 -0
- metadata +145 -114
- data/lib/citygrid/api/base.rb +0 -60
- data/test/test_citygrid.rb +0 -7
@@ -0,0 +1,79 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
token = AuthToken.generate
|
4
|
+
|
5
|
+
context "Adding a place" do
|
6
|
+
setup do
|
7
|
+
run_with_rescue do
|
8
|
+
CityGrid::API::AdCenter::Places.search(
|
9
|
+
:token => token,
|
10
|
+
"placeId" => 11489139
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
should("not be empty") { !topic.empty? }
|
16
|
+
should("return code OK") { topic.response.code }.equals(200)
|
17
|
+
should("return message OK") { topic.response.message }.equals("OK")
|
18
|
+
end
|
19
|
+
|
20
|
+
context "Adding a place by Adcenter API" do
|
21
|
+
setup do
|
22
|
+
run_with_rescue do
|
23
|
+
CityGrid::API::AdCenter::Places.mutate(
|
24
|
+
:token => token,
|
25
|
+
"mutateOperationListResource" => [{
|
26
|
+
"operator" => "ADD",
|
27
|
+
"operand" => {
|
28
|
+
"name" => "Pi on sunset in LAAAAAAAAAAAAAA",
|
29
|
+
"address_1" => "Jackson 2102",
|
30
|
+
"address_2" => "",
|
31
|
+
"city" => "Los Angeles",
|
32
|
+
"state" => "California",
|
33
|
+
"postal_code" => 90025,
|
34
|
+
"phone_number" => 3103333333,
|
35
|
+
"website_url" => "pi.com",
|
36
|
+
"primary_tag_id" => "3623",
|
37
|
+
"bullet1" => "Knoll bullet 1",
|
38
|
+
"tagline" => "my tagline",
|
39
|
+
"primary_tag_id" => 3623,
|
40
|
+
"secondary_tags" => '1776'}
|
41
|
+
}]
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
should("not be empty") { !topic.empty? }
|
46
|
+
should("return code OK") { topic.resources.first.response.code }.equals(200)
|
47
|
+
should("return message OK") { topic.resources.first.response.message.upcase }.equals("OK")
|
48
|
+
end
|
49
|
+
|
50
|
+
context "Update a place by Adcenter API" do
|
51
|
+
setup do
|
52
|
+
run_with_rescue do
|
53
|
+
CityGrid::API::AdCenter::Places.mutate(
|
54
|
+
:token => token,
|
55
|
+
"mutateOperationListResource" => [{
|
56
|
+
"operator" => "SET",
|
57
|
+
"operand" => {
|
58
|
+
"name" => "Pi on sunset in LAAAAAAAAAAAAAA",
|
59
|
+
"address_1" => "Jackson 2102",
|
60
|
+
"address_2" => "",
|
61
|
+
"city" => "Los Angeles",
|
62
|
+
"state" => "California",
|
63
|
+
"postal_code" => 90025,
|
64
|
+
"phone_number" => 3103333333,
|
65
|
+
"website_url" => "pi.com",
|
66
|
+
"primary_tag_id" => "3623",
|
67
|
+
"bullet1" => "Knoll bullet 1",
|
68
|
+
"tagline" => "my tagline",
|
69
|
+
"primary_tag_id" => 3623,
|
70
|
+
"secondary_tags" => '1776',
|
71
|
+
"listing_id" => 755498442}
|
72
|
+
}]
|
73
|
+
)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
should("not be empty"){ !topic.empty? }
|
77
|
+
should("return code OK"){ topic.resources.first.response.code }.equals(200)
|
78
|
+
should("return message OK") { topic.resources.first.response.message }.equals("OK")
|
79
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
token = AuthToken.sales_coord
|
4
|
+
|
5
|
+
context "Report summary" do
|
6
|
+
context "daily" do
|
7
|
+
setup do
|
8
|
+
run_with_rescue do
|
9
|
+
CityGrid::API::AdCenter::Performance.summary(
|
10
|
+
:daily,
|
11
|
+
:campaignId => 786,
|
12
|
+
:period => 'last30Days',
|
13
|
+
:token => token
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
should("not be empty"){ !topic.empty? }
|
18
|
+
should("have performance resources"){
|
19
|
+
topic.dailyCampaignPerformanceResources.length > 0
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
context "user actions" do
|
24
|
+
setup do
|
25
|
+
run_with_rescue do
|
26
|
+
CityGrid::API::AdCenter::Performance.summary(
|
27
|
+
:actions,
|
28
|
+
:campaignId => 786,
|
29
|
+
:period => 'last30Days',
|
30
|
+
:token => token
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
should("not be empty"){ !topic.empty? }
|
35
|
+
should("have user actions"){ topic.userActions.length > 0 }
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
# context "Getting an offer" do
|
4
|
+
# setup do
|
5
|
+
# run_with_rescue do
|
6
|
+
# response = CityGrid::API::Content::Offers.where(
|
7
|
+
# :what => "restaurant",
|
8
|
+
# :where => "98033",
|
9
|
+
# :format => :json
|
10
|
+
# )
|
11
|
+
# response
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# should("not be empty") { !topic.empty? }
|
16
|
+
# end
|
17
|
+
|
18
|
+
context "Getting an offer by listing ID" do
|
19
|
+
setup do
|
20
|
+
run_with_rescue do
|
21
|
+
CityGrid::API::Content::Offers.places(
|
22
|
+
:listing_id => 628554020
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
should("not be empty") { !topic.empty? }
|
28
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
token = AuthToken.generate
|
4
|
+
|
5
|
+
context "Adding a place" do
|
6
|
+
setup do
|
7
|
+
run_with_rescue do
|
8
|
+
CityGrid::API::Content::Places.mutate(
|
9
|
+
:token => token,
|
10
|
+
"mutateOperationListResource" => [{
|
11
|
+
"operator" => "ADD",
|
12
|
+
"operand" => {
|
13
|
+
# "accountId" => "123",
|
14
|
+
"name" => "Pi on sunset in LAAAAAAAAAAAAAA",
|
15
|
+
"address_1" => "Jackson 2102",
|
16
|
+
"address_2" => "",
|
17
|
+
"city" => "Los Angeles",
|
18
|
+
"state" => "California",
|
19
|
+
"postal_code" => 90025,
|
20
|
+
"phone_number" => 3103333333,
|
21
|
+
"website_url" => "pi.com",
|
22
|
+
"primary_tag_id" => "3623",
|
23
|
+
"bullet1" => "Knoll bullet 1",
|
24
|
+
"tagline" => "my tagline",
|
25
|
+
"primary_tag_id" => 3623,
|
26
|
+
"secondary_tags" => '1776'}
|
27
|
+
}]
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
should("not be empty") { !topic.empty? }
|
32
|
+
should("return code OK") { topic.resources.first.response.code }.equals(200)
|
33
|
+
should("return message OK") { topic.resources.first.response.message.upcase }.equals("OK")
|
34
|
+
end
|
35
|
+
|
36
|
+
context "Update a place" do
|
37
|
+
setup do
|
38
|
+
run_with_rescue do
|
39
|
+
CityGrid::API::Content::Places.mutate(
|
40
|
+
:token => token,
|
41
|
+
"mutateOperationListResource" => [{
|
42
|
+
"operator" => "SET",
|
43
|
+
"operand" => {
|
44
|
+
# "accountId" => "123",
|
45
|
+
"name" => "Pi on sunset in LAAAAAAAAAAAAAA",
|
46
|
+
"address_1" => "Jackson 2102",
|
47
|
+
"address_2" => "",
|
48
|
+
"city" => "Los Angeles",
|
49
|
+
"state" => "California",
|
50
|
+
"postal_code" => 90025,
|
51
|
+
"phone_number" => 3103333333,
|
52
|
+
"website_url" => "pi.com",
|
53
|
+
"primary_tag_id" => "3623",
|
54
|
+
"bullet1" => "Knoll bullet 1",
|
55
|
+
"tagline" => "my tagline",
|
56
|
+
"primary_tag_id" => 3623,
|
57
|
+
"secondary_tags" => '1776',
|
58
|
+
"listing_id" => 755498442}
|
59
|
+
}]
|
60
|
+
)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
should("not be empty"){ !topic.empty? }
|
64
|
+
should("return code OK"){ topic.resources.first.response.code }.equals(200)
|
65
|
+
should("return message OK") { topic.resources.first.response.message }.equals("OK")
|
66
|
+
end
|
data/test/helper.rb
CHANGED
@@ -1,16 +1,69 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
# Hack to allow storing tokens between tests
|
2
|
+
class AuthToken
|
3
|
+
class << self
|
4
|
+
def kunimom
|
5
|
+
@@kunimom ||= CityGrid.login(
|
6
|
+
:username => 'kunimom',
|
7
|
+
:password => 'pppppp'
|
8
|
+
).authToken
|
9
|
+
end
|
10
|
+
|
11
|
+
def sales_coord
|
12
|
+
@@sales_cord ||= CityGrid.login(
|
13
|
+
:username => 'QASalesCoord',
|
14
|
+
:password => 'pppppp'
|
15
|
+
).authToken
|
16
|
+
end
|
17
|
+
|
18
|
+
def rand_number
|
19
|
+
@@rand_number ||= rand(10000000)
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate
|
23
|
+
kunimom
|
24
|
+
end
|
25
|
+
end
|
9
26
|
end
|
10
|
-
require "ap"
|
11
|
-
require "riot"
|
12
27
|
|
13
|
-
|
14
|
-
|
15
|
-
require
|
16
|
-
require
|
28
|
+
# don't do gem setup if we're in the dashboad environment
|
29
|
+
unless defined? IN_DASHBOARD
|
30
|
+
require 'rubygems'
|
31
|
+
require 'bundler'
|
32
|
+
begin
|
33
|
+
Bundler.setup(:default, :development)
|
34
|
+
rescue Bundler::BundlerError => e
|
35
|
+
$stderr.puts e.message
|
36
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
37
|
+
exit e.status_code
|
38
|
+
end
|
39
|
+
require "ap"
|
40
|
+
require "riot"
|
41
|
+
|
42
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
43
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
44
|
+
require "citygrid_api"
|
45
|
+
require "publisher_helper"
|
46
|
+
|
47
|
+
# load default config
|
48
|
+
CityGrid.load_config File.expand_path(File.join(File.dirname(__FILE__), '..', 'citygrid_api.yml')), "qa"
|
49
|
+
# load endpoints from configs
|
50
|
+
# CityGrid.set_endpoints File.join(File.dirname(__FILE__), '..', "qa-endpoints.properties")
|
51
|
+
# CityGrid.set_env File.join(File.dirname(__FILE__), '..', "qa-env.properties")
|
52
|
+
|
53
|
+
# Run code with rescue so that exceptions
|
54
|
+
# will be printed, but won't stop test suite
|
55
|
+
def run_with_rescue
|
56
|
+
begin
|
57
|
+
yield
|
58
|
+
rescue CityGrid::API::InvalidResponseFormat => ex
|
59
|
+
x = {"description" => ex.description, "server_msg" => ex.server_msg}
|
60
|
+
puts "======= ERROR ======="
|
61
|
+
ap x
|
62
|
+
false
|
63
|
+
rescue => ex
|
64
|
+
ap ex
|
65
|
+
puts ex.backtrace.join("\n")
|
66
|
+
false # return false
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/test/test_config.rb
ADDED
data/test/test_details.rb
CHANGED
@@ -1,18 +1,27 @@
|
|
1
|
-
require
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
2
|
|
3
|
-
context "Initiating a Details" do
|
3
|
+
c = context "Initiating a Details" do
|
4
4
|
setup do
|
5
|
-
|
5
|
+
begin
|
6
|
+
run_with_rescue do
|
7
|
+
CityGrid::Details.new :public_id => "philip-marie-restaurant-new-york"
|
8
|
+
end
|
9
|
+
rescue
|
10
|
+
puts "An error occurred while fetch philip-marie-restaurant-new-york details"
|
11
|
+
end
|
6
12
|
end
|
7
13
|
|
8
14
|
should "return a single Details object" do
|
9
15
|
topic.is_a? CityGrid::Details
|
10
16
|
end
|
17
|
+
|
11
18
|
end
|
12
|
-
|
19
|
+
|
13
20
|
context "Initiating new MultiDetails" do
|
14
21
|
setup do
|
15
|
-
|
22
|
+
run_with_rescue do
|
23
|
+
CityGrid::MultiDetails.new :public_id => "philip-marie-restaurant-new-york"
|
24
|
+
end
|
16
25
|
end
|
17
26
|
|
18
27
|
should "return a MultiDetails object" do
|
data/test/test_img.jpg
ADDED
Binary file
|
Binary file
|
data/test/test_listing.rb
CHANGED
@@ -1,64 +1,64 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
context "A Listing created from scratch" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
context "A Listing created from search" do
|
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
|
-
end
|
1
|
+
# require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
+
#
|
3
|
+
# context "A Listing created from scratch" do
|
4
|
+
# setup do
|
5
|
+
# CityGrid::Listing.new "id" => 7117426
|
6
|
+
# end
|
7
|
+
#
|
8
|
+
# should "load details after first access" do
|
9
|
+
# topic.tips
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# context "A Listing created from search" do
|
14
|
+
# setup do
|
15
|
+
# CityGrid.search(:what => "food", :where => "seattle").first
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# # Test loading
|
19
|
+
# # ----------------- #
|
20
|
+
# context "that has not been accessed" do
|
21
|
+
# should "not be loaded" do
|
22
|
+
# !topic.clone.instance_variable_get "@loaded"
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# context "that has a method called on it for the first time" do
|
27
|
+
# setup do
|
28
|
+
# old = topic.clone
|
29
|
+
# listing = topic.clone
|
30
|
+
# listing.summary
|
31
|
+
# [old, listing]
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# should "become loaded" do
|
35
|
+
# topic.last.instance_variable_get "@loaded"
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# should "update details into itself" do
|
39
|
+
# topic.first != topic.last
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# # # Test offers, reviews
|
44
|
+
# # # -------------------- #
|
45
|
+
# # should "get offers" do
|
46
|
+
# # !topic.offers.empty?
|
47
|
+
# # end
|
48
|
+
# #
|
49
|
+
# # # Test reviews
|
50
|
+
# # # -------------------- #
|
51
|
+
# # should "get reviews" do
|
52
|
+
# # !topic.reviews.empty?
|
53
|
+
# # end
|
54
|
+
#
|
55
|
+
# context "updating reviews" do
|
56
|
+
# setup do
|
57
|
+
# [topic.reviews.clone, topic.reviews(:rpp => 2).clone]
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# should "not be the same" do
|
61
|
+
# topic[0] != topic[-1]
|
62
|
+
# end
|
63
|
+
# end
|
64
|
+
# end
|
data/test/test_search.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
2
|
|
3
3
|
context "searching for a CityGrid listing" do
|
4
4
|
setup do
|
@@ -13,6 +13,26 @@ context "searching for a CityGrid listing" do
|
|
13
13
|
topic.empty?
|
14
14
|
end
|
15
15
|
|
16
|
+
should "create an array containing Listing objects" do
|
17
|
+
topic.reject do |listing|
|
18
|
+
listing.is_a? CityGrid::Listing
|
19
|
+
end.empty?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "searching for a special CityGrid listing" do
|
24
|
+
setup do
|
25
|
+
CityGrid.search :what => "Divine Dynasty Cleaners", :where => "84129"
|
26
|
+
end
|
27
|
+
|
28
|
+
should "create an array" do
|
29
|
+
topic.is_a? Array
|
30
|
+
end
|
31
|
+
|
32
|
+
should_not "be empty" do
|
33
|
+
topic.empty?
|
34
|
+
end
|
35
|
+
|
16
36
|
should "create an array containing Listing objects" do
|
17
37
|
topic.reject do |listing|
|
18
38
|
listing.is_a? CityGrid::Listing
|
data/test/test_super_array.rb
CHANGED
data/test/test_super_hash.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
.context_result
|
2
|
+
.title{:class => context_result.passed? ? "passed" : "failed"}= context_result.desc
|
3
|
+
|
4
|
+
.content
|
5
|
+
.passes
|
6
|
+
- context_result.passes.each do |pass|
|
7
|
+
.pass
|
8
|
+
== <b style="color:green">+</b>
|
9
|
+
#{pass.desc}
|
10
|
+
- if pass.result != ""
|
11
|
+
==: #{pass.result}
|
12
|
+
|
13
|
+
.fails
|
14
|
+
- context_result.fails.each do |fail|
|
15
|
+
.fail
|
16
|
+
== <b style="color:red">-</b>
|
17
|
+
#{fail.desc}
|
18
|
+
- if fail.result != ""
|
19
|
+
==: #{fail.result}
|
20
|
+
|
21
|
+
.requests
|
22
|
+
= partial :request, :collection => context_result.requests
|
23
|
+
|
24
|
+
.children
|
25
|
+
= partial :context_result, :collection => context_result.children
|
data/views/_request.haml
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
body {
|
2
|
+
font-family: Arial;
|
3
|
+
font-size: 14px;
|
4
|
+
}
|
5
|
+
|
6
|
+
.passed {
|
7
|
+
color: green;
|
8
|
+
}
|
9
|
+
|
10
|
+
.failed {
|
11
|
+
color: red;
|
12
|
+
}
|
13
|
+
|
14
|
+
.test_result {
|
15
|
+
.title {
|
16
|
+
font-weight: bold;
|
17
|
+
font-size: 16px;
|
18
|
+
margin-bottom: 5px;
|
19
|
+
}
|
20
|
+
|
21
|
+
.results {
|
22
|
+
margin-left: 10px;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
.context_result {
|
26
|
+
margin-bottom: 20px;
|
27
|
+
.title {
|
28
|
+
font-weight: bold;
|
29
|
+
}
|
30
|
+
|
31
|
+
.content {
|
32
|
+
margin-left: 20px;
|
33
|
+
|
34
|
+
.passes {
|
35
|
+
.pass {
|
36
|
+
// color: green;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
.fails {
|
41
|
+
.fail {
|
42
|
+
// color: red;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
.requests {
|
47
|
+
.curl {
|
48
|
+
width: 1000px;
|
49
|
+
height: 60px;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
data/views/test.haml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
%html
|
2
|
+
%head
|
3
|
+
%link{:rel => "stylesheet", :href => "/stylesheets/test.css"}
|
4
|
+
%script{:language => "javascript", :src => "http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"}
|
5
|
+
%script{:language => "javascript", :src => "/javascript/dashboard.js"}
|
6
|
+
|
7
|
+
%body
|
8
|
+
= partial :test_result, :collection => @results
|