eve-4 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +0 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/dictionaries/tylercollins.xml +3 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/eve-updated.iml +58 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +554 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +108 -0
- data/History.txt +7 -0
- data/Rakefile +37 -0
- data/eve.gemspec +36 -0
- data/lib/eve.rb +26 -0
- data/lib/eve/api.rb +249 -0
- data/lib/eve/api/connectivity.rb +39 -0
- data/lib/eve/api/request.rb +80 -0
- data/lib/eve/api/response.rb +34 -0
- data/lib/eve/api/response/result.rb +87 -0
- data/lib/eve/api/response/row.rb +42 -0
- data/lib/eve/api/response/rowset.rb +18 -0
- data/lib/eve/api/services.rb +20 -0
- data/lib/eve/api/services/account.rb +12 -0
- data/lib/eve/api/services/character.rb +96 -0
- data/lib/eve/api/services/corporation.rb +150 -0
- data/lib/eve/api/services/eve.rb +76 -0
- data/lib/eve/api/services/map.rb +45 -0
- data/lib/eve/api/services/misc.rb +24 -0
- data/lib/eve/api/services/server.rb +20 -0
- data/lib/eve/dependencies.rb +48 -0
- data/lib/eve/deprecation.rb +3 -0
- data/lib/eve/errors.rb +129 -0
- data/lib/eve/errors/authentication_errors.rb +33 -0
- data/lib/eve/errors/internal_errors.rb +64 -0
- data/lib/eve/errors/miscellaneous_errors.rb +19 -0
- data/lib/eve/errors/user_input_errors.rb +62 -0
- data/lib/eve/javascript_helper.rb +196 -0
- data/lib/eve/trust.rb +87 -0
- data/lib/eve/trust/controller_helpers.rb +86 -0
- data/lib/eve/trust/igb_interface.rb +92 -0
- data/lib/eve/trust/mime_types.rb +4 -0
- data/lib/eve/version.rb +8 -0
- data/log/development.log +30 -0
- data/spec/controllers/controller_helpers_spec.rb +91 -0
- data/spec/helpers/javascript_helper_spec.rb +80 -0
- data/spec/helpers/view_helper_spec.rb +7 -0
- data/spec/lib/eve/api/calls/account/characters_spec.rb +22 -0
- data/spec/lib/eve/api/calls/character/account_balance_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/asset_list_spec.rb +23 -0
- data/spec/lib/eve/api/calls/character/character_sheet_spec.rb +51 -0
- data/spec/lib/eve/api/calls/character/fac_war_stats_spec.rb +31 -0
- data/spec/lib/eve/api/calls/character/industry_jobs_spec.rb +27 -0
- data/spec/lib/eve/api/calls/character/kill_log_spec.rb +27 -0
- data/spec/lib/eve/api/calls/character/mail_messages_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/mailing_lists_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/market_orders_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/medals_spec.rb +24 -0
- data/spec/lib/eve/api/calls/character/research_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/skill_in_training_spec.rb +44 -0
- data/spec/lib/eve/api/calls/character/skill_queue_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/standings_spec.rb +26 -0
- data/spec/lib/eve/api/calls/character/wallet_journal_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/wallet_transactions_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character_portrait_spec.rb +17 -0
- data/spec/lib/eve/api/calls/corporation/account_balances_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/asset_list_spec.rb +25 -0
- data/spec/lib/eve/api/calls/corporation/container_log_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/corporation_sheet_spec.rb +36 -0
- data/spec/lib/eve/api/calls/corporation/fac_war_stats_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/industry_jobs_spec.rb +30 -0
- data/spec/lib/eve/api/calls/corporation/kill_log_spec.rb +27 -0
- data/spec/lib/eve/api/calls/corporation/market_orders_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/medals_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/member_medals_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/member_security_log_spec.rb +24 -0
- data/spec/lib/eve/api/calls/corporation/member_security_spec.rb +25 -0
- data/spec/lib/eve/api/calls/corporation/member_tracking_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/shareholders_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/standings_spec.rb +30 -0
- data/spec/lib/eve/api/calls/corporation/starbase_detail_spec.rb +32 -0
- data/spec/lib/eve/api/calls/corporation/starbase_list_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/titles_spec.rb +26 -0
- data/spec/lib/eve/api/calls/corporation/wallet_journal_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/wallet_transactions_spec.rb +22 -0
- data/spec/lib/eve/api/calls/empty_call_spec.rb +29 -0
- data/spec/lib/eve/api/calls/eve/alliance_list_spec.rb +26 -0
- data/spec/lib/eve/api/calls/eve/certificate_tree_spec.rb +18 -0
- data/spec/lib/eve/api/calls/eve/character_id_spec.rb +27 -0
- data/spec/lib/eve/api/calls/eve/conquerable_station_list_spec.rb +11 -0
- data/spec/lib/eve/api/calls/eve/error_list_spec.rb +21 -0
- data/spec/lib/eve/api/calls/eve/fac_war_stats_spec.rb +25 -0
- data/spec/lib/eve/api/calls/eve/fac_war_top_stats_spec.rb +54 -0
- data/spec/lib/eve/api/calls/eve/ref_types_spec.rb +11 -0
- data/spec/lib/eve/api/calls/eve/skill_tree_spec.rb +17 -0
- data/spec/lib/eve/api/calls/map/fac_war_systems_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/jumps_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/kills_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/sovereignty_spec.rb +11 -0
- data/spec/lib/eve/api/calls/server_status_spec.rb +28 -0
- data/spec/lib/eve/api/request_spec.rb +18 -0
- data/spec/lib/eve/api/response/error_spec.rb +13 -0
- data/spec/lib/eve/api/response_spec.rb +79 -0
- data/spec/lib/eve/api_spec.rb +13 -0
- data/spec/lib/eve/core_extensions/hash_spec.rb +23 -0
- data/spec/lib/eve/core_extensions/string_spec.rb +8 -0
- data/spec/lib/eve/trust/igb_interface_spec.rb +112 -0
- data/spec/log/development.log +0 -0
- data/spec/rcov.opts +2 -0
- data/spec/readme_spec.rb +36 -0
- data/spec/sample_api_key.yml +20 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +63 -0
- data/spec/support/behaves_like_rowset.rb +50 -0
- data/spec/support/controllers/trust_controller.rb +24 -0
- data/spec/support/jpg/mock_portrait.jpg +0 -0
- data/spec/support/mock_api_helpers.rb +46 -0
- data/spec/support/views/trust/html_and_igb.html.erb +1 -0
- data/spec/support/views/trust/html_and_igb.igb.erb +1 -0
- data/spec/support/views/trust/html_only.html.erb +1 -0
- data/spec/support/views/trust/igb_only.igb.erb +1 -0
- data/spec/support/xml/account/characters.xml +15 -0
- data/spec/support/xml/character/account_balance.xml +10 -0
- data/spec/support/xml/character/asset_list.xml +50 -0
- data/spec/support/xml/character/character_sheet.xml +65 -0
- data/spec/support/xml/character/fac_war_stats.xml +20 -0
- data/spec/support/xml/character/industry_jobs.xml +70 -0
- data/spec/support/xml/character/kill_log.xml +51 -0
- data/spec/support/xml/character/mail_messages.xml +12 -0
- data/spec/support/xml/character/mailing_lists.xml +12 -0
- data/spec/support/xml/character/market_orders.xml +11 -0
- data/spec/support/xml/character/medals.xml +13 -0
- data/spec/support/xml/character/research.xml +13 -0
- data/spec/support/xml/character/skill_in_training.xml +14 -0
- data/spec/support/xml/character/skill_not_in_training.xml +7 -0
- data/spec/support/xml/character/skill_queue.xml +11 -0
- data/spec/support/xml/character/standings.xml +32 -0
- data/spec/support/xml/character/wallet_journal.xml +39 -0
- data/spec/support/xml/character/wallet_transactions.xml +44 -0
- data/spec/support/xml/corporation/account_balance.xml +15 -0
- data/spec/support/xml/corporation/asset_list.xml +50 -0
- data/spec/support/xml/corporation/container_log.xml +32 -0
- data/spec/support/xml/corporation/fac_war_stats.xml +19 -0
- data/spec/support/xml/corporation/industry_jobs.xml +70 -0
- data/spec/support/xml/corporation/kill_log.xml +51 -0
- data/spec/support/xml/corporation/market_orders.xml +37 -0
- data/spec/support/xml/corporation/medals.xml +8 -0
- data/spec/support/xml/corporation/member_corporation_sheet.xml +51 -0
- data/spec/support/xml/corporation/member_medals.xml +10 -0
- data/spec/support/xml/corporation/member_security.xml +21 -0
- data/spec/support/xml/corporation/member_security_log.xml +55 -0
- data/spec/support/xml/corporation/member_tracking.xml +18 -0
- data/spec/support/xml/corporation/non_member_corporation_sheet.xml +30 -0
- data/spec/support/xml/corporation/shareholders.xml +11 -0
- data/spec/support/xml/corporation/standings.xml +33 -0
- data/spec/support/xml/corporation/starbase_detail.xml +33 -0
- data/spec/support/xml/corporation/starbase_list.xml +17 -0
- data/spec/support/xml/corporation/titles.xml +34 -0
- data/spec/support/xml/corporation/wallet_journal.xml +40 -0
- data/spec/support/xml/corporation/wallet_transactions.xml +12 -0
- data/spec/support/xml/errors/106.xml +5 -0
- data/spec/support/xml/errors/516.xml +5 -0
- data/spec/support/xml/eve/alliance_list.xml +22 -0
- data/spec/support/xml/eve/certificate_tree.xml +49 -0
- data/spec/support/xml/eve/character_id.xml +15 -0
- data/spec/support/xml/eve/conquerable_station_list.xml +24 -0
- data/spec/support/xml/eve/error_list.xml +78 -0
- data/spec/support/xml/eve/fac_war_stats.xml +31 -0
- data/spec/support/xml/eve/fac_war_top_stats.xml +238 -0
- data/spec/support/xml/eve/ref_types.xml +105 -0
- data/spec/support/xml/eve/skill_tree.xml +52 -0
- data/spec/support/xml/map/fac_war_systems.xml +180 -0
- data/spec/support/xml/map/jumps.xml +166 -0
- data/spec/support/xml/map/kills.xml +191 -0
- data/spec/support/xml/map/sovereignty.xml +20 -0
- data/spec/support/xml/rowset_with_mismatched_attributes.xml +6 -0
- data/spec/support/xml/server/server_status.xml +9 -0
- metadata +310 -2
@@ -0,0 +1,92 @@
|
|
1
|
+
module Eve
|
2
|
+
module Trust
|
3
|
+
class IgbInterface
|
4
|
+
attr_reader :request
|
5
|
+
delegate :headers, :to => :request
|
6
|
+
|
7
|
+
def initialize(request)
|
8
|
+
@request = request
|
9
|
+
end
|
10
|
+
|
11
|
+
def trusted?
|
12
|
+
trusted
|
13
|
+
end
|
14
|
+
|
15
|
+
def igb?
|
16
|
+
request.user_agent && (request.user_agent[/eve\-minibrowser/i] || request.user_agent[/EVE\-IGB/])
|
17
|
+
end
|
18
|
+
|
19
|
+
# Validation string (HTTP_EVE_VALIDATION_STRING) is only a wishlist item, and is not actually implemented in the
|
20
|
+
# IGB yet. However, if CCP implements it as written, this method should magically start working.
|
21
|
+
def validation_string
|
22
|
+
return @validation_string if @validation_string
|
23
|
+
@validation_string ||= request.headers['HTTP_EVE_VALIDATION_STRING'] || request.headers['HTTP_EVE_VALIDATIONSTRING']
|
24
|
+
unless @validation_string
|
25
|
+
warn "Validation string (HTTP_EVE_VALIDATION_STRING) is only a request, and is not implemented yet"
|
26
|
+
end
|
27
|
+
@validation_string
|
28
|
+
end
|
29
|
+
|
30
|
+
def trusted; igb_variable_get(:trusted); end
|
31
|
+
def server_ip; igb_variable_get(:server_ip); end
|
32
|
+
def char_name; igb_variable_get(:char_name); end
|
33
|
+
def char_id; igb_variable_get(:char_id); end
|
34
|
+
def corp_name; igb_variable_get(:corp_name); end
|
35
|
+
def corp_id; igb_variable_get(:corp_id); end
|
36
|
+
def alliance_name; igb_variable_get(:alliance_name); end
|
37
|
+
def alliance_id; igb_variable_get(:alliance_id); end
|
38
|
+
def region_name; igb_variable_get(:region_name); end
|
39
|
+
def constellation_name; igb_variable_get(:constellation_name); end
|
40
|
+
def corp_role; igb_variable_get(:corp_role); end
|
41
|
+
def station_id; igb_variable_get(:station_id); end
|
42
|
+
def station_name; igb_variable_get(:station_name); end
|
43
|
+
def solar_system_name; igb_variable_get(:solar_system_name); end
|
44
|
+
|
45
|
+
# The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
|
46
|
+
# implements it as written, this method should magically start working.
|
47
|
+
def militia_name; igb_variable_get(:militia_name, "The IGB does not yet supply :militia_name headers, so this will always be nil"); end
|
48
|
+
# The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
|
49
|
+
# implements it as written, this method should magically start working.
|
50
|
+
def militia_id; igb_variable_get(:militia_id, "The IGB does not yet supply :militia_id headers, so this will always be nil"); end
|
51
|
+
# The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
|
52
|
+
# implements it as written, this method should magically start working.
|
53
|
+
def region_id; igb_variable_get(:region_id, "The IGB does not yet supply :region_id headers, so this will always be nil"); end
|
54
|
+
# The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
|
55
|
+
# implements it as written, this method should magically start working.
|
56
|
+
def constellation_id; igb_variable_get(:constellation_id, "The IGB does not yet supply :constellation_id headers, so this will always be nil"); end
|
57
|
+
# The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
|
58
|
+
# implements it as written, this method should magically start working.
|
59
|
+
def solar_system_id; igb_variable_get(:solar_system_id, "The IGB does not yet supply :solar_system_id headers, so this will always be nil"); end
|
60
|
+
# The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
|
61
|
+
# implements it as written, this method should magically start working.
|
62
|
+
def ship_id; igb_variable_get(:ship_id, "The IGB does not yet supply :ship_id headers, so this will always be nil"); end
|
63
|
+
# The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
|
64
|
+
# implements it as written, this method should magically start working.
|
65
|
+
def system_security; igb_variable_get(:system_security, "The IGB does not yet supply :system_security headers, so this will always be nil"); end
|
66
|
+
|
67
|
+
# Removed from Dominion, so always returns nil
|
68
|
+
def nearest_location
|
69
|
+
igb_variable_get('nearest_location',
|
70
|
+
"The nearest_location headers have been removed from the IGB as of Dominion, so this always returns nil.")
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
def memoized_igb_variables(method_name = nil)
|
75
|
+
@memoized_igb_variables ||= {}
|
76
|
+
@memoized_igb_variables[method_name] ||= {}
|
77
|
+
end
|
78
|
+
|
79
|
+
def igb_variable_get(method_name, warning = nil)
|
80
|
+
memoized_igb_variables(method_name)[warning] ||= begin
|
81
|
+
return_value = (
|
82
|
+
v = headers["HTTP_EVE_#{method_name.to_s.camelize.upcase}"] || nil
|
83
|
+
v = (YAML::load(v) rescue v) unless v.nil?
|
84
|
+
v
|
85
|
+
)
|
86
|
+
warn warning if return_value.nil? && warning
|
87
|
+
return_value
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
data/lib/eve/version.rb
ADDED
data/log/development.log
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Processing by TrustController#index as HTML
|
2
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (4 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:18)
|
3
|
+
Completed 200 OK in 4ms (Views: 3.4ms)
|
4
|
+
Processing by TrustController#igb_only as HTML
|
5
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (4 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:29)
|
6
|
+
Completed 200 OK in 3ms (Views: 1.7ms)
|
7
|
+
Processing by TrustController#html_and_igb as HTML
|
8
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (4 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:36)
|
9
|
+
Completed 200 OK in 2ms (Views: 1.0ms)
|
10
|
+
Processing by TrustController#html_only as HTML
|
11
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (4 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:43)
|
12
|
+
Completed 200 OK in 2ms (Views: 1.1ms)
|
13
|
+
Processing by TrustController#no_templates as HTML
|
14
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (5 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:50)
|
15
|
+
Completed 500 Internal Server Error in 1ms
|
16
|
+
Processing by TrustController#index as HTML
|
17
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (3 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:61)
|
18
|
+
Completed 200 OK in 0ms (Views: 0.2ms)
|
19
|
+
Processing by TrustController#igb_only as HTML
|
20
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (5 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:67)
|
21
|
+
Completed 500 Internal Server Error in 1ms
|
22
|
+
Processing by TrustController#html_and_igb as HTML
|
23
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (4 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:73)
|
24
|
+
Completed 200 OK in 1ms (Views: 1.2ms)
|
25
|
+
Processing by TrustController#html_only as HTML
|
26
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (4 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:80)
|
27
|
+
Completed 200 OK in 1ms (Views: 0.9ms)
|
28
|
+
Processing by TrustController#no_templates as HTML
|
29
|
+
DEPRECATION WARNING: prefer_trust is deprecated and will be removed from Rails 4.0 (The EVE IGB no longer accepts trust headers. Please use <%=request_trust%> in your view, instead.). (called from block (5 levels) in <top (required)> at /Users/tylercollins/RubymineProjects/eve/spec/controllers/controller_helpers_spec.rb:87)
|
30
|
+
Completed 500 Internal Server Error in 1ms
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# TrustController is our test controller.
|
4
|
+
describe TrustController do
|
5
|
+
render_views
|
6
|
+
|
7
|
+
it "should not consider the helper methods to be actions" do
|
8
|
+
TrustController.action_methods.sort.should == %w(html_and_igb html_only igb_only index no_templates)
|
9
|
+
end
|
10
|
+
|
11
|
+
context "from the IGB" do
|
12
|
+
before do
|
13
|
+
request.user_agent = "eve-minibrowser"
|
14
|
+
end
|
15
|
+
|
16
|
+
context "without trust" do
|
17
|
+
it "should require trust" do
|
18
|
+
get :index
|
19
|
+
response.headers['Eve.trustme'].should_not be_blank
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with trust" do
|
24
|
+
# um, we've already established trust: is there anything else in the controller that needs testing?
|
25
|
+
end
|
26
|
+
|
27
|
+
context "and only an IGB template exists" do
|
28
|
+
it "responds with an IGB-specific page" do
|
29
|
+
get :igb_only
|
30
|
+
response.body.should == "IGB Only"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "and IGB and HTML templates exist" do
|
35
|
+
it "responds with an IGB page" do
|
36
|
+
get :html_and_igb
|
37
|
+
response.body.should == "HTML and IGB (IGB)"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "and only an HTML template exists" do
|
42
|
+
it "does not respond with an IGB-specific page" do
|
43
|
+
get :html_only
|
44
|
+
response.body.should == "HTML Only"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "and no templates exist" do
|
49
|
+
it "raises a template error" do
|
50
|
+
proc { get :no_templates }.should raise_error(ActionView::MissingTemplate)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "from any other browser" do
|
56
|
+
before :each do
|
57
|
+
request.user_agent = 'Mozilla/5.001 (windows; U; NT4.0; en-US; rv:1.0) Gecko/25250101'
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should not require trust" do
|
61
|
+
get :index
|
62
|
+
response.headers['Eve.trustme'].should be_blank
|
63
|
+
end
|
64
|
+
|
65
|
+
context "and only an IGB template exists" do
|
66
|
+
it "raises a template error" do
|
67
|
+
proc { get :igb_only }.should raise_error(ActionView::MissingTemplate)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "and IGB and HTML templates exist" do
|
72
|
+
it "responds with an IGB page" do
|
73
|
+
get :html_and_igb
|
74
|
+
response.body.should == "HTML and IGB (HTML)"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "and only an HTML template exists" do
|
79
|
+
it "does not respond with an IGB-specific page" do
|
80
|
+
get :html_only
|
81
|
+
response.body.should == "HTML Only"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "and no templates exist" do
|
86
|
+
it "raises a template error" do
|
87
|
+
proc { get :no_templates }.should raise_error(ActionView::MissingTemplate)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eve::JavascriptHelper do
|
4
|
+
subject { ActionView::Base.new }
|
5
|
+
|
6
|
+
it "should link to mailing list" do
|
7
|
+
subject.link_to_mailing_list("link", '1').should == '<a href="#" onclick="CCPEVE.joinMailingList("1"); return false;">link</a>'
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should link to channel" do
|
11
|
+
subject.link_to_channel("link", '1').should == '<a href="#" onclick="CCPEVE.joinChannel("1"); return false;">link</a>'
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should link to waypoint" do
|
15
|
+
subject.link_to_waypoint("link", '1').should == '<a href="#" onclick="CCPEVE.addWaypoint("1"); return false;">link</a>'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should link to destination" do
|
19
|
+
subject.link_to_destination("link", '1').should == '<a href="#" onclick="CCPEVE.setDestination("1"); return false;">link</a>'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should request trust" do
|
23
|
+
subject.request_trust("link").should == "<script type=\"text/javascript\">\n//<![CDATA[\nCCPEVE.requestTrust(\"link\");\n//]]>\n</script>"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should link to trust request" do
|
27
|
+
subject.link_to_trust_request("link", '1').should == '<a href="#" onclick="CCPEVE.requestTrust("1"); return false;">link</a>'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should link to market details" do
|
31
|
+
subject.link_to_market_details("link", '1').should == '<a href="#" onclick="CCPEVE.showMarketDetails("1"); return false;">link</a>'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should link to contract" do
|
35
|
+
subject.link_to_contract("link", '1', '2').should == '<a href="#" onclick="CCPEVE.showContract("1", "2"); return false;">link</a>'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should link to fitting" do
|
39
|
+
subject.link_to_fitting("link", '1').should == '<a href="#" onclick="CCPEVE.showFitting("1"); return false;">link</a>'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should link to map" do
|
43
|
+
subject.link_to_route("link", '1').should == '<a href="#" onclick="CCPEVE.showRouteTo("1"); return false;">link</a>'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should link to route" do
|
47
|
+
subject.link_to_route("link", '1').should == '<a href="#" onclick="CCPEVE.showRouteTo("1"); return false;">link</a>'
|
48
|
+
subject.link_to_route("link", '1', '2').should == '<a href="#" onclick="CCPEVE.showRouteTo("1", "2"); return false;">link</a>'
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should link to preview" do
|
52
|
+
subject.link_to_preview("link", '1').should == '<a href="#" onclick="CCPEVE.showPreview("1"); return false;">link</a>'
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should link to showinfo" do
|
56
|
+
subject.link_to_info("link", "typeid").should == '<a href="#" onclick="CCPEVE.showInfo("typeid"); return false;">link</a>'
|
57
|
+
subject.link_to_info("link", 1, 2).should == '<a href="#" onclick="CCPEVE.showInfo(1, 2); return false;">link</a>'
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should link to evemail" do
|
61
|
+
subject.link_to_evemail("link").should == '<a href="#" onclick="CCPEVE.openEveMail(); return false;">link</a>'
|
62
|
+
end
|
63
|
+
|
64
|
+
context '#type_id' do
|
65
|
+
it "should raise ArgumentError if type doesn't match" do
|
66
|
+
proc { subject.type_id('something that is completely invalid') }.should raise_error(ArgumentError)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should return valid ID when given a valid argument' do
|
70
|
+
subject.type_id('Alliance').should == 16159
|
71
|
+
subject.type_id('Character').should == 1377
|
72
|
+
subject.type_id(:corporation).should == 2
|
73
|
+
subject.type_id(:constellation).should == 4
|
74
|
+
subject.type_id(:region).should == 3
|
75
|
+
subject.type_id(:solar_system).should == 5
|
76
|
+
subject.type_id("Solar System").should == 5
|
77
|
+
subject.type_id(:station).should == 3867
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eve::API::Services::Account do
|
4
|
+
context "#characters" do
|
5
|
+
context "with a valid api key" do
|
6
|
+
subject { mock_service(:account, :characters, :user_id => $user_id, :api_key => $limited_api_key) }
|
7
|
+
|
8
|
+
it "should list account characters" do
|
9
|
+
subject.characters.should behave_like_rowset('name,characterID,corporationName,corporationID') { |row|
|
10
|
+
%w(Mary Marcus Dieinafire).should include(row.name)
|
11
|
+
%w(150267069 150302299 150340823).should include(row.character_id.to_s)
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "without an api key" do
|
17
|
+
it "should raise an ArgumentError" do
|
18
|
+
proc { mock_service(:account, :characters) }.should raise_error(ArgumentError)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eve::API::Services::Character do
|
4
|
+
context "#account_balance" do
|
5
|
+
context "with a valid api key" do
|
6
|
+
subject { mock_service('character', 'account_balance', :user_id => $user_id,
|
7
|
+
:character_id => $character_id,
|
8
|
+
:api_key => $full_api_key) }
|
9
|
+
|
10
|
+
it "should provide account balance information" do
|
11
|
+
subject.accounts.should behave_like_rowset('accountID,accountKey,balance')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "without an api key" do
|
16
|
+
it "should raise an ArgumentError" do
|
17
|
+
proc { mock_service('character', 'account_balance') }.should raise_error(ArgumentError)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eve::API::Services::Character do
|
4
|
+
context "#asset_list" do
|
5
|
+
context "with a valid api key" do
|
6
|
+
subject { mock_service('character', 'asset_list', :user_id => $user_id,
|
7
|
+
:character_id => $character_id,
|
8
|
+
:api_key => $full_api_key) }
|
9
|
+
|
10
|
+
it "should provide an asset list" do
|
11
|
+
subject.assets.should behave_like_rowset('itemID,locationID,typeID,quantity,flag,singleton') { |asset|
|
12
|
+
asset.contents.should behave_like_rowset('itemID,typeID,quantity,flag,singleton') if !asset.rowsets.empty?
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "without an api key" do
|
18
|
+
it "should raise an ArgumentError" do
|
19
|
+
proc { mock_service('character', 'asset_list') }.should raise_error(ArgumentError)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eve::API::Services::Character do
|
4
|
+
context "#character_sheet" do
|
5
|
+
context "with a valid api key" do
|
6
|
+
subject { mock_service('character', 'character_sheet', :user_id => $user_id,
|
7
|
+
:character_id => $character_id,
|
8
|
+
:api_key => $limited_api_key) }
|
9
|
+
|
10
|
+
it "should produce character sheet info" do
|
11
|
+
subject.character_id.should == 150337897
|
12
|
+
subject.name.should == "corpslave"
|
13
|
+
subject.race.should == "Minmatar"
|
14
|
+
subject.blood_line.should == "Brutor"
|
15
|
+
subject.gender.should == "Female"
|
16
|
+
subject.corporation_name.should == "corpexport Corp"
|
17
|
+
subject.corporation_id.should == 150337746
|
18
|
+
subject.clone_name.should == "Clone Grade Pi"
|
19
|
+
subject.clone_skill_points.should == 54600000
|
20
|
+
subject.balance.should == 190210393.87
|
21
|
+
subject.attribute_enhancers.intelligence_bonus.augmentator_name.should == "Snake Delta"
|
22
|
+
subject.attribute_enhancers.intelligence_bonus.augmentator_value.should == 3
|
23
|
+
subject.attribute_enhancers.memory_bonus.augmentator_name.should == "Memory Augmentation - Basic"
|
24
|
+
subject.attribute_enhancers.memory_bonus.augmentator_value.should == 3
|
25
|
+
subject.attributes.intelligence.should == 6
|
26
|
+
subject.attributes.memory.should == 4
|
27
|
+
subject.attributes.charisma.should == 7
|
28
|
+
subject.attributes.perception.should == 12
|
29
|
+
subject.attributes.willpower.should == 10
|
30
|
+
subject.skills.should behave_like_rowset('typeID,skillpoints,level,unpublished') { |row|
|
31
|
+
row.should respond_to(:type_id)
|
32
|
+
row.should respond_to(:skillpoints)
|
33
|
+
row.should respond_to(:level)
|
34
|
+
row.should respond_to(:unpublished)
|
35
|
+
}
|
36
|
+
subject.certificates.should behave_like_rowset('certificateID')
|
37
|
+
subject.corporation_roles.should behave_like_rowset('roleID,roleName')
|
38
|
+
subject.corporation_roles_at_hq.should behave_like_rowset('roleID,roleName')
|
39
|
+
subject.corporation_roles_at_base.should behave_like_rowset('roleID,roleName')
|
40
|
+
subject.corporation_roles_at_other.should behave_like_rowset('roleID,roleName')
|
41
|
+
subject.corporation_titles.should behave_like_rowset('titleID,titleName')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "without an api key" do
|
46
|
+
it "should raise an ArgumentError" do
|
47
|
+
proc { mock_service('character', 'character_sheet') }.should raise_error(ArgumentError)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|