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
| function! RenameFile() | |
| let old_name = expand('%') | |
| let new_name = input('New file name: ', expand('%'), 'file') | |
| if new_name != '' && new_name != old_name | |
| exec ':saveas ' . new_name | |
| exec ':silent !rm ' . old_name | |
| redraw! | |
| endif | |
| endfunction |
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 Television < ActiveModel | |
| def turned_off? | |
| !turned_on | |
| end | |
| end | |
| class TelevisionRemote | |
| attr_reader :television | |
| def initialize(television) |
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 DropSubscriptionRewards < ActiveRecord::Migration[5.2] | |
| def up | |
| subscription_rewards = ActiveRecord::Base.connection.select_all("select * from subscription_rewards") | |
| subscription_rewards.each do |subscription_reward| | |
| MissionReward.create!( | |
| subscription_mission_id: subscription_reward["subscription_mission_id"], | |
| reward_id: subscription_reward["reward_id"], | |
| starts_at: subscription_reward["created_at"], | |
| ends_at: subscription_reward["expires_at"], | |
| redeemed_at: subscription_reward["redeemed_at"] |
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 DropSubscriptionRewards < ActiveRecord::Migration[5.2] | |
| def up | |
| subscription_rewards = ActiveRecord::Base.connection.select_all("select * from subscription_rewards") | |
| subscription_rewards.each do |subscription_reward| | |
| MissionReward.create!( | |
| subscription_mission_id: subscription_reward["subscription_mission_id"], | |
| reward_id: subscription_reward["reward_id"], | |
| starts_at: subscription_reward["created_at"], | |
| ends_at: subscription_reward["expires_at"], | |
| redeemed_at: subscription_reward["redeemed_at"] |
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 DropSubscriptionRewards < ActiveRecord::Migration[5.2] | |
| def up | |
| subscription_rewards = SubscriptionReward.all | |
| subscription_rewards.each do |subscription_reward| | |
| MissionReward.create!( | |
| subscription_mission_id: subscription_reward.subscription_mission_id, | |
| reward_id: subscription_reward.reward_id, | |
| starts_at: subscription_reward.created_at, | |
| ends_at: subscription_reward.expires_at, | |
| redeemed_at: subscription_reward.redeemed_at |
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 DropSubscriptionRewards < ActiveRecord::Migration[5.2] | |
| def up | |
| subscription_rewards = SubscriptionReward.all | |
| subscription_rewards.each do |subscription_reward| | |
| MissionReward.create!( | |
| subscription_mission_id: subscription_reward["subscription_mission_id"], | |
| reward_id: subscription_reward["reward_id"], | |
| starts_at: subscription_reward["created_at"], | |
| ends_at: subscription_reward["expires_at"], | |
| redeemed_at: subscription_reward["redeemed_at"] |
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
| unlet! skip_defaults_vim | |
| source $VIMRUNTIME/defaults.vim | |
| filetype indent on | |
| set backspace=indent,eol,start | |
| set number | |
| set nobackup | |
| set noswapfile | |
| autocmd! |
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
| require "rails_helper" | |
| RSpec.describe User, type: :model do | |
| it { should have_many(:books) } | |
| it "has many books" do | |
| expect(User).to have_many(:books) | |
| 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
| require "rails_helper" | |
| RSpec.describe User, type: :model do | |
| it { should have_many(:books) } | |
| it "has many books" do | |
| expect(User).to have_many(:books) | |
| 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
| RSpec::Matchers.define :have_many do |expected| | |
| match do |actual| | |
| if actual.respond_to?(:reflect_on_association) | |
| actual.reflect_on_association(expected)&.macro == :has_many | |
| else | |
| actual.class.reflect_on_association(expected)&.macro == :has_many | |
| end | |
| end | |
| end |