This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'oauth' | |
consumer_key = '...' # from SalesForce | |
consumer_secret = '...' # from SalesForce | |
oauth_options = { | |
:site => 'https://login.salesforce.com', | |
:scheme => :body, | |
:request_token_path => '/_nc_external/system/security/oauth/RequestTokenHandler', | |
:authorize_path => '/setup/secur/RemoteAccessAuthorizationPage.apexp', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To turn it off | |
old_logger = ActiveRecord::Base.logger | |
ActiveRecord::Base.logger = nil | |
#To turn it back on | |
ActiveRecord::Base.logger = old_logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.time_zone #ActiveRecord fetches the UTC time from the database and converts it to the time zone in | |
DateTime #if you need support for times very far from the present | |
# Good practices | |
2.hours.ago # => Thu, 27 Aug 2015 14:39:36 AFT +04:30 | |
1.day.from_now # => Fri, 28 Aug 2015 16:39:36 AFT +04:30 | |
Time.zone.parse("2015-08-27T12:09:36Z") # => Thu, 27 Aug 2015 16:39:36 AFT +04:30 | |
Time.current # => Thu, 27 Aug 2015 16:39:36 AFT +04:30 | |
Time.current.utc.iso8601 # When supliyng an API ("2015-08-27T12:09:36Z") |