Instantly share code, notes, and snippets.

View Exam.md

JEP Exam Rubric

  • Gemfile entries
    • rubocop (under development)
    • rspec-rails (under development + test)
    • devise (outside of any group)
    • mongoid (outside of any group)
  • Generated Mongoid configuration present at config/mongoid.yml
  • Rubocop rules pass
  • db/seeds.rb
    • Creates a book
View spec and code
it 'has a method that will call the transaction class' do
Transaction.should_receive(:new);
bank.send(:make_deposit, 5);
end
def make_deposit(amount)
Transaction.new(self, 'deposit', amount);
end
View index.html.erb
<table>
<tr>
<th>Subject</th>
<th>Created At</th>
<th>Status</th>
</tr>
<% @tickets.each do |ticket| %>
<tr>
<td><a href="/ticket/<%= ticket.id %>"><%= ticket.subject %></a></td>
View file1.txt
String file contents
View file1.txt
String file contents
View part 2?
totalprice=0
totalitemcount=0
laborcharge=0
discount= 0
totalgccount=0
View gist:8125a3a8f6d88f73e6d6e7b4f4452820
require 'concurrent'
class Test
def update(time, value, reason)
puts "OMG"
end
end
puts 'testing . . .'
View no-if-factories.rb
FactoryBot.define do
factory :property, aliases: [:current_prop] do
is_active "true"
factory :nowhereland do
name "NowhereLand"
property_code 'nwlnd'
address "123 Nowhere Lane"
city "Erewhon"
state "Oblivion"
View read.rb
class ApiRead
require 'open-uri'
require 'json'
attr_reader :data
def initialize(url)
# this goes fine
@data = JSON.parse(open(url).read)["data"]
end
View crova.rb
def kpi(campaigns)
{
unique_views: campaigns.sum(:unique_views),
clicks: campaigns.sum(:clicker),
sent: campaigns.sum(:sent),
turnover: campaigns.sum(:turnover),
cost: campaigns.sum(:cost),
margin: campaigns.sum(:margin),
active_sent: active_campaigns.sum(:sent),
active_margin: active_campaigns.sum(:margin),