ruby on rails - FactoryGirl not creating data in view -
so factory:
factorygirl.define factory :member email 'admin@admin.com' password 'rootroot' first_name 'rinholds' last_name 'jordan' expiration time.local(2015, 6, 21, 15, 13, 0) start_date time.local(2015, 4, 21, 15, 13, 0) role 2 end end
this spec:
require 'rails_helper' describe dashboardcontroller, type: :controller 'should display chart', js: true member = create(:member) member.save! member.confirm binding.pry visit '/' end end
this root_path():
body = yield = member.first.email ~
when run spec returns undefined method `email' nil:nilclass in view.
when put binding pry in view, , run member.all returns empty array!
how posible? how force factorygirl create real database data?!?
-- edit -- controller, althout doesnt there, because of devise login page authorized_member!
class dashboardcontroller < applicationcontroller before_filter :authenticate_member! def index day_statistics = statistics::daystatistics.new(current_member) @charts = day_statistics.domain_charts end end
resolved problem installing databsecleaner! member data shows in controller , views!!!
Comments
Post a Comment