text
stringlengths
10
2.61M
class CreateVideos < ActiveRecord::Migration def change create_table :videos do |t| t.string :name t.text :description t.string :title t.string :longTitle t.integer :duration t.string :url t.string :ageGate t.string :classification t.string :subClassification ...
class Subscript < ApplicationRecord attr_accessor :blob before_save :save_file before_destroy :remove_file belongs_to :algorithm has_many :parent_script_dependencies, class_name: "SubscriptDependency", foreign_key: "parent_script_id" has_many :child_script_dependencies, class_name: "SubscriptDependency", fore...
# encoding: UTF-8 module CardHelper def card_progress content_tag :div, :id => "boxes_bar", :class => "progress large-12" do Box.order("position ASC").each do |box| box_cards_count = box.cards.where("suspended = ? AND archived = ?", false, false).count.to_f cards_count = Card.where("suspend...
class PersonMailer < ActionMailer::Base def welcome_email(person) recipients person.email from "mark.russell@nes.scot.nhs.uk" subject "NES Fellowships" sent_on Time.now body :person => person end end # recipients user.email
class User include Mongoid::Document include Mongoid::Timestamps extend Enumerize devise :database_authenticatable, :trackable SEXES = [:male, :female] before_save :ensure_authentication_token before_save :set_default_role #field :quick_save_id ## Database authenticatable field :email, ...
module Lolita module Components class Base attr_reader :parent def initialize(parent) @parent = parent end end end end
class House < ActiveRecord::Base has_many :students, dependent: :destroy validates(:name, presence: true) end
# Response wrapper for M2X client class M2X::Client::Response attr_reader :response def initialize(response) @response = response end def raw @response.body end def json @json ||= ::JSON.parse(raw) end def status @status ||= @response.code.to_i end def headers @headers ||= @...
class Radio < ApplicationRecord validates :user_id, presence: true validates :description, presence: true validates :audio, presence: true validates :title, presence: true belongs_to :user, optional: true mount_uploader :audio, AudioUploader has_many :favorites has_many :favorite_users, through: ...
class PasswordResetsController < ApplicationController before_action :get_user, only: [:edit, :update] before_action :valid_user, only: [:edit, :update] before_action :check_expiration, only: [:edit, :update] def new end def create @user = User.find_by(email: params[:password_reset][:email].downcase) ...
module CloudCapacitor class Configuration attr_reader :name, :mem, :price, :cpu, :category attr_accessor :size, :vm_type, :capacity_level def initialize(vm_type:, size:) @vm_type = vm_type @size = size @name = @vm_type.name end def name @vm_type.name end def ...
class CreateDogovors < ActiveRecord::Migration def change create_table :dogovors do |t| t.integer :user_id t.string :dognum t.string :dogdate t.timestamps end end end
class HumanPlayer attr_reader :name attr_accessor :mark def initialize(name) @name = name end def get_move puts "Where would you like to move?" pos = gets.chomp pos.split(", ").map { |el| el.to_i } end def display(board) puts "Col 0 1 2" board.grid.each_with_index do ...
require 'ctoa' require 'slack-ruby-client' class CTOA::Slack def client @client ||= ->() { Slack.configure do |config| config.token = ENV['SLACK_API_TOKEN'] end Slack::Web::Client.new }.call end def all_members @all_members ||= client.users_list.members end def send_dm...
require 'spec_helper' describe Petstore::Configuration do let(:config) { Petstore::Configuration.default } before(:each) do Petstore.configure do |c| c.host = 'petstore.swagger.io' c.base_path = 'v2' end end describe '#base_url' do it 'should have the default value' do expect(co...
class PortfoliosController < ApplicationController SUBTITLES = %w(angular ruby_on_rails).freeze before_action :load_portfolio_item, only: [:show, :edit, :update, :destroy] access all: [:index, :show, :list_by_subtitle], user: {except: [:new, :edit, :create, :update, :destroy, :sort]}, ...
class ActionController::Base def set_gettext_locale requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] session[:locale] = FastGettext.set_locale(requested_locale) end end
class Page < ApplicationRecord has_many :showrelations has_many :faqs, through: :showrelations end
require_relative '../survey' describe Survey do before :each do csv_file = "./test.csv" CSV.open(csv_file,"wb") do |csv| csv << [nil,nil,nil,"ratingquestion"] csv << [nil,nil,nil,"The Work"] csv << ["Email","Employ ID","Submitted_at","What is your favorite number?"] csv << ["test@exa...
class RenameTypeOnDeclaration < ActiveRecord::Migration def up rename_column :declarations, :type, :role end def down end end
=begin #qTest Manager API Version 8.6 - 9.1 #qTest Manager API Version 8.6 - 9.1 OpenAPI spec version: 8.6 - 9.1 Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module SwaggerClient class ProjectApi attr_accessor :api_client def initialize(api_client...
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
require 'nokogiri' require 'mechanize' require 'Prawn' SLIDE_URL = 'https://www.slideshare.net/ProfEdge/introduction-to-cloud-computing-23970527?qid=131b4102-e3b8-4b98-8523-21e4fe5040e6' # SLIDE_URL = 'https://www.slideshare.net/Agarwaljay/cloud-computing-simple-ppt-41561620?qid=131b4102-e3b8-4b98-8523-21e4fe5040e6&v=...
require 'spec_helper' describe "RecurlyConfig" do context "loading from YML" do it "should load traditional configuration from a YML file" do Recurly.configure_from_yaml("#{File.dirname(__FILE__)}/../config/test1.yml") Recurly.api_key.should == "asdf4jk31" Recurly.subdomain.should == "site1" ...
class StudentFeeTransfer def initialize(batch_id, transport=true, hostel=true) @batch = Batch.find_by_id(batch_id) @transport = transport @hostel = hostel end def transfer_fee_collections batch_students.each do |student| inspect_and_transfer_fees(student) end end private ...
require 'spec_helper' ENV['RACK_ENV'] = 'test' require './ostra_service' describe 'Ostra Service' do def app OstraService end def json(hash) MultiJson.dump(hash) end it "has a heartbeat" do allow(Time).to receive(:now).and_return('now') get '/heartbeat' expect(last_response.status).to ...
require 'rubygems' require 'sinatra/base' require 'active_record' require 'rabl' require 'active_support/core_ext' require 'active_support/inflector' require 'builder' require 'json' Dir.glob("./" + File.dirname(__FILE__) + '/model/*.rb') { |file| require file } Dir.glob("./" + File.dirname(__FILE__) + '/lib/**.rb') {...
class Appointment < ActiveRecord::Base has_many :patient_cases, :dependent => :nullify, :uniq => true belongs_to :trip default_scope :order => 'appointments.schedule_order' scope :with_n_cases, lambda {|n| {:joins => :patient_cases, :group => "patient_cases.appointment_id", :having => ["count(patient_cases.ap...
class FontNotoSansBalinese < Formula head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansBalinese-unhinted.zip", verified: "noto-website-2.storage.googleapis.com/" desc "Noto Sans Balinese" homepage "https://www.google.com/get/noto/#sans-bali" def install (share/"fonts").install "NotoSansBaline...
class Project < ActiveRecord::Base has_many :memberships has_many :users, through: :memberships has_many :invitations has_many :posts #custom methods to be used after @project #eg @project.memberships.first.user.email def creator memberships.first.user end def newest_member memberships.last.user end ...
class CategoryController < ApplicationController def index @categories = Category.all respond_to do |format| format.html # index.html.erb format.json { render :json => @categories } end end def new @category = Category.new respond_to do |format| format.html # addCategory.html.erb format.json ...
require 'rspec' # turn off the "old syntax" warnings RSpec.configure do |config| config.mock_with :rspec do |c| c.syntax = [:should, :expect] end config.expect_with :rspec do |c| c.syntax = [:should, :expect] end # to get coverage output in ./coverage/index.html say # # rspec -t cov # # o...
require 'rails_helper' describe UsersController, type: :controller do before do allow_any_instance_of(ApplicationController).to receive(:logged_in?).and_return(true) allow_any_instance_of(ApplicationController).to receive(:check_student).and_return(true) @user = FactoryBot.create(:user) @user_params ...
# Прямоугольный треугольник. # Программа запрашивает у пользователя 3 стороны треугольника и определяет, является ли треугольник прямоугольным, используя теорему Пифагора и выводит результат на экран. # Если треугольник является при этом равнобедренным (т.е. у него равны любые 2 стороны), то дополнительно выводится и...
class Arrival < ApplicationRecord belongs_to :item ## 入荷数と入荷日の記入を必須としている validates :arrival_count, presence: true validates :arrival_date, presence: true end
class Shipment < ActiveRecord::Base has_many :users, through: :user_shipments has_many :user_shipments has_many :offers # => Destroy associated user_shipments and offers upon being destroyed before_destroy :clean_database accepts_nested_attributes_for :user_shipments validates :origin, presence: :true ...
require_relative('../db/sql_runner') class Movie attr_reader :id, :name, :price def initialize(options) @id = options['id'].to_i if options['id'] @name = options['name'] @price = options['price'] end def customers() sql = "SELECT customers.* FROM customers INNER JOIN tick...
module ReuProgram class AdminController < ApplicationController before_action :authenticate_program_admin! layout 'admin' protected def authenticate_program_admin! if program_admin_signed_in? super else redirect_to new_program_admin_session_path end end end en...
class CreatePortfolioTechnology < ActiveRecord::Migration def up create_table :portfolios_technologies, id: false do |t| t.belongs_to :portfolio t.belongs_to :technology end end def down drop_table :portfolios_technologies end end
class LandDetailsSerializer < ApplicationSerializer attributes :id, :total_price, :square_meter_price, :acreage, :title, :description, :post_date, :slug, :address attribute :updated_at do |object| object.updated_at.strftime('%H:%M:%S %d-%m-%Y') end end
require 'rails_helper' RSpec.describe DailyReportsController, type: :controller do describe 'GET #index' do let!(:todo_tasks) { FactoryGirl.create_list(:task, 1, status: :todo) } let!(:doing_tasks) { FactoryGirl.create_list(:task, 2, status: :doing) } let!(:done_tasks) { FactoryGirl.create_list(:task, 3...
class Admin::BaseController < ApplicationController before_action :authenticate_admin private def authenticate_admin unless current_user.admin? flash[:alert] = "Not allow!" redirect_to root_path end end end
# frozen_string_literal: true class Printer def initialize(filtered_logs) @filtered_logs = filtered_logs end def print print_most_page_views print_most_unique_page_views end private attr_reader :filtered_logs def print_most_page_views puts 'Most page views:' result = filtered_logs...
class Tag < ActiveRecord::Base attr_accessible :tag has_many :joiners has_many :articles, :through => :joiners end
# frozen_string_literal: true module WasteExemptionsShared class ApplicationMailer < ActionMailer::Base add_template_helper(EmailHelper) default from: ->(_a) { no_reply_email_address } layout "default_mail" # Returns the mailer key for lookup in mails.yml, e.g. # "waste_exemptions_shared.enroll...
require 'spec_helper' require 'bosh/dev/upload_adapter' module Bosh::Dev describe UploadAdapter do let(:adapter) { UploadAdapter.new } let(:aws_access_key_id) { 'default fake access key' } let(:aws_secret_access_key) { 'default fake secret key' } let(:fog_storage) { Fog::Storage.new( provider...
class Micropost < ApplicationRecord DATA_TYPE = %i(content picture).freeze belongs_to :user delegate :name, to: :user, prefix: true has_one_attached :picture scope :order_desc, ->{order created_at: :desc} validates :user_id, presence: true validates :content, presence: true, length: {maximum: Settings...
class Passenger < ApplicationRecord before_save :downcase_email has_and_belongs_to_many :bookings has_many :flights, through: :bookings validates :first_name, presence:true, length: {maximum: 30} validates :last_name, presence: true, length: {maximum: 30} VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*...
class UsersController < ApplicationController before_action :authenticate_user! before_action :set_user def show end def invite User.invite!(:email => params[:invite][:email], :username => params[:invite][:username]) flash[:notice] = I18n.t('user.invite.invite_the_user') redirect_to @user end ...
placeholder :page do match /welcome/ do Crammer::Welcome::Page end match /sign in/ do Crammer::Users::SignIn::Page end end
require 'spec_helper' describe Slack::Connection do # ----------------------------------- # new # ----------------------------------- describe "#new" do context "with invalid parameters" do it "raises an exception when token is nil" do expect { Slack::Connection.new(nil) }....
require "application_system_test_case" class WeeklyMenusTest < ApplicationSystemTestCase setup do @weekly_menu = weekly_menus(:one) end test "visiting the index" do visit weekly_menus_url assert_selector "h1", text: "Weekly Menus" end test "creating a Weekly menu" do visit weekly_menus_url ...
# frozen_string_literal: true class HomeworksController < ApplicationController before_action :set_homework, only: %i[show edit update destroy] before_action :set_course before_action :set_subject def edit; end def create @homework = @course.homeworks.create(homework_params) respond_to do |format| ...
require 'benchmark' require 'matrix' require_relative 'fibonacci_matrix' require_relative 'phi_rational' # using the 2-dimensional matrix form to quickly generate large fibonacci numbers MATRIX = Matrix[[1,1],[1,0]] def matrix(n) return (MATRIX**(n - 1))[0, 0] end # same logic as above, but using the custom Fibonac...
require 'helper_frank' module Rdomino describe Db::Test do before { Rdomino.local } let(:db) { Rdomino[:test].with_fixtures } let(:person) { db.person } let(:frank) { db.find 'Frank' } it "#has model" do assert_kind_of Model, person assert_equal 3, db.documents.count e...
require 'optparse' require 'optparse/time' require 'ostruct' require 'pp' class Optparse CODES = %w(iso-2022-jp shift_jis euc-jp utf8 binary).freeze CODE_ALIASES = { 'jis' => 'iso-2022-jp', 'sjis' => 'shift_jis' }.freeze def self.parse(args) options = OpenStruct.new options.format = 'json' options.t...
control "V-72989" do title "PostgreSQL must implement NIST FIPS 140-2 validated cryptographic modules to generate and validate cryptographic hashes." desc "Use of weak or untested encryption algorithms undermines the purposes of utilizing encryption to protect data. The application must implement cryptograph...
class AppUtils def self.has_correct_format?(id) !!(/\A\d+\z/ =~ id) end end
# # Copyright:: Copyright (c) 2016 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
# ASSESSMENT 6: Rails Commenting Challenge # Add comments to the Rails Blog Post Challenge # Explain the purpose and functionality of the code directly below the 10 comment tags # FILE: app/controller/blog_posts_controller.rb # ---1)Controller, this is where you put the logic for interaction between user, views and...
class Belief < ApplicationRecord before_create :only_one_row private def only_one_row raise "You can create only one page info" if Belief.count > 0 end end
class FontOcr < Formula version "0.2" sha256 "39289c641520265ecedbade99f01600f316f8196ec57f71c8402d3ba09438666" url "https://osdn.dl.osdn.jp/tsukurimashou/56948/ocr-#{version}.zip", verified: "osdn.dl.osdn.jp/tsukurimashou/" desc "OCR" homepage "https://ansuz.sooke.bc.ca/page/fonts#ocra" def install par...
task :default => [:tests] desc 'run acceptance tests' task :tests => [:compile] do status = system 'stack test' raise "Backend tests failed" unless status pid = spawn("PORT=8080 stack exec stethoscope-exe", :out => 'spec/logs/server.out', :err => "spec/logs/server.err") Process.det...
class Site < ActiveRecord::Base belongs_to :communities_page, :class_name => 'Page', :foreign_key => :communities_page_id belongs_to :about_page, :class_name => 'Page', :foreign_key => :about_page_id has_one :podcast audited attr_protected :id validates :title, :presence => true validates :e...
class ChangeTypetoCategory < ActiveRecord::Migration[5.1] def change rename_column :groups, :type, :category end end
module CamaleonCms module Admin module CategoryHelper # build an array multiple with category items prefixed with - for each level # categories: collection of categories # level: internal iterator control # attrs: (Hash) extra params # max_level: (Integer) permit to stop iteration ...
# combining_arrays.rb # Write a method that takes two Arrays as arguments, and returns an Array that # contains all of the values from the argument Arrays. There should be no # duplication of values in the returned Array, even if there are duplicates in # the original Arrays. # Pseudo-code: # Data Structure: # input:...
#!/usr/bin/env ruby require 'gli' require 'pry' module KittenPlot module CLI include GLI::App extend self program_desc 'Outputs location coordinates for the images provided' subcommand_option_handling :normal arguments :strict version KittenPlot::VERSION require_relative '../lib/kitten...
#!/usr/bin/env ruby $:.unshift File.join(File.dirname(__FILE__), '..') require 'vehicle' require 'test/unit' require 'test/helper' require 'pp' class TestVehicle < Test::Unit::TestCase def setup @vehicle = Vehicle.new end test "Vehicle.rotate_right" do @vehicle.rotate_right(90) assert_equal(90, @v...
class CreateCollectionDiscounts < ActiveRecord::Migration def self.up create_table :collection_discounts do |t| t.integer :finance_fee_collection_id t.integer :fee_discount_id t.timestamps end end def self.down drop_table :collection_discounts end end
require './shared' include PointOps[:y_up] using PointOps[:y_up] instructions = File.read('day12.input').strip.lines.map do _1 =~ /^(\w)(\d+)$/ && [$1, $2.to_i] end # Part 1 pos = [0, 0] direction = RIGHT instructions.each do |action, value| case action when 'N' pos = pos.plus(UP.times(value)) when 'S' ...
# EXERCISE 1 class Stack def initialize @underlying_array = [] end def push(el) underlying_array.push(el) el end def pop underlying_array.pop end def peek underlying_array.last end private attr_reader :underlying_array end # EXERCISE 2 class Queue def initialize @u...
class Electee < ActiveRecord::Base belongs_to :user has_many :items def add_item_electee(p) item = items.where(product_id: p.id).first unless item item = self.items.build(product: p, price: p.price) end item.save end end
class CreateClassPattern < ActiveRecord::Migration[5.0] def change create_table :class_patterns do |t| t.belongs_to :course t.boolean :monday, default: false t.boolean :tuesday, default: false t.boolean :wednesday, default: false t.boolean :thursday, default: false t.boolean :f...
require "jike_captcha/version" require 'jike_captcha/engine' if Module.const_defined?('Rails') module Jike module Captcha CAPTCHA_ID_URL = 'http://api.jike.com/captcha/urls' CAPTCHA_IMAGE_URL = 'http://api.jike.com/captcha/images' CAPTCHA_VALIDATE_URL = 'http://api.jike.com/captcha/validation' # The...
require_relative '../spec_helper' describe 'user edits station' do it 'redirects to /new for a form' do city1 = City.create!(name: 'Denver') city1.stations.create(name: Faker::Cat.name, dock_count: Faker::Number.number(1), installation_date: '01/01/2017') visit('/stations/1') click_on('Edit') e...
require './shared' include PointOps[:y_down] using PointOps[:y_down] input = File.read('day20.input').strip sides = -> (grid) do x_min, x_max, y_min, y_max = grid.bounds left = (y_min..y_max).map { grid[x_min, _1] } top = (x_min..x_max).map { grid[_1, y_min] } right = (y_min..y_max).map { grid[x_max, _1] } ...
require 'rails_helper' RSpec.feature 'Sign In', type: :feature do given!(:user) { create(:user) } given(:wrong_email) { 'wrong@gmail.com' } given(:wrong_password) { 'wrongpass' } scenario 'normal sign in' do sign_in_with_factory(user) expect(current_path).to eq root_path end scenario 'informat em...
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :artist do name "MyString" email "helen@gmail.com" phone_no "4133203613" birthplace "MyString" art_style "MyString" end end
class Post < ActiveRecord::Base attr_accessible :content, :name, :title validates :name, presence: true validates :title, presence: true, length:{minimum: 5} end
=begin Test d'intégration de l'inscription d'un user @note : on conserve dans un fichier les identifiants des utilisateurs créés pour les détruire à la fin. =end require 'spec_helper' describe "Inscription d'un utilisateur" do before(:all) do TI::set_online TI::as_simple_user end describe "- Inscripti...
class V1::ApiController < ApplicationController before_filter :authenticate_user_from_token! def authenticate_user_from_token! @user = User.find_by_email(params[:email]) unless @user && Devise.secure_compare(@user.authentication_token, params[:authentication_token]) render_401(['unauthorized access']...
require_relative 'session' require_relative 'request' require_relative 'request_mixins' require_relative 'objectify' module Cardinal # Account information. module Account # Get yout account settings. def account_settings() get('/account/settings.json'){|data| data.include( Objecti...
class AddOwnerToIssue < ActiveRecord::Migration def change add_reference :issues, :owner, index: true end end
require 'rails_helper' RSpec.describe User, type: :model do before(:each) do @user = User.create!(name: Faker::Name.name, email: Faker::Internet.email, password: "12345678", password_confirmation: "12345678", status: true ) end context "creation" do it "check if you have been registered" do expect...
require 'pulse_ffi/bindings' require 'pulse_ffi/mainloop' module PulseFFI def self.mainloop(&run_callback) Mainloop.run(&run_callback) end end
require 'methadone' require 'pathname' require 'open4' module CueSnap class CLI include Methadone::Main include Methadone::CLILogging main do |mp3_file, cue_file| # no-numbers comes in false when it's set, I know, crazy. options[:no_numbers] = !options[:'no-numbers'] if options.has_key?(:'no...
require "spec_helper" describe Empty do it "has a version number" do expect(Empty::VERSION).not_to be nil end end
require_relative 'repository_command' require 'json' module Topicz::Commands class AlfredCommand < RepositoryCommand def initialize(config_file = nil, arguments = []) super(config_file) @identifiers = false @mode = :browse option_parser.order! arguments @filter = arguments.join ' ...
require 'fog/core/model' require 'fog/aliyun/models/storage/files' module Fog module Storage class Aliyun class Directory < Fog::Model identity :key def destroy requires :key prefix = key+'/' ret = service.list_objects(:prefix=>prefix)["Contents"] ...
class Student attr_accessor :name @@all = [] def initialize(name) @name = name self.class.all << self end def self.all @@all end def add_boating_test(test_name, status, instructor) BoatingTest.new(student: self, test_name: test_name, status: status, instructor: instructor) end de...
# coding: utf-8 module Estat class API module Response class Result attr_accessor :status,:error_msg,:date def initialize(h) @status = h["STATUS"] @error_msg = h["ERROR_MSG"] @date = h["DATE"] end end end end end
class CompaniesController < ApplicationController before_action :set_company, only: [:show, :edit, :update, :destroy] # GET /companies # GET /companies.json def index @companies = Company.all end # GET /companies/1 # GET /companies/1.json def show @commentable = Company.find(params[:id]) ...
require 'test_helper' class RegistQueuesControllerTest < ActionController::TestCase setup do @regist_queue = regist_queues(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:regist_queues) end test "should get new" do get :new assert_res...
class ShoppingCart def initialize @items = [] end def add_item(item) @items.push(item) end def checkout total = @items.reduce(0) do | total, single_item | total + single_item.price end if @items.count >= 5 total = total * 0.9 end puts "Your price for today was: #{total}, have a nice day" en...
require 'spec/mocks/message_expectation' module Spec #:nodoc: module Mocks #:nodoc: class ScopeExpectation def initialize(model_class, expected_scopes) @model_class, @expected_scopes = model_class, expected_scopes end def scope_matches? match = @expected_scopes.all? { |key, sc...
module Mutations class CreateEvent < Mutations::BaseMutation #Event args argument :name, String, required: true argument :notes, String, required: false argument :start_time, String, required: true argument :end_time, String, required: true argument :venue_id, Integer, required: true #Addr...
require File.join(File.dirname(__FILE__), '..', '..', 'grapevine_app.rb') require File.join(File.dirname(__FILE__), 'spec_helper') describe "Grapevine App" do include Rack::Test::Methods def app; @app ||= Sinatra::Application; end let(:params){{:image_url => 'http://twitpic.com/eRR323', :text => 'pap...
require_dependency "cfp/application_controller" module Cfp class RanksController < BaseController respond_to :json before_filter :check_for_reviewer, :load_proposal def create @rank = find_or_create_rank @rank.value = params[:value] @rank.save! render :json => @rank end ...
class SearchesController < ApplicationController def new end def searchPicture @search = helpers.find_search(params[:type],params[:search]) if !@search.empty? render json: @search else render json: {"#{params[:type]}": "does not exist"} , status: 422 end end end