-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Code: handles zero devices, tests with vcr, extracted duplicated code into private methods #29
base: master
Are you sure you want to change the base?
Conversation
mark-smithtb
commented
Nov 16, 2015
- pulled post to device out of temperature methods into a private method.
- refactored to only pull structor and device ids if they exist.
- Added vcr to record interactions with the nest api for testing.
- Added timecop to freeze time for sets away status test to work with vcr.
Whoa. |
uri: https://home.nest.com/user/login | ||
body: | ||
encoding: UTF-8 | ||
string: username=msmith46234%40yahoo.com&password=Tuathadea1! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to change your password. Also this shouldn't be in the repo. :D
Could we put the fixtures in /spec/fixtures instead of /fixtures? Side note: We should set up circleci (or travis) and hound on this project. |
end | ||
|
||
VCR.configure do |c| | ||
c.cassette_library_dir = 'fixtures/vcr_cassettes' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
||
expect(nest).not_to respond_to(:email) | ||
expect(nest).not_to respond_to(:password) | ||
@nest = Nest.new(email: '[email protected]', password: 'sekret', temperature_scale: :fahrenheit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [99/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@login_url = config[:login_url] || 'https://home.nest.com/user/login' | ||
@user_agent = config[:user_agent] ||'Nest/1.1.0.10 CFNetwork/548.0.4' | ||
@login_url = config[:login_url] || "https://home.nest.com/user/login" | ||
@user_agent = config[:user_agent] ||"Nest/1.1.0.10 CFNetwork/548.0.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator ||
.
Looks like a few more hound violations. Also, could you pull in master, circleci should be fixed. |
@@ -40,10 +49,13 @@ module NestThermostat | |||
end | |||
|
|||
it "sets away status" do | |||
# Freeze time so we always use the same time (makes VCR happy) | |||
Timecop.freeze(Time.local(2015, 10, 27, 10, 5, 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use Time.local
without zone. Use one of Time.zone.local
, Time.local.current
, Time.local.in_time_zone
, Time.local.utc
, Time.local.getlocal
, Time.local.iso8601
, Time.local.jisx0301
, Time.local.rfc3339
, Time.local.to_i
, Time.local.to_f
instead.
"pulling master in from upstream"
'Accept-Language' => 'en-us', | ||
'Connection' => 'keep-alive', | ||
'Accept' => '*/*' | ||
"Host" => self.transport_host, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant self
detected.