Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Testing custom controllers and super-users
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Chris Cummer  
View profile  
 More options Feb 6 2012, 2:59 pm
From: Chris Cummer <chriscum...@gmail.com>
Date: Mon, 6 Feb 2012 11:59:39 -0800 (PST)
Local: Mon, Feb 6 2012 2:59 pm
Subject: Testing custom controllers and super-users
I have a custom controller not associated with any engine that I'd
like to test. However without a superuser refinery intercepts all
calls to the controller's routes and redirects to the superuser
creation process.

in /spec/support/refinery/controller_macros.rb there's a method called
login_refinery_user which looks like it could be extended to
login_refinery_superuser but I don't know how to incorporate that
module and the associated factories (i.e. Factory(:refinery_user))
into my own tests.

Could someone point me in the right direction?

Cheers
Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philip Arndt  
View profile  
 More options Feb 6 2012, 3:14 pm
From: Philip Arndt <par...@gmail.com>
Date: Tue, 7 Feb 2012 09:14:53 +1300
Local: Mon, Feb 6 2012 3:14 pm
Subject: Re: [Refinery CMS:5934] Testing custom controllers and super-users
You can find my implementation of login_refinery_superuser on the
master branch https://github.com/resolve/refinerycms/blob/master/testing/lib/refine...

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Cummer  
View profile  
 More options Feb 6 2012, 3:25 pm
From: Chris Cummer <chriscum...@gmail.com>
Date: Mon, 6 Feb 2012 12:25:32 -0800 (PST)
Local: Mon, Feb 6 2012 3:25 pm
Subject: Re: Testing custom controllers and super-users
Yep, and I've copied that into my controller_macros.rb file, however
I'm unclear on how exactly to get that to work with my controller's
spec. If I do the following:

describe WidgetsController do
  include Refinery::ControllerMacros

  def setup
    login_refinery_superuser
    ...
  end

  describe '#featured' do
    before { setup }

    ... tests etc...
  end
end

It generates an "undefined method `before' for
#<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x007f990c6996a8> "
error. I'd like to use the Refinery::ControllerMacros in my controller
spec, I'm just not clear about how to integrate them.

On Feb 6, 12:14 pm, Philip Arndt <par...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philip Arndt  
View profile  
 More options Feb 6 2012, 3:52 pm
From: Philip Arndt <par...@gmail.com>
Date: Tue, 7 Feb 2012 09:52:05 +1300
Local: Mon, Feb 6 2012 3:52 pm
Subject: Re: [Refinery CMS:5938] Re: Testing custom controllers and super-users
Try placing it outside of the setup block :) it knows how to run itself.. for example: https://github.com/resolve/refinerycms/blob/master/authentication/spe...

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Cummer  
View profile  
 More options Feb 6 2012, 3:57 pm
From: Chris Cummer <chriscum...@gmail.com>
Date: Mon, 6 Feb 2012 12:57:50 -0800 (PST)
Local: Mon, Feb 6 2012 3:57 pm
Subject: Re: Testing custom controllers and super-users
Ah! That makes perfect sense. We're getting closer. I now get this
error:

"Factory not registered: refinery_superuser"

which suggests the user.rb factory isn't being found when rspec is
run... ?

On Feb 6, 12:52 pm, Philip Arndt <par...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philip Arndt  
View profile  
 More options Feb 6 2012, 4:01 pm
From: Philip Arndt <par...@gmail.com>
Date: Tue, 7 Feb 2012 10:01:16 +1300
Local: Mon, Feb 6 2012 4:01 pm
Subject: Re: [Refinery CMS:5942] Re: Testing custom controllers and super-users
Or that it doesn't exist in your version of Refinery.  Here's the definition:

https://github.com/resolve/refinerycms/blob/master/authentication/spe...

:)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pete Higgins  
View profile  
 More options Feb 6 2012, 4:41 pm
From: Pete Higgins <p...@peterhiggins.org>
Date: Mon, 6 Feb 2012 13:41:31 -0800
Local: Mon, Feb 6 2012 4:41 pm
Subject: Re: [Refinery CMS:5945] Re: Testing custom controllers and super-users

Chris,

I usually work around the need for a refinery user by disabling the welcome
screen.

This is what I have in a file in spec/suport in a project using a
recent-ish version of edge refinery:

module Refinery
  module ApplicationController
    module InstanceMethods
      def just_installed?
        false
      end
    end
  end
end

pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philip Arndt  
View profile  
 More options Feb 6 2012, 4:43 pm
From: Philip Arndt <par...@gmail.com>
Date: Tue, 7 Feb 2012 10:43:13 +1300
Local: Mon, Feb 6 2012 4:43 pm
Subject: Re: [Refinery CMS:5946] Re: Testing custom controllers and super-users
Sure, you *could* circumvent Refinery. :P

Pete, do you think that we should do that by default?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pete Higgins  
View profile  
 More options Feb 6 2012, 4:45 pm
From: Pete Higgins <p...@peterhiggins.org>
Date: Mon, 6 Feb 2012 13:45:08 -0800
Local: Mon, Feb 6 2012 4:45 pm
Subject: Re: [Refinery CMS:5947] Re: Testing custom controllers and super-users

Philip,

I think it makes for a nice first-time experience, but it does complicate a
few things. Maybe add a setting to disable it so that monkeypatches aren't
needed? This would also save so DB queries from running on every request.

pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philip Arndt  
View profile  
 More options Feb 6 2012, 4:46 pm
From: Philip Arndt <par...@gmail.com>
Date: Tue, 7 Feb 2012 10:46:05 +1300
Local: Mon, Feb 6 2012 4:46 pm
Subject: Re: [Refinery CMS:5948] Re: Testing custom controllers and super-users
I mean when testing; we should, however, always prompt to create the first user on a normal situation.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Cummer  
View profile  
 More options Feb 6 2012, 7:56 pm
From: Chris Cummer <chriscum...@gmail.com>
Date: Mon, 6 Feb 2012 16:56:44 -0800 (PST)
Local: Mon, Feb 6 2012 7:56 pm
Subject: Re: Testing custom controllers and super-users
I think disabling it is a reasonable default to have when the
Rails.env == test. Currently it is not immediately obvious that this
is the issue when running controller test.

Thanks for the work-around Pete, and thanks for the help Philip!

On Feb 6, 1:46 pm, Philip Arndt <par...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »