This file contains hidden or 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 "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 |
This file contains hidden or 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 "user account exists with a matching Facebook uid" do | |
setup do | |
@uid = 1234567 | |
@user = Factory(:user, :fb_user_id => @uid) | |
end | |
... | |
end |
This file contains hidden or 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
jared: | |
name: Jared | |
role: developer | |
location: San Francisco | |
fred: | |
name: Fred | |
role: designer | |
location: Boston |
This file contains hidden or 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 UsersController < Clearance::UsersController | |
def create | |
... | |
sign_in(@user) | |
end | |
end | |
class ParticipationsController < ApplicationController | |
protected | |
def ensure_signed_in |
This file contains hidden or 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 "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 |
This file contains hidden or 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 'fake_web' | |
FakeWeb.allow_net_connect = false | |
FakeWeb.register_uri(:post, "http://somesite.com", | |
:string => 'response body') |
This file contains hidden or 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 Admin::ArticlesController < ApplicationController | |
def show | |
if draft_and_admin? | |
@article = Article.find(params[:id]) | |
render | |
else | |
deny_access | |
end | |
end |
This file contains hidden or 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 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 |
This file contains hidden or 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 Admin::ArticlesController < ApplicationController | |
before_filter :deny_access, :unless => :draft_and_admin? | |
def show | |
@article = Article.find(params[:id]) | |
end | |
protected | |
def draft_and_admin? |
This file contains hidden or 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
config.to_prepare do | |
ApplicationController.helper(AnnouncementsHelper) | |
end |