Skip to content
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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

mark-smithtb
Copy link

  • 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.

@stevenpetryk
Copy link
Collaborator

Whoa.

uri: https://home.nest.com/user/login
body:
encoding: UTF-8
string: username=msmith46234%40yahoo.com&password=Tuathadea1!
Copy link
Owner

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

@ericboehs
Copy link
Owner

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'

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: 'test@yahoo.com', password: 'sekret', temperature_scale: :fahrenheit)

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"

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 ||.

@ericboehs
Copy link
Owner

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))

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.

'Accept-Language' => 'en-us',
'Connection' => 'keep-alive',
'Accept' => '*/*'
"Host" => self.transport_host,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant self detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants