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
| export EDITOR="mate -w" |
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
| recruiters_attributes: {'1234567' => attributes_for(:recruiter)}) |
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
| redirect_to action: :edit, id: @company.id, params: {tab: 'locations' } |
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
| UserMailer.job_apply_reject(job_apply).deliver | |
| expect(ActionMailer::Base.deliveries.last.encoded).to include 'Company Lorem ipsum' | |
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
| str = 'abc def ghi' | |
| m = /(abc) (?:def) (ghi)/.match str | |
| # m[0] -> abc | |
| # m[2] -> ghi |
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
| # Lookahead assertion | |
| str = "123 456. 789" | |
| m = /\d+(?=\.)/.match(str) # m[0] = '456'. Period doesn't count as a part of the match | |
| /\d+(?!\.)/ # negative lookahead | |
| # Lookbehind assertion | |
| str = "David BLACK" | |
| m = /(?<=David )BLACK/ # only match BLACK if it's preceded by 'David' | |
| /(?<!David) BLACK/ # negative lookbehind |
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
| # integration tests...some code | |
| save_and_open_page | |
| # integration tests...some code |
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 Timeline | |
| extend ActiveModel::Naming # it's better approach | |
| def initialize(user) | |
| @user = user | |
| end | |
| def to_partial_path | |
| 'path/to/partial' # but there is a better way(see above) |
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 FollowingRelationshipsController < ApplicationController | |
| def create | |
| current_user.follow user | |
| redirect_to user | |
| end | |
| def destroy | |
| current_user.unfollow user | |
| redirect_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
| # in spec_helper | |
| RSpec.configure do |config| do | |
| #other code | |
| config.include FactoryGirl::Syntax::Methods | |
| end |