I have a group model that I am testing using Request specifications with Capybara and generating 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
So you see that this is not a good way to do the test, since I do not use the expiration of the Factory. Does anyone know how to correctly enter an expiration date in a form?
source share