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
module Geocoder | |
module Lookup | |
class Base | |
private | |
def read_fixture(file) | |
File.read(File.join("spec", "fixtures", "geocoder", file)).strip.gsub(/\n\s*/, "") | |
end | |
end | |
class Google < Base |
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)) | |
=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 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
# not necessary in Rails | |
require 'cgi' | |
require 'openssl' | |
require 'open-uri' | |
# OPTIONS :force, :full_page, :thumb_width, :width, :height | |
def urlbox(url, options={}) | |
urlbox_apikey = 'xxx-xxx' | |
urlbox_secret = 'xxx-xxx' | |
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
belongs_to :gift | |
belongs_to :user |
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 consent | |
@user = current_user | |
if @user.update_attributes(params[:user])#this is really dangerous, I could force my email to change form the form =/ | |
redirect_to :back, notice: "Error updating your user account" | |
else | |
flash[:notice] = 'User information updated' | |
@cart.consent_updated = false | |
end | |
end |
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
if | |
@sentiment["mood"] == positive && @sentiment["prob"] > 0.94 | |
@tag.score = 100 | |
elsif | |
@sentiment["mood"] == positive && @sentiment["prob"] > 0.89 | |
@tag.score = 96 | |
elsif | |
@sentiment["mood"] == positive && @sentiment["prob"] > 0.84 | |
@tag.score = 92 | |
elsif |