Skip to content

Instantly share code, notes, and snippets.

View itsbth's full-sized avatar

Bjørn Tore Håvie itsbth

View GitHub Profile
Using the default profile...
Disabling profiles...
Feature: User management
Scenario: Logging in with a new account # features/users.feature:3
When I log in # features/step_definitions/user_steps.rb:9
Then I should get redirected to the settings page # features/step_definitions/user_steps.rb:18
And I should get a success flash # features/step_definitions/user_steps.rb:28
Scenario: Logging in with an existing account # features/users.feature:8
@itsbth
itsbth / users.feature
Created January 21, 2012 16:45
Uploaded by UploadToGist for Sublime Text 2
Feature: User management
Scenario: Logging in with a new account
When I log in
Then I should get redirected to the settings page
And I should get a success flash
Scenario: Logging in with an existing account
Given a User exists with an identity url of "http://foo.com/"
When I log in as http://foo.com/
@itsbth
itsbth / dupes_spec.rb
Created January 21, 2012 16:54
Uploaded by UploadToGist for Sublime Text 2
describe DupesController do
describe "GET /new" do
it "should redirect to root_path if user is not logged in" do
get :new
request.should redirect_to root_url
end
it "should display the form if user is logged in" do
session[:user_id] = FactoryGirl.create(:user).id
get :new
request.should render_template 'dupes/new'
@itsbth
itsbth / new_dupe_form_spec.rb
Created January 21, 2012 16:55
Uploaded by UploadToGist for Sublime Text 2
describe DupesController, js: true do
def login
visit "/auth/steam"
end
context "#new" do
it "should show a preview" do
login
visit new_dupe_path
within "#new_dupe" do
fill_in 'dupe_description', with: <<-TEXT
@itsbth
itsbth / application.html.haml
Created January 21, 2012 21:51
Uploaded by UploadToGist for Sublime Text 2
!!!
%html
%head
%title Dupeshare
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
%body
= render partial: 'shared/nav'
.container
@itsbth
itsbth / application.html.slim
Created January 21, 2012 21:51
Uploaded by UploadToGist for Sublime Text 2
doctype
html
head
title Dupeshare
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
body
= render partial: 'shared/nav'
.container
@itsbth
itsbth / extract_templates.coffee
Created February 2, 2012 21:11
Uploaded by UploadToGist for Sublime Text 2
fs = require 'fs'
page = require('webpage').create()
HS = '"""'
url = phantom.args[0]
page.open url, (status) ->
try
result = page.evaluate ->
@itsbth
itsbth / templates.js.coffee
Created February 2, 2012 21:20
Uploaded by UploadToGist for Sublime Text 2
window.TPL ||= {}
TPL.screenshot_form = (id) ->
"""
<div class="screenshot" data-id="#{id}">
<div class="control-group string required"><label class="string required" for="dupe_screenshots_attributes_#{id}_file"><abbr title="required">*</abbr> Image</label><div class="controls"><input class="string required" id="dupe_screenshots_attributes_#{id}_file" name="dupe[screenshots_attributes][#{id}][file]" size="50" type="text"></div></div>
<input id="dupe_screenshots_attributes_#{id}_file_cache" name="dupe[screenshots_attributes][#{id}][file_cache]" type="hidden">
<div class="control-group string required"><label class="string required" for="dupe_screenshots_attributes_#{id}_description"><abbr title="required">*</abbr> Description</label><div class="controls"><input class="string required" id="dupe_screenshots_attributes_#{id}_description" name="dupe[screenshots_attributes][#{id}][description]" size="50" type="text"><p class="help-block"><span class="delete">
<a class="delete" href
@itsbth
itsbth / login.js.coffee
Created February 5, 2012 01:14
Uploaded by UploadToGist for Sublime Text 2
link = null
window.loginCallback = ->
document.location.href = link if link
$ ->
$('a[data-login]').click (evt) ->
link = this.href
wnd = window.open '/auth/steam', 'login', 'menubar=no,status=no'
if window.opener and window.opener.loginCallback
window.opener.loginCallback()
window.close()
@itsbth
itsbth / new_dupe_form_spec.rb
Created February 6, 2012 22:30
Uploaded by UploadToGist for Sublime Text 2
describe DupesController, js: true do
def login
visit "/auth/steam"
end
context "#new" do
it "should show a preview" do
login
visit new_dupe_path
within "#new_dupe" do
fill_in 'dupe_description', with: <<-TEXT