Skip to content

Instantly share code, notes, and snippets.

context "the job XML from the web service" do
setup { @xml_job = IO.read("test/fixtures/jobs/1.xml") }
should "include the recruiter's email" do
recruiter_xml = "<recruiter>[email protected]</recruiter>"
assert_contains @xml_job, recruiter_xml
end
end
context "user account exists with a matching Facebook uid" do
setup do
@uid = 1234567
@user = Factory(:user, :fb_user_id => @uid)
end
...
end
jared:
name: Jared
role: developer
location: San Francisco
fred:
name: Fred
role: designer
location: Boston
class UsersController < Clearance::UsersController
def create
...
sign_in(@user)
end
end
class ParticipationsController < ApplicationController
protected
def ensure_signed_in
context "when signed out" do
setup { sign_out }
context "on get to new" do
setup { get :new }
should_deny_access
end
end
context "when signed in" do
require 'fake_web'
FakeWeb.allow_net_connect = false
FakeWeb.register_uri(:post, "http://somesite.com",
:string => 'response body')
class Admin::ArticlesController < ApplicationController
def show
if draft_and_admin?
@article = Article.find(params[:id])
render
else
deny_access
end
end
class Admin::ArticlesController < InheritedResources::Base
before_filter :deny_access, :unless => :draft_and_admin?
actions :show
protected
def draft_and_admin?
Article.find(params[:id]).draft? && current_user.admin?
end
end
class Admin::ArticlesController < ApplicationController
before_filter :deny_access, :unless => :draft_and_admin?
def show
@article = Article.find(params[:id])
end
protected
def draft_and_admin?
config.to_prepare do
ApplicationController.helper(AnnouncementsHelper)
end