trackerific 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rspec +1 -2
- data/Gemfile +3 -22
- data/Gemfile.lock +33 -107
- data/README.rdoc +35 -61
- data/Rakefile +10 -36
- data/lib/trackerific/configuration.rb +3 -46
- data/lib/trackerific/details.rb +2 -71
- data/lib/trackerific/event.rb +5 -49
- data/lib/trackerific/services/base.rb +45 -0
- data/lib/trackerific/services/fedex.rb +75 -85
- data/lib/trackerific/services/mock_service.rb +43 -54
- data/lib/trackerific/services/ups.rb +94 -103
- data/lib/trackerific/services/usps.rb +182 -186
- data/lib/trackerific/services.rb +41 -0
- data/lib/trackerific/version.rb +3 -0
- data/lib/trackerific.rb +30 -73
- data/spec/fixtures/{fedex_error_response.xml → fedex/error.xml} +0 -0
- data/spec/fixtures/{fedex_success_response.xml → fedex/success.xml} +0 -0
- data/spec/fixtures/{ups_error_response.xml → ups/error.xml} +0 -0
- data/spec/fixtures/{ups_success_response.xml → ups/success.xml} +0 -0
- data/spec/fixtures/{usps_city_state_lookup_response.xml → usps/city_state_lookup.xml} +0 -0
- data/spec/fixtures/{usps_error_response.xml → usps/error.xml} +0 -0
- data/spec/fixtures/{usps_success_response.xml → usps/success.xml} +0 -0
- data/spec/lib/trackerific/configuration_spec.rb +8 -39
- data/spec/lib/trackerific/details_spec.rb +13 -78
- data/spec/lib/trackerific/error_spec.rb +1 -5
- data/spec/lib/trackerific/event_spec.rb +14 -43
- data/spec/lib/trackerific/services/base_spec.rb +13 -0
- data/spec/lib/trackerific/services/fedex_spec.rb +59 -62
- data/spec/lib/trackerific/services/mock_service_spec.rb +33 -46
- data/spec/lib/trackerific/services/ups_spec.rb +46 -66
- data/spec/lib/trackerific/services/usps_spec.rb +80 -94
- data/spec/lib/trackerific/services_spec.rb +37 -0
- data/spec/lib/trackerific/version_spec.rb +5 -0
- data/spec/lib/trackerific_spec.rb +15 -53
- data/spec/spec_helper.rb +2 -9
- data/spec/support/fixtures.rb +4 -18
- data/spec/support/test_services.rb +23 -0
- data/trackerific.gemspec +24 -102
- metadata +151 -185
- data/VERSION +0 -1
- data/changelog +0 -9
- data/examples/custom_service_spec.rb +0 -44
- data/lib/helpers/options_helper.rb +0 -23
- data/lib/trackerific/service.rb +0 -100
- data/spec/lib/helpers/options_helper_spec.rb +0 -82
- data/spec/lib/trackerific/service_spec.rb +0 -44
- data/spec/support/trackerific.rb +0 -21
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class TestServiceClass < Trackerific::Service
|
4
|
-
class << self
|
5
|
-
def required_parameters
|
6
|
-
[:required, :also_required]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
describe Trackerific::Service do
|
12
|
-
|
13
|
-
describe :required_parameters do
|
14
|
-
specify { Trackerific::Service.required_parameters.should be_kind_of Array }
|
15
|
-
end
|
16
|
-
|
17
|
-
describe :service_name do
|
18
|
-
specify { Trackerific::Service.service_name.should be_kind_of String }
|
19
|
-
end
|
20
|
-
|
21
|
-
context "with a new Trackerific::Service class that has required options" do
|
22
|
-
|
23
|
-
context "has all the required options" do
|
24
|
-
it "should be able to create a new instance" do
|
25
|
-
t = TestServiceClass.new(:required => true, :also_required => :yup)
|
26
|
-
t.should be_a TestServiceClass
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "is missing some required options" do
|
31
|
-
it "should raise an ArgumentError" do
|
32
|
-
lambda { TestServiceClass.new() }.should raise_error(ArgumentError)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "has an invalid option" do
|
37
|
-
it "should raise an ArgumentError" do
|
38
|
-
lambda { TestServiceClass.new(:unknown => :argument ) }.should raise_error(ArgumentError)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
data/spec/support/trackerific.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'rails'
|
2
|
-
|
3
|
-
require "action_controller/railtie"
|
4
|
-
require "action_mailer/railtie"
|
5
|
-
require "active_resource/railtie"
|
6
|
-
|
7
|
-
module Trackerific
|
8
|
-
# Provides a Rails application environment to use when running the specs
|
9
|
-
class Application < Rails::Application
|
10
|
-
config.encoding = 'utf-8'
|
11
|
-
end
|
12
|
-
|
13
|
-
Application.configure do
|
14
|
-
config.active_support.deprecation = :stderr
|
15
|
-
config.logger = Logger.new(STDOUT)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
puts "Loading Rails environment ..."
|
20
|
-
Rails.env = 'test'
|
21
|
-
Trackerific::Application.initialize!
|