This file contains hidden or 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)) | |
expect(page).to have_current_path(post_comments_path(post)) | |
# Clicking links and buttons | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click_on('Link Text') # clicks on either links or buttons |
This file contains hidden or 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
class Customer | |
include Math | |
EARTH_RADIUS = 6371 # Earth Radius in km | |
attr_accessor :id, :name, :latitude, :longitude | |
def initialize(params) | |
@id = params["user_id"] | |
@name = params["name"] |
This file contains hidden or 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
def flatten(array) | |
return "Input must be an array" if !array.kind_of?(Array) | |
array.reduce([]) do |res, el| | |
Array === el ? res + flatten(el) : res << el | |
end | |
end |
NewerOlder