Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7537349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:49:44+00:00 2026-05-30T06:49:44+00:00

I have a Group model that I am testing using Request specs with Capybara

  • 0

I have a Group model that I am testing using Request specs with Capybara and generating the data using Factory Girl

In my groups.rb factory…

FactoryGirl.define do
  factory :group do
    sequence :name do |n| 
      "Group#{n}"
    end
    expiry Date.today + 2.weeks
  end
end

And use this in my groups_spec.rb…

describe "Groups" do
  describe "GET /groups" do
    it "an admin user can create a new group" do
      user = Factory.create(:user, :is_admin => true )
      group = Factory.build(:group)

      visit root_url
      fill_in "Email", :with => user.email
      fill_in "Password", :with => user.password
      click_button "Login"
      click_link "Groups"
      click_link "New Group"
      fill_in "Name", :with => group.name
      # need to change the below to use the Factory eg select Date.new(group.expiry)
      select "2014", :from => "group_expiry_1i"
      select "June", :from => "group_expiry_2i"
      select "1", :from => "group_expiry_3i"
      click_button "Create Group"
      page.should have_content("Group was successfully created.")
      page.should have_content(group.name)
    end
  end
end

So you see that this is not a good way to do the test as I’m not using the factory generated expiry. Does anyone know how to input the expiry date into the form properly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:49:45+00:00Added an answer on May 30, 2026 at 6:49 am

    This is just off the cuff without testing in Capybara, but I’d try:

    select group.expiry.year.to_s, :from => "group_expiry_1i"
    select Date::MONTHNAMES[group.expiry.month], :from => "group_expiry_2i"
    select group.expiry.date.to_s, :from => "group_expiry_3i"
    

    As long as those values actually exist in the dropdown it should select them correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a User and Group model. User has_many Groups and Group belongs_to User
I have a model class that has, among other things: class Group < ActiveRecord::Base
I have a function client_groups in a model that returns a list of Group
I have transactional Groups of entities of type db.Model that have a parent defined.
I have a project model that has a FK to a group model. Group
I have a Users model that can have many Groups through Memberships. If a
I have a group of model peer classes that should all have the same
I have groups ( Group model) in my app, which represent groups of people.
I have models (simplified example): class Group(models.Model): name = models.CharField(max_length = 32) class Person(models.Model):
I have a group of checkboxes that I only want to allow a set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.