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
class Animal | |
def initialize(name, age, color, type) | |
@name = name | |
@age = age | |
@color = color | |
@type = type | |
end | |
def describe | |
puts "This is #{@name}, he/she is #{@age}, is #{@color}, and is a #{@type}." |
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
class Dungeon | |
attr_accessor :player #Is this an instance variable? or a class variable? | |
def initialize(player_name) #Why is this here? | |
@player = Player.new(player_name) #What is this code doing? | |
@rooms = [] #Why is there an "@" before rooms? This isn't an instance variable is it? | |
end | |
def add_room (reference, name, description, connections) | |
@rooms << Room.new(reference, name, description, connections) |
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
class Dungeon | |
attr_accessor :player #Is this an instance variable? or a class variable? | |
def initialize(player_name) #Why is this here? | |
@player = Player.new(player_name) #What is this code doing? | |
@rooms = [] #Why is there an "@" before rooms? This isn't an instance variable is it? | |
end | |
def add_room (reference, name, description, connections) | |
@rooms << Room.new(reference, name, description, connections) |
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
class Dungeon | |
attr_accessor :player #Is this an instance variable? or a class variable? | |
def initialize(player_name) #Why is this here? | |
@player = Player.new(player_name) #What is this code doing? | |
@rooms = [] | |
end | |
def add_room (reference, name, description, connections) | |
@rooms << Room.new(reference, name, description, connections) |
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
class Caesar_Cipher | |
def initialize(string, shift) | |
@string = string | |
@shift = shift | |
@lowercase = ("a".."z") | |
@uppercase = ("A".."Z") | |
@output = [] | |
end | |
def letter_shift |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication4 | |
{ | |
class Program | |
{ |
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
Showing /home/ubuntu/workspace/app/views/tickets/show.html.erb where line #21 raised: | |
undefined method `email' for nil:NilClass | |
Extracted source (around line #21): | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 |
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
class TicketsController < ApplicationController | |
before action :validate_user, only: [:create, :new] | |
before_action :set_project | |
before_action :set_ticket, only: [:show, :edit, :update, :destroy] | |
def new | |
@ticket = @project.tickets.build | |
end | |
def destroy |
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
RSpec::Matchers.define :permit_action do |action| | |
match do |policy| | |
policy.public_send("#{action}?") | |
end | |
failure_message do |policy| | |
"#{policy.class} does not allow #{policy.user || "nil"} to " + | |
"perform :#{action}? on #{policy.record}." | |
end |
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 'rails_helper' | |
RSpec.describe "Administrators can create posts and enable user privileges" do | |
let(:admin) { FactoryGirl.create(:user, :admin) } | |
before do | |
login_as(admin) | |
visit '/' | |
end | |
OlderNewer