hockeyapp 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,77 @@
1
+ require_relative '../support/rspec_helper'
2
+
3
+ describe HockeyApp::Crash do
4
+
5
+ before :each do
6
+
7
+ h = {
8
+ "os_version" => "2.2.1",
9
+ "oem" => "Samsung",
10
+ "created_at" => "2011-12-15T20:06:49Z",
11
+ "crash_reason_id" => 135837,
12
+ "app_version_id" => 2,
13
+ "app_id" => 2505,
14
+ "has_log" => true,
15
+ "bundle_version" => "2",
16
+ "id" => 5511786,
17
+ "has_description" => true,
18
+ "bundle_short_version" => "0.2",
19
+ "contact_string" => "",
20
+ "jail_break" => nil,
21
+ "updated_at" => "2011-12-15T20:06:53Z",
22
+ "user_string" => "",
23
+ "model" => "GT-S5830"
24
+ }
25
+ @client = HockeyApp::Client.new(HockeyApp::FakeWS.new)
26
+ @app = HockeyApp::App.from_hash( {"public_identifier" => "91423bc5519dd2462513abbb54598959"}, @client)
27
+ @crash = HockeyApp::Crash.from_hash h, @app, @client
28
+ @model = @crash
29
+ end
30
+
31
+ it_behaves_like "ActiveModel"
32
+
33
+ it "can give me info about the crash" do
34
+ @crash.os_version.should == "2.2.1"
35
+ @crash.oem.should == "Samsung"
36
+ @crash.created_at.should == "2011-12-15T20:06:49Z"
37
+ @crash.crash_reason_id.should == 135837
38
+ @crash.app_version_id.should == 2
39
+ @crash.app_id.should == 2505
40
+ @crash.has_log.should be_true
41
+ @crash.bundle_version.should == "2"
42
+ @crash.id.should == 5511786
43
+ @crash.has_description.should be_true
44
+ @crash.bundle_short_version.should == "0.2"
45
+ @crash.contact_string.should == ""
46
+ @crash.jail_break.should be_nil
47
+ @crash.updated_at.should == "2011-12-15T20:06:53Z"
48
+ @crash.user_string.should == ""
49
+ @crash.model.should == "GT-S5830"
50
+ end
51
+
52
+
53
+ it "will call client when asked for log" do
54
+ @client.should_receive(:get_crash_log).with(@crash)
55
+ @crash.log
56
+ end
57
+
58
+ it "should not call client for log if it is not supposed to have a log" do
59
+ @crash.has_log = false
60
+ @client.should_not_receive(:get_crash_log)
61
+ @crash.log
62
+ end
63
+
64
+ it "will call client when asked for description" do
65
+ @client.should_receive(:get_crash_description).with(@crash)
66
+ @crash.description
67
+ end
68
+
69
+ it "will not call for description if it is not supposed to have a description" do
70
+ @crash.has_description = false
71
+ @client.should_not_receive(:get_crash_description)
72
+ @crash.description
73
+ end
74
+
75
+
76
+ end
77
+
@@ -0,0 +1,85 @@
1
+ require_relative '../../spec/support/rspec_helper'
2
+
3
+
4
+ describe HockeyApp::Version do
5
+
6
+ before :each do
7
+ @h = {
8
+ "id" => 7,
9
+ "notes" => "<p>Pre-rolls management</p>",
10
+ "shortversion" => "0.9",
11
+ "version" => "9",
12
+
13
+ "timestamp" => 1326468169,
14
+ "appsize" => 396074,
15
+ "title" => "Test App",
16
+ "download_url" => "https://rink.hockeyapp.net/apps/91423bc5519dd2462513abbb54598959/app_versions/7"
17
+ }
18
+
19
+ @client = HockeyApp::Client.new(HockeyApp::FakeWS.new)
20
+ @app = HockeyApp::App.from_hash( {"public_identifier" => "91423bc5519dd2462513abbb54598959"}, @client)
21
+ @version = HockeyApp::Version.from_hash @h, @app, @client
22
+ @model = @version
23
+ end
24
+
25
+ subject{@version}
26
+
27
+ it_behaves_like "ActiveModel"
28
+
29
+ it "can give me info about the version" do
30
+ @version.notes.should == "<p>Pre-rolls management</p>"
31
+ @version.shortversion.should == "0.9"
32
+ @version.version.should == "9"
33
+ @version.id.should == 7
34
+ @version.timestamp.should == 1326468169
35
+ @version.appsize.should == 396074
36
+ @version.title.should == "Test App"
37
+ @version.download_url.should == "https://rink.hockeyapp.net/apps/91423bc5519dd2462513abbb54598959/app_versions/7"
38
+
39
+ end
40
+
41
+ it "calls client once when asked for crashes" do
42
+ @client.should_receive(:get_crashes).with(@app).and_return([])
43
+ @version.crashes
44
+ @client.should_not_receive(:get_crashes).with(@app)
45
+ @version.crashes
46
+ end
47
+
48
+ it "calls client once when asked for crash groups" do
49
+ @client.should_receive(:get_crash_groups).with(@app).and_return([])
50
+ @version.crash_reasons
51
+ @client.should_not_receive(:get_crash_groups).with(@app)
52
+ @version.crash_reasons
53
+ end
54
+
55
+
56
+
57
+ it "can generate a direct download url for iOS" do
58
+ @app.platform= "iOS"
59
+ @version = HockeyApp::Version.from_hash @h, @app, @client
60
+ @version.direct_download_url.should == "https://rink.hockeyapp.net/api/2/apps/91423bc5519dd2462513abbb54598959/app_versions/7?format=ipa"
61
+ end
62
+
63
+ it "can generate an install url for Android" do
64
+ @app.platform = "Android"
65
+ @version = HockeyApp::Version.from_hash @h, @app, @client
66
+ @version.direct_download_url.should == "https://rink.hockeyapp.net/api/2/apps/91423bc5519dd2462513abbb54598959/app_versions/7?format=apk"
67
+ end
68
+
69
+ it "can generate an install url for iOS" do
70
+ @app.platform= "iOS"
71
+ @version = HockeyApp::Version.from_hash @h, @app, @client
72
+ @version.install_url.should == "itms-services://?action=download-manifest&url=https%3A%2F%2Frink.hockeyapp.net%2Fapi%2F2%2Fapps%2F91423bc5519dd2462513abbb54598959%2Fapp_versions%2F7%3Fformat%3Dplist"
73
+ end
74
+
75
+ it "can generate an install url for Android" do
76
+ @app.platform = "Android"
77
+ @version = HockeyApp::Version.from_hash @h, @app, @client
78
+ @version.install_url.should == @version.direct_download_url
79
+ end
80
+
81
+
82
+
83
+
84
+ end
85
+
@@ -0,0 +1,19 @@
1
+ # adapted from rspec-rails http://github.com/rspec/rspec-rails/blob/master/spec/rspec/rails/mocks/mock_model_spec.rb
2
+ # put this in a file in your spec/support directory
3
+ # USAGE:
4
+ #
5
+ # let(:model) { ModelUnderTest.new(params) }
6
+ # it_behaves_like "ActiveModel"
7
+
8
+ shared_examples_for "ActiveModel" do
9
+ require 'test/unit/assertions'
10
+ require 'active_model/lint'
11
+ include Test::Unit::Assertions
12
+ include ActiveModel::Lint::Tests
13
+
14
+ ActiveModel::Lint::Tests.public_instance_methods.map { |method| method.to_s }.grep(/^test/).each do |method|
15
+ example(method.gsub('_', ' ')) {
16
+ send method
17
+ }
18
+ end
19
+ end
@@ -0,0 +1,54 @@
1
+ require 'multi_json'
2
+ module HockeyApp
3
+ class FakeWS
4
+
5
+ def get_apps
6
+ respond "apps"
7
+ end
8
+
9
+ def get_crashes app_id, options = {}
10
+ respond "crashes"
11
+ end
12
+
13
+ def get_crash_groups app_id, options = {}
14
+ respond "crash_groups"
15
+ end
16
+
17
+ def get_versions app_id, options = {}
18
+ respond "app_versions"
19
+ end
20
+
21
+
22
+ def get_crash_description app_id, options = {}
23
+ return "crash_description"
24
+ end
25
+
26
+ def get_crash_log app_id, options = {}
27
+ return "crash_log"
28
+ end
29
+
30
+ def post_new_version app_id, ipa, dsym=nil, notes=nil, notes_type=nil, notify=nil, status=nil
31
+ respond "new_version"
32
+ end
33
+
34
+ def remove_app app_id
35
+ Struct.new(:code).new(200)
36
+ end
37
+
38
+ def post_new_app file_ipa
39
+ respond "new_app"
40
+ end
41
+
42
+
43
+
44
+
45
+ private
46
+
47
+ def respond response_name
48
+ response_file = File.expand_path("./responses/#{response_name}.json", File.dirname(__FILE__))
49
+ MultiJson.decode(File.read(response_file))
50
+ end
51
+
52
+
53
+ end
54
+ end
@@ -0,0 +1,83 @@
1
+ [
2
+ {
3
+ "mandatory":false,
4
+ "appsize":396074,
5
+ "notes":"<p>Pre-rolls management</p>",
6
+ "title":"HockeyApp",
7
+ "timestamp":1326468169,
8
+ "version":"9",
9
+ "shortversion":"0.9"
10
+ },
11
+ {
12
+ "mandatory":false,
13
+ "appsize":355744,
14
+ "notes":"<p>The cover flow images are not the same for every image. This version specify a smaller zoom size to see if the cover flow looks better. Not quite that <span class=\"caps\">IMHO</span>.</p>",
15
+ "title":"HockeyApp",
16
+ "timestamp":1325597871,
17
+ "version":"8",
18
+ "shortversion":"0.8"
19
+ },
20
+ {
21
+ "mandatory":false,
22
+ "appsize":355758,
23
+ "notes":"<p>Fix dutch typo errors</p>",
24
+ "title":"HockeyApp",
25
+ "timestamp":1325597844,
26
+ "version":"7",
27
+ "shortversion":"0.7"
28
+ },
29
+ {
30
+ "mandatory":false,
31
+ "appsize":355724,
32
+ "notes":"<p>Add dutch and french languages<br />\nadd black background to lists and grids</p>",
33
+ "title":"HockeyApp",
34
+ "timestamp":1325597844,
35
+ "version":"6",
36
+ "shortversion":"0.6"
37
+ },
38
+ {
39
+ "mandatory":false,
40
+ "appsize":353289,
41
+ "notes":"<p>- Enhanced view for the tablets<br />\n- Connectivity checks on every request<br />\n- Fix a bug where 2 requests were sent at the same time.</p>",
42
+ "title":"HockeyApp",
43
+ "timestamp":1325597821,
44
+ "version":"5",
45
+ "shortversion":"0.5"
46
+ },
47
+ {
48
+ "mandatory":false,
49
+ "appsize":352416,
50
+ "notes":"<p>- Fix a visual text showed in the action bars</p>",
51
+ "title":"HockeyApp",
52
+ "timestamp":1325597809,
53
+ "version":"4",
54
+ "shortversion":"0.4"
55
+ },
56
+ {
57
+ "mandatory":false,
58
+ "appsize":352373,
59
+ "notes":"<p>- Check connectivity on start up only.<br />\n- Set loaders to show loading statuses.</p>",
60
+ "title":"HockeyApp",
61
+ "timestamp":1325597809,
62
+ "version":"3",
63
+ "shortversion":"0.3"
64
+ },
65
+ {
66
+ "mandatory":false,
67
+ "appsize":349035,
68
+ "notes":"<p>Test of update of the app</p>",
69
+ "title":"HockeyApp",
70
+ "timestamp":1325597802,
71
+ "version":"2",
72
+ "shortversion":"0.2"
73
+ },
74
+ {
75
+ "mandatory":false,
76
+ "appsize":349029,
77
+ "notes":"<p>Beta test version, including the search function.<br />\nTesting hockeyapp platform as well.</p>",
78
+ "title":"HockeyApp",
79
+ "timestamp":1325597802,
80
+ "version":"1",
81
+ "shortversion":"0.1"
82
+ }
83
+ ]
@@ -0,0 +1,34 @@
1
+ {
2
+ "app_versions":[
3
+ {
4
+ "id": 208,
5
+ "version":"208",
6
+ "mandatory":false,
7
+ "config_url":"https://rink.hockeyapp.net/manage/apps/1266/app_versions/208",
8
+ "download_url": "https://rink.hockeyapp.net/apps/0873e2b98ad046a92c170a243a8515f6/app_versions/208",
9
+ "timestamp":1326195742,
10
+ "appsize":157547,
11
+ "device_family":null,
12
+ "notes":"<p>Fixed bug when users could not sign in.</p>\n",
13
+ "status":2,
14
+ "shortversion":"1.1",
15
+ "minimum_os_version":null,
16
+ "title":"HockeyApp"
17
+ },
18
+ {
19
+ "id": 322,
20
+ "version":"195",
21
+ "mandatory":false,
22
+ "config_url":"https://rink.hockeyapp.net/manage/apps/1266/app_versions/195",
23
+ "timestamp":1325597848,
24
+ "appsize":157591,
25
+ "device_family":null,
26
+ "notes":"<ul>\n<li>Added action bar with native support for Android 3.x and 4.0.</li>\n<li>Added grid view on Android tablets.</li>\n<li>Added &quot;Check for Updates&quot; to menu.</li>\n<li>Changed layout of detail view.</li>\n<li>Updated HockeySDK + various bug fixes.</li>\n</ul>\n",
27
+ "status":1,
28
+ "shortversion":"1.1",
29
+ "minimum_os_version":null,
30
+ "title":"HockeyApp"
31
+ }
32
+ ],
33
+ "status":"success"
34
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "apps": [
3
+ {
4
+ "title": "HockeyTest",
5
+ "bundle_identifier": "de.codenauts.hockeytest.beta",
6
+ "public_identifier": "1234567890abcdef1234567890abcdef",
7
+ "device_family": "iPhone/iPod",
8
+ "minimum_os_version": "4.0",
9
+ "release_type": 0,
10
+ "status": 2,
11
+ "platform": "iOS"
12
+ },
13
+ {
14
+ "title": "HockeyTest",
15
+ "bundle_identifier": "de.codenauts.hockeytest",
16
+ "public_identifier": "34567890abcdef1234567890abcdef12",
17
+ "release_type": 1,
18
+ "platform": "iOS"
19
+ }
20
+ ],
21
+ "status": "success"
22
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "crash_reasons": [
3
+ {
4
+ "id": 456,
5
+ "number_of_crashes": 948,
6
+ "created_at": "2011-10-18T16:59:03Z",
7
+ "last_crash_at": "2011-10-19T19:35:02Z",
8
+ "updated_at": "2011-10-19T19:38:10Z",
9
+ "fixed": true,
10
+ "file":"main.m",
11
+ "class": "-",
12
+ "method": "main",
13
+ "line": "5",
14
+ "app_id": 123,
15
+ "app_version_id": 91,
16
+ "bundle_short_version": "1.0",
17
+ "bundle_version":"90",
18
+ "reason": "*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 1. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (0), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted).'"
19
+ },
20
+ {
21
+ "id": 457,
22
+ "number_of_crashes": 123,
23
+ "created_at": "2011-10-18T16:59:03Z",
24
+ "last_crash_at": "2011-10-19T19:35:02Z",
25
+ "updated_at": "2011-10-19T19:38:10Z",
26
+ "fixed": false,
27
+ "file":"main.m",
28
+ "class": "-",
29
+ "method": "main",
30
+ "line": "5",
31
+ "app_id": 123,
32
+ "app_version_id": 91,
33
+ "bundle_short_version": "1.0",
34
+ "bundle_version":"90",
35
+ "reason": "Some other error message"
36
+ }
37
+ ],
38
+ "total_entries": 78,
39
+ "total_pages": 4,
40
+ "per_page": 25,
41
+ "status": "success",
42
+ "current_page": 1
43
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "crashes":[
3
+ {
4
+ "model":"iPhone3,1",
5
+ "has_log":true,
6
+ "oem":"Apple",
7
+ "created_at":"2011-05-02T12:08:10Z",
8
+ "updated_at":"2011-05-02T13:01:36Z",
9
+ "has_description":false,
10
+ "bundle_short_version":"1.0",
11
+ "id":9,
12
+ "app_id":123,
13
+ "app_version_id":456,
14
+ "crash_reason_id":789,
15
+ "bundle_version":"89",
16
+ "user_string":"",
17
+ "os_version":"4.3.2",
18
+ "jail_break":false,
19
+ "contact_string":""
20
+ },
21
+ {
22
+ "model":"iPhone3,1",
23
+ "has_log":true,
24
+ "oem":"Apple",
25
+ "created_at":"2011-05-02T12:08:10Z",
26
+ "updated_at":"2011-05-02T13:01:36Z",
27
+ "has_description":false,
28
+ "bundle_short_version":"1.0",
29
+ "id":9,
30
+ "app_id":123,
31
+ "app_version_id":456,
32
+ "crash_reason_id":789,
33
+ "bundle_version":"89",
34
+ "user_string":"",
35
+ "os_version":"4.3.2",
36
+ "jail_break":false,
37
+ "contact_string":""
38
+ }
39
+ ],
40
+ "total_entries":72,
41
+ "total_pages":3,
42
+ "per_page":25,
43
+ "status":"success",
44
+ "current_page":1
45
+ }