Skip to content

Instantly share code, notes, and snippets.

View agibralter's full-sized avatar
:shipit:

Aaron Gibralter agibralter

:shipit:
View GitHub Profile
require 'spec_helper'
describe GroupsController do
include SessionTestHelper
describe "GET 'show'" do
it "should load the group from the database" do
@the_group = Factory(:group)
Group.stub(:find_active_by_unique_name).with("london-developers").
and_return(@the_group)
Scenario: An admin viewing the bums only list of beta users
Given no Users and no BetaUsers
And a User with no login, email '[email protected]', and password 'I like cats'
And a BetaUser '[email protected]'
And a BetaUser '[email protected]' who is no bum
And '[email protected]' logged in with password 'I like cats' (FAILED) # response.body is empty!
When that user requests '/admin/beta_users' with bums_only true
steps_for(:viewing) do
When("$agent requests '/list_views.xml'") do |agent|
get '/list_views.xml'
# This is displaying correctly for both scenarios
puts "<pre>#{response.body}</pre>"
end
Then("they should see a list of lists containing '$list_name'") do |list_name|
response.should have_tag('list-views>list-view>name', list_name)
WHERE THE HELL IS E2's remember me coming from!??!?!? (last line)
E 1: {"test_ls"=>"TUEukYXutyX4CnrjckGjYw%3D%3D--2aa4c5c7df094842a0ee60107f1ff444496e78a1", "test_session"=>"BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl%0Ac3Npb25faWRpAnE8OhFsX3Nlc3Npb25faWRpAoE7Og1xdWVzdGlvbnsHOwlp%0AAtQtOgxhbnN3ZXJzWwhpAnqJaQJ7iWkCfIk6CXVzZXJpAgcQOg5yZXR1cm5f%0AdG8wIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hI%0AYXNoewAGOgpAdXNlZHsA--5ea2ecb92e6706a4335241a853a86889a0203489"}
A 1: {"test_ls"=>["TUEukYXutyX4CnrjckGjYw==--2aa4c5c7df094842a0ee60107f1ff444496e78a1"], "test_session"=>["BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl\nc3Npb25faWRpAnE8OhFsX3Nlc3Npb25faWRpAoE7Og1xdWVzdGlvbnsHOwlp\nAtQtOgxhbnN3ZXJzWwhpAnqJaQJ7iWkCfIk6CXVzZXJpAgcQOg5yZXR1cm5f\ndG8wIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hI\nYXNoewAGOgpAdXNlZHsA--5ea2ecb92e6706a4335241a853a86889a0203489"]}
B 1: {"test_ls"=>["TUEukYXutyX4CnrjckGjYw==--2aa4c5c7df094842a0ee60107f1ff444496e78a1"], "test_sess
E 1: {"test_ls"=>"TUEukYXutyX4CnrjckGjYw%3D%3D--2aa4c5c7df094842a0ee60107f1ff444496e78a1", "test_session"=>"BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl%0Ac3Npb25faWRpAnE8OhFsX3Nlc3Npb25faWRpAoE7Og1xdWVzdGlvbnsHOwlp%0AAtQtOgxhbnN3ZXJzWwhpAnqJaQJ7iWkCfIk6CXVzZXJpAgcQOg5yZXR1cm5f%0AdG8wIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hI%0AYXNoewAGOgpAdXNlZHsA--5ea2ecb92e6706a4335241a853a86889a0203489"}
A 1: {"test_ls"=>["TUEukYXutyX4CnrjckGjYw==--2aa4c5c7df094842a0ee60107f1ff444496e78a1"], "test_session"=>["BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl\nc3Npb25faWRpAnE8OhFsX3Nlc3Npb25faWRpAoE7Og1xdWVzdGlvbnsHOwlp\nAtQtOgxhbnN3ZXJzWwhpAnqJaQJ7iWkCfIk6CXVzZXJpAgcQOg5yZXR1cm5f\ndG8wIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hI\nYXNoewAGOgpAdXNlZHsA--5ea2ecb92e6706a4335241a853a86889a0203489"]}
B 1: {"test_ls"=>["TUEukYXutyX4CnrjckGjYw==--2aa4c5c7df094842a0ee60107f1ff444496e78a1"], "test_session"=>["BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl\
has_many | ... | :dependent => :destroy | :dependent => :delete_all
---------------------------------------------------------------------------------------------------
@post.clear | doesn't delete in db | destroy on each record | 1 DELETE (no callbacks, etc.)
@post.destroy_all | doesn't delete in db | destroy on each record | destroy on each record
@post.delete_all | doesn't delete in db | destroy on each record | 1 DELETE (no callbacks, etc.)
@agibralter
agibralter / scopify.rb
Created September 25, 2008 19:55
add named_scopes to mock_models
def scopify(model_class, *scopes)
mocks = [model_class]
scopes.each do |scope|
mocks << mock(scope.to_s)
end
mocks.each do |mock|
mocks.delete_if { |m| m == mock || m == model_class }.each do |m|
mock.stub!(m.instance_variable_get(:@name)).and_return(model_class)
end
end
@agibralter
agibralter / gist:13416
Created September 28, 2008 06:09 — forked from retr0h/gist:9204
require 'singleton'
begin
require 'daemon_controller'
rescue LoadError
raise('FATAL: sudo gem install FooBarWidget-daemon_controller -s http://gems.github.com')
end
##
# sudo port install memcached
class DaemonMemcache
class SessionModelProxy
attr_reader :session_data
def initialize(user, session_data, *args)
if session_data.is_a?(Hash)
@session_data = session_data
else
load_from_db(klass.find(id), args)
end
{ scopeName = 'source.ruby.cucumber.steps';
fileTypes = ( 'steps.rb' );
patterns = (
{ name = 'keyword';
match = '\b(GivenScenario|Given|When|Then)\b';
},
{ name = 'string.regexp.classic.ruby';
begin = '(?:GivenScenario\s)|(?:Given\s)|(?:When\s)|(?:Then\s)\s*((/))(?![*+{}?])';
end = '((/[eimnosux]*))';
},