Add fake host pages with an embedded asciicast

openid
Marcin Kulik 11 years ago
parent a6a925edd3
commit 4b9c33f228

@ -1,6 +1,6 @@
class AsciicastsController < ApplicationController class AsciicastsController < ApplicationController
before_filter :load_resource, :only => [:show, :raw, :edit, :update, :destroy] before_filter :load_resource, :only => [:show, :raw, :example, :edit, :update, :destroy]
before_filter :ensure_authenticated!, :only => [:edit, :update, :destroy] before_filter :ensure_authenticated!, :only => [:edit, :update, :destroy]
before_filter :ensure_owner!, :only => [:edit, :update, :destroy] before_filter :ensure_owner!, :only => [:edit, :update, :destroy]
@ -38,6 +38,10 @@ class AsciicastsController < ApplicationController
render :layout => 'raw' render :layout => 'raw'
end end
def example
render layout: 'example'
end
def edit def edit
end end

@ -0,0 +1,14 @@
p
' Well, the way they make shows is, they make one show. That show's called a
pilot. Then they show that show to the people who make shows, and on the
strength of that one show they decide if they're going to make more shows.
Some pilots get picked and become television programs. Some don't, become
nothing. She starred in one of the ones that became nothing.
script[type="text/javascript" src=asciicast_url(@asciicast, format: 'js') id="asciicast-#{@asciicast.id}" async]
p
' Now that there is the Tec-9, a crappy spray gun from South Miami. This gun is
advertised as the most popular gun in American crime. Do you believe that shit?
It actually says that in the little book that comes with it: the most popular
gun in American crime. Like they're actually proud of that shit.

@ -0,0 +1,12 @@
doctype html
html[lang="en"]
head
css:
body { margin: 20px }
.content {
background-color: #ddd;
padding: 20px
}
body
div.content
= yield

@ -6,6 +6,7 @@ Asciinema::Application.routes.draw do
resources :asciicasts, :path => 'a' do resources :asciicasts, :path => 'a' do
member do member do
get :raw get :raw
get :example
end end
end end

@ -0,0 +1,15 @@
require 'spec_helper'
feature "Example page with embedded player", :js => true do
let!(:asciicast) { create(:asciicast) }
scenario 'Visiting' do
visit example_asciicast_path(asciicast)
within_frame "asciicast-iframe-#{asciicast.id}" do
expect(page).to have_selector('.play-button')
end
end
end
Loading…
Cancel
Save