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
# render a file (image, video) inside the browser | |
def inline | |
@video = Video.find(params[:id]) | |
send_file @video.filepath.path, :type => @video.filepath_content_type | |
end | |
# force the browser to show the download modal box and send the file to the browser | |
# you can use the :xsendfile => true option | |
# send_file @video.filepath.path, :type => @video.filepath_content_type | |
def download |
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 File.dirname(__FILE__) + '/../test_helper' | |
class PickaxeBookGooggleSearchTest < ActiveSupport::TestCase | |
include WatirOnRails | |
# Uncomment the following lines to specify a test server. | |
# WatirOnRails defaults to http://localhost:3000 | |
# | |
# server "localhost" | |
# port 3001 |
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
#!/usr/local/bin/ruby -w | |
require "rubygems" | |
require "highline/import" | |
# The old way, using ask() and say()... | |
choices = %w{ruby python perl} | |
say("This is the old way using ask() and say()...") | |
say("Please choose your favorite programming language:") | |
say(choices.map { |c| " #{c}\n" }.join) |
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
context "should destroy participation" do | |
setup do | |
@configuration = Factory.create :configuration, :status => 'LIVE' | |
@p = Factory.create :participation, :configuration => @configuration | |
@admin = Factory.create :participant, :admin => true | |
login_as @admin | |
end | |
should "delete :destroy participations" do | |
assert_difference('Participation.count', -1) do |
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
<html><body>You are being <a href="http://test.host/configurations/46/edit">redirected</a>.</body></html> |
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
begin | |
p = Participant.find params[:id] | |
render :nothing => true, :status => 200 | |
rescue | |
render :nothing => true, :status => 404 | |
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
With this code: | |
browser.link(:text, "Move questions to...").click | |
browser.alert do | |
browser.button(:id => "alert").click | |
end #=> "the alert message" | |
I get this error: |
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
#!/bin/sh | |
echo "recursively removing .svn folders from" | |
pwd | |
rm -rf `find . -type d -name .svn` |
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 CourseItem < ActiveRecord::Base | |
validates_presence_of :course_id, :day, :url | |
validates_uniqueness_of :course_id, :scope => :day, :message => "- this day has been already created." | |
end | |
describe CourseItem do | |
# check uniqueness using this matcher https://github.com/bogdan/accept_values_for | |
context "should create one item per day and per course only" do | |
before do | |
CourseItem.create! :day => 1, :course_id => 1, :url => '/courses/index.html' |
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
sudo aptitude install curl git-core ruby build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf |
OlderNewer