sauce_whisk 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 580cc7466c29d1ed8d8504c6afb3cb80354884c8
4
- data.tar.gz: 043b5e0f5b53be3599349913b0d8926e0abc95aa
3
+ metadata.gz: 5bcdd67ee4587647ee4a6d20b5bac89a50d09a25
4
+ data.tar.gz: 73fb38fbc95b357c5edcf37c759ae505cbc1ba71
5
5
  SHA512:
6
- metadata.gz: 54942e8ed65c2c4a7e1f82848ba1cb06c080c20e2427b9b78019acc833cfabb700a2a81df1ce3d54b6956aef46c4c52d9cb97e045b800e3b9467d195f4a838ef
7
- data.tar.gz: 4c2dc81b0a7a7281bb926006f43e9ecb7d4fb0ab7d652d78da16e7f4b2fd48e41b1b9c2d838015e89270bb63080af0ecb5a1cdc9f13f103bd2c1bddc64431f51
6
+ metadata.gz: 42717f223ac6ead17b8e3d9542436e436204a2bbe6df622ca05f340fd63450b9b90e01c5e331495840e09df49038d72cfe075942ba0e946bf53fe4a8b600d097
7
+ data.tar.gz: 997b70fc0e41c91a9b4a415de955be01450d242bdf8101b054e9278bec541c5f20a531acadda37fd04d1b7e0607a95cece67f56c35a9f6d123297c359f4ddd21
data/.travis.yml CHANGED
@@ -2,4 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.1
5
+ - 2.1.1
6
+ before_install:
7
+ - gem install bundler
data/Rakefile CHANGED
@@ -2,10 +2,14 @@ require 'rspec/core/rake_task'
2
2
 
3
3
  Bundler::GemHelper.install_tasks
4
4
 
5
- RSpec::Core::RakeTask.new(:spec)
5
+ begin
6
+ RSpec::Core::RakeTask.new(:spec)
6
7
 
7
- # If these are nil then the tests will fail
8
- ENV['SAUCE_USERNAME'] ||= 'test_user'
9
- ENV['SAUCE_ACCESS_KEY'] ||= 'test_key'
8
+ # If these are nil then the tests will fail
9
+ ENV['SAUCE_USERNAME'] ||= 'test_user'
10
+ ENV['SAUCE_ACCESS_KEY'] ||= 'test_key'
10
11
 
11
- task :default => :spec
12
+ task :default => :spec
13
+ rescue LoadError
14
+ # No Rspec here
15
+ end
data/changelog.markdown CHANGED
@@ -1,4 +1,8 @@
1
1
  # Major Version 0
2
+ ###
3
+ * ArgumentError will now be thrown if the gem can't find a Username or Access Key
4
+ * Jobs.fetch no longer swallows RestClient errors _unless_ specifically caused by a job not being finished.
5
+
2
6
  ### 0.0.19
3
7
  * You can now configure SauceWhisk.username and SauceWhisk.access_key. These values override all other configuration settings
4
8
  * Removed Content-Type header from PUT commands as per documentation
@@ -0,0 +1,50 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This Code of Conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at [INSERT EMAIL ADDRESS]. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+
45
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
46
+ version 1.3.0, available at
47
+ [http://contributor-covenant.org/version/1/3/0/][version]
48
+
49
+ [homepage]: http://contributor-covenant.org
50
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/lib/sauce_whisk.rb CHANGED
@@ -26,11 +26,15 @@ module SauceWhisk
26
26
  end
27
27
 
28
28
  def self.username
29
- return self.load_first_found(:username)
29
+ configured_username = self.load_first_found(:username)
30
+ return configured_username unless configured_username.nil? || configured_username.empty?
31
+ raise ::ArgumentError.new "Couldn't find Username in Sauce::Config, yaml file or Environment Variables"
30
32
  end
31
33
 
32
34
  def self.password
33
- return self.load_first_found(:access_key)
35
+ configured_key = self.load_first_found(:access_key)
36
+ return configured_key unless configured_key.nil? || configured_key.empty?
37
+ raise ::ArgumentError.new "Couldn't find Access Key in Sauce::Config, yaml file or Environment Variables"
34
38
  end
35
39
 
36
40
  def self.asset_fetch_retries=(retries)
@@ -31,7 +31,11 @@ module SauceWhisk
31
31
 
32
32
  def self.save(job)
33
33
  fields_to_save = job.updated_fields.each_with_object(Hash.new) do |field, hsh|
34
- hsh[field] = job.send(field.to_s)
34
+ if field == :custom_data
35
+ hsh[:'custom-data'] = job.send(field.to_s)
36
+ else
37
+ hsh[field] = job.send(field.to_s)
38
+ end
35
39
  end
36
40
  put job.id, fields_to_save.to_json
37
41
  end
@@ -70,8 +74,13 @@ module SauceWhisk
70
74
  screenshots = assets["screenshots"]
71
75
 
72
76
  {"screenshot_urls" => screenshots}
73
- rescue RestClient::BadRequest
74
- raise SauceWhisk::JobNotComplete
77
+ rescue RestClient::BadRequest => e
78
+ SauceWhisk.logger.debug("Exception fetching assets: #{e}")
79
+ if (/Job hasn't finished running/.match e.response)
80
+ raise SauceWhisk::JobNotComplete
81
+ else
82
+ raise e
83
+ end
75
84
  end
76
85
  end
77
86
 
@@ -1,3 +1,3 @@
1
1
  module SauceWhisk
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
@@ -62,6 +62,15 @@ describe SauceWhisk::Jobs do
62
62
  expected_body = {:name => "Updated Name"}.to_json
63
63
  assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/#{user}/jobs/#{job.id}", :body => expected_body
64
64
  end
65
+
66
+ it "sends custom-data with hyphen", :focus => true do
67
+ job_id = "bd9c43dd6b5549f1b942d1d581d98cac"
68
+ job = SauceWhisk::Job.new({:id => job_id})
69
+ job.custom_data = {:key => "value"}
70
+ SauceWhisk::Jobs.save (job)
71
+ expected_body = {:'custom-data' => {:key => "value"}}.to_json
72
+ assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/#{user}/jobs/#{job.id}", :body => expected_body
73
+ end
65
74
  end
66
75
 
67
76
  describe "##fetch", :vcr => {:cassette_name => "jobs"} do
@@ -10,11 +10,41 @@ describe SauceWhisk do
10
10
  describe "##username" do
11
11
  subject {SauceWhisk.username}
12
12
  it {should eq ENV["SAUCE_USERNAME"]}
13
+
14
+ describe "when empty" do
15
+ subject {lambda {SauceWhisk.username}}
16
+
17
+ around do |spec|
18
+ @un = ENV["SAUCE_USERNAME"]
19
+ ENV.delete "SAUCE_USERNAME"
20
+
21
+ spec.run
22
+
23
+ ENV["SAUCE_USERNAME"] = @un
24
+ end
25
+
26
+ it {is_expected.to raise_exception}
27
+ end
13
28
  end
14
29
 
15
30
  describe "##password" do
16
31
  subject {SauceWhisk.password}
17
32
  it {should eq ENV["SAUCE_ACCESS_KEY"]}
33
+
34
+ describe "when empty" do
35
+ subject {lambda {SauceWhisk.password}}
36
+
37
+ around do |spec|
38
+ @pw = ENV["SAUCE_ACCESS_KEY"]
39
+ ENV.delete "SAUCE_ACCESS_KEY"
40
+
41
+ spec.run
42
+
43
+ ENV["SAUCE_ACCESS_KEY"] = @pw
44
+ end
45
+
46
+ it {is_expected.to raise_exception}
47
+ end
18
48
  end
19
49
 
20
50
  describe "##pass_job" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sauce_whisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Lacey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-22 00:00:00.000000000 Z
11
+ date: 2016-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -111,6 +111,7 @@ files:
111
111
  - README.md
112
112
  - Rakefile
113
113
  - changelog.markdown
114
+ - code_of_conduct.markdown
114
115
  - lib/sauce-whisk.rb
115
116
  - lib/sauce_whisk.rb
116
117
  - lib/sauce_whisk/accounts.rb