How to use find method of Sort Package

Best Active_mocker_ruby code snippet using Sort.find

reports_controller.rb

Source:reports_controller.rb Github

copy

Full Screen

...20 sort = 'nodes.name'21 if (params[:sort] =~ /name_reverse/)22 sort = 'nodes.name DESC'23 end24 @objects = Node.find(:all,:include => {:node_rack_node_assignment=>{:node_rack=>{}}},:conditions => ["node_racks.name is ?",nil], :order => sort).paginate(:page => params[:page])25 respond_to do |format|26 format.html # index.html.erb27 end28 end29 def have_not_updated30 @ago = params[:ago] || 731 @ago = @ago.to_i32 @unit = params[:unit] || "days"33 if @unit == "hours"34 timestamp = DateTime.parse((Time.now - @ago.hours).to_s)35 else36 timestamp = (Date.today - @ago.days).to_s37 end38 # sort param passed from web gui's row header #39 sort = 'updated_at'40 if (params[:sort] =~ /updated_at_reverse/)41 sort << ' DESC'42 elsif (params[:sort] =~ /name/)43 sort = 'nodes.name'44 sort << ' DESC' if (params[:sort] =~ /name_reverse/)45 end46 @objects = Node.find(:all,:conditions => ['updated_at < ?', timestamp], :order => sort).paginate(:page => params[:page])47 48 respond_to do |format|49 format.html # index.html.erb50 end51 end52 def unused_hardware_profiles53 unused = []54 sort = 'name'55 if (params[:sort] =~ /name_reverse/)56 sort = 'name DESC'57 end58 allhps = HardwareProfile.find(:all,:include => {:nodes=>{}}, :order => sort)59 allhps.each { |hwp| unused.push(hwp) if hwp.nodes.size < 1 }60 @objects = unused.paginate(:page => params[:page])61 respond_to do |format|62 format.html # index.html.erb63 end64 end65 def conflict_cpucount66 sort = 'nodes.name'67 if (params[:sort] =~ /name_reverse/)68 sort = 'nodes.name DESC'69 end70 @objects = Node.find(:all, :conditions => "os_processor_count != processor_count", :order => sort).paginate(:page => params[:page])71 respond_to do |format|72 format.html # index.html.erb73 end74 end75 def conflict_memorysize76 sort = 'nodes.name'77 if (params[:sort] =~ /name_reverse/)78 sort = 'nodes.name DESC'79 end80 @objects = Node.find(:all, :conditions => "ABS( (physical_memory - os_memory )/os_memory ) > 0.1", :order => sort).paginate(:page => params[:page])81 respond_to do |format|82 format.html # index.html.erb83 end84 end85 def dup_sns86 dups = {}87 dupnodes = []88 allnodes = Node.find(:all , :select => "id,serial_number", :conditions => 'serial_number is not null and serial_number != ""')89 serials = allnodes.collect{|a| a.serial_number.strip}.compact90 while !serials.empty?91 serial = serials.pop92 dups[serial] = 1 unless serials.grep(/#{serial}/i).empty?93 end94 allnodes.each{ |node| dupnodes << node.id if dups[node.serial_number.strip] }95 @objects = Node.find(dupnodes, :order => 'nodes.serial_number').paginate(:page => params[:page])96 respond_to do |format|97 format.html # index.html.erb98 end99 end100 def non_app_nodes101 end102 def assigned_keywords103 returnkeywords104 end105 def delkeyword106 keyword = NgAppKeyword.find(params[:keywordid])107 keyword.destroy if keyword108 returnkeywords109 end110 def addkeyword111 keyword = NgAppKeyword.find(:all, :conditions => ["name like ?","%#{params[:keyword]}%"])112 if params[:keyword] && keyword.nil?113 NgAppKeyword.create({:name => params[:keyword]})114 end115 returnkeywords116 end117 def returnkeywords118 unless params[:hide]119 # list num of nodes of each keyword (node_group name)120 @appresults = {}121 @nodes_size = 0122 @keywords = NgAppKeyword.all123 @keywords.each do |appname|124 ng = NodeGroup.find_by_name(appname.name)125 if ng126 @nodes_size += ng.nodes.size127 @appresults[appname.name] = ng 128 end129 end130 end131 respond_to do |format|132 format.js {133 if params[:hide]134 render(:update) { |page| 135 page.replace_html 'assigned_keywords', :text => '<h3>Assigned Nodes</h3>' 136 page.show 'show_assigned_keywords'137 }138 else139 render(:update) { |page| page.replace_html 'assigned_keywords', :partial => 'assigned_keywords', :locals => {:keywords => @keywords} }140 end141 }142 end143 end144 def unassigned_nodes145 allkeywords = NgAppKeyword.find(:all,:select => 'name').collect(&:name)146 unless params[:hide]147 # all nodes that don't belong to one of the node groups in keywords array148 @unassigned = []149 hwprofiles = HardwareProfile.find(:all,:select => 'id', :conditions => "name like '%proliant%' or name like '%sun-fire%' or name like '%ultra%' or name like '%unknown unknown%'")150 statusid = Status.find_by_name('inservice').id151 if params[:mode] == 'default' || !params[:mode]152 results = Node.find(:all,:select => 'nodes.id,nodes.name,node_groups.name,node_groups.id,status.name,status.id',:include => {:node_groups=>{}, :status=>{}},153 :conditions => ["status_id = ? and hardware_profile_id in (?)",statusid,hwprofiles], :order => 'nodes.name')154 elsif params[:mode] == 'notin'155 results = Node.find(:all,:select => 'nodes.id,nodes.name,node_groups.name,node_groups.id,status.name,status.id',:include => {:node_groups=>{},:status=>{}},156 :conditions => ["status_id != ? and hardware_profile_id in (?)",statusid,hwprofiles], :order => 'nodes.name')157 end158 results.each do |node|159 flag = true160 node.node_groups.collect(&:name).each do |name| 161 flag = nil if allkeywords.include?(name) 162 end163 (@unassigned << node) if flag 164 end165 @unassigned.sort!{ |a,b| a.name <=> b.name } 166 end167 respond_to do |format|168 format.js {169 if params[:hide]170 render(:update) { |page| 171 page.replace_html 'unassigned_nodes', :text => '<h3>Nodes Not Assigned</h3>'172 page.show 'show_unassigned_nodes'173 }174 else175 if params[:mode] == 'default' || !params[:mode]176 render(:update) { |page| page.replace_html 'unassigned_nodes', :partial => 'unassigned_nodes', :locals => {:unassigned => @unassigned} }177 elsif params[:mode] == 'notin'178 render(:update) { |page| page.replace_html 'unassigned_nodes', :partial => 'unassigned_nodes_notin', :locals => {:unassigned => @unassigned} }179 end180 end181 }182 end183 end184 def buildrequiredtags185 os = OperatingSystem.find(:all, :select => 'id,name', :conditions => "name like '%linux%' or name like '%unix%' or name like '%windows%' or name like '%solaris%' or name like '%sun%'")186 business_unit_nodes = Node.find(:all, :select => 'nodes.id,nodes.name', :joins => {:node_groups => {:taggings => {:tag => {} } } }, :conditions => 'tags.name = "business_unit"')187 bizids = business_unit_nodes.collect(&:id)188 environment_nodes = Node.find(:all, :select => 'nodes.id,nodes.name', :joins => {:node_groups => {:taggings => {:tag => {} } } }, :conditions => 'tags.name = "environment"')189 envids = environment_nodes.collect(&:id)190 tier_nodes = Node.find(:all, :select => 'nodes.id,nodes.name', :joins => {:node_groups => {:taggings => {:tag => {} } } }, :conditions => 'tags.name = "tier"')191 tierids = tier_nodes.collect(&:id)192 service_nodes = Node.find(:all, :select => 'nodes.id,nodes.name', :joins => {:node_groups => {:taggings => {:tag => {} } } }, :conditions => 'tags.name = "services"')193 svcids = service_nodes.collect(&:id)194 @goodnodes = Node.find(:all, :conditions => ["id in (?) and id in (?) and id in (?) and id in (?)", bizids, envids, tierids, svcids], :order => :name)195 if @goodnodes.empty?196 @badnodes = Node.find(:all, :joins => {:operating_system =>{}}, :conditions => ["operating_systems.id in (?)", os.collect(&:id)], :order => :name)197 else198 @badnodes = Node.find(:all, :joins => {:operating_system =>{}}, :conditions => ["operating_systems.id in (?) and nodes.id not in (?)", os.collect(&:id), @goodnodes.collect(&:id)], :order => :name)199 end200 @dupnodes = find_dups(business_unit_nodes) + find_dups(environment_nodes) + find_dups(tier_nodes) + find_dups(service_nodes)201 end202 def requiredtags203 buildrequiredtags204 end205 def required_tag_membership206 buildrequiredtags207 @business_unit_ngs = NodeGroup.find(:all,:joins => {:taggings => {:tag =>{}}}, :conditions => 'tags.name = "business_unit"')208 @environment_ngs = NodeGroup.find(:all,:joins => {:taggings => {:tag =>{}}}, :conditions => 'tags.name = "environment"')209 @tier_ngs = NodeGroup.find(:all,:joins => {:taggings => {:tag =>{}}}, :conditions => 'tags.name = "tier"')210 @service_ngs = NodeGroup.find(:all,:joins => {:taggings => {:tag =>{}}}, :conditions => 'tags.name = "services"')211 objects = @goodnodes if params[:mode] == 'met'212 objects = @dupnodes.uniq if params[:mode] == 'dup'213 objects = @badnodes if params[:mode] == 'notmet'214 respond_to do |format|215 format.js {216 render(:update) { |page| 217 page.replace_html params[:mode], :partial => 'required_tag_members', :locals => {:objects => objects.sort{|a,b| a.name<=>b.name}.paginate(:page => params[:page],:order => :name) } 218 page.show "#{params[:mode]}_block"219 page.show "toggle_#{params[:mode]}"220 }221 }222 end223 end224 def find_dups(arr)225 temp = {}226 dups = []227 arr.each{|a| temp[a] ? (dups << a) : (temp[a] = 1)}228 return dups229 end230 def dailyreg231 respond_to do |format|232 format.html { @dailyreg_chart = gen_dailyreg(params[:mode]) }233 format.js {234 @dailyreg_chart = gen_dailyreg(params[:mode])235 render(:update) { |page| page.replace_html 'dailyreg_chart', :partial => 'dailyreg_chart' }236 }237 format.json {238 case params[:graph]...

Full Screen

Full Screen

course_section_spec.rb

Source:course_section_spec.rb Github

copy

Full Screen

...31 e.workflow_state = 'active'32 e.save!33 course1.reload34 35 course1.course_sections.find_by_id(cs.id).should_not be_nil36 course2.course_sections.find_by_id(cs.id).should be_nil37 course3.course_sections.find_by_id(cs.id).should be_nil38 e.root_account.should eql(account1)39 e.course.should eql(course1)40 41 cs.move_to_course(course2)42 course1.reload43 course2.reload44 cs.reload45 e.reload46 47 course1.course_sections.find_by_id(cs.id).should be_nil48 course2.course_sections.find_by_id(cs.id).should_not be_nil49 course3.course_sections.find_by_id(cs.id).should be_nil50 e.root_account.should eql(account2)51 e.course.should eql(course2)52 53 cs.move_to_course(course3)54 course1.reload55 course2.reload56 cs.reload57 e.reload58 59 course1.course_sections.find_by_id(cs.id).should be_nil60 course2.course_sections.find_by_id(cs.id).should be_nil61 course3.course_sections.find_by_id(cs.id).should_not be_nil62 e.root_account.should eql(account2)63 e.course.should eql(course3)64 65 cs.move_to_course(course1)66 course1.reload67 course2.reload68 cs.reload69 e.reload70 71 course1.course_sections.find_by_id(cs.id).should_not be_nil72 course2.course_sections.find_by_id(cs.id).should be_nil73 course3.course_sections.find_by_id(cs.id).should be_nil74 e.root_account.should eql(account1)75 e.course.should eql(course1)76 cs.move_to_course(course1)77 course1.reload78 course2.reload79 cs.reload80 e.reload81 82 course1.course_sections.find_by_id(cs.id).should_not be_nil83 course2.course_sections.find_by_id(cs.id).should be_nil84 course3.course_sections.find_by_id(cs.id).should be_nil85 e.root_account.should eql(account1)86 e.course.should eql(course1)87 end88 it "should update user account associations for xlist between subaccounts" do89 root_account = Account.create!(:name => "root")90 sub_account1 = Account.create!(:parent_account => root_account, :name => "account1")91 sub_account2 = Account.create!(:parent_account => root_account, :name => "account2")92 sub_account3 = Account.create!(:parent_account => root_account, :name => "account3")93 course1 = sub_account1.courses.create!(:name => "course1")94 course2 = sub_account2.courses.create!(:name => "course2")95 course3 = sub_account3.courses.create!(:name => "course3")96 cs = course1.course_sections.create!97 cs.nonxlist_course_id.should be_nil98 u = User.create!99 u.register!100 e = course1.enroll_user(u, 'StudentEnrollment', :section => cs)101 u.update_account_associations102 course1.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id].sort103 course2.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account2.id].sort104 course3.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account3.id].sort105 u.reload106 u.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id].sort107 cs.crosslist_to_course(course2)108 course1.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id].sort109 course2.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id, sub_account2.id].sort110 course3.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account3.id].sort111 u.reload112 u.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id, sub_account2.id].sort113 cs.crosslist_to_course(course3)114 cs.nonxlist_course_id.should == course1.id115 course1.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id].sort116 course2.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account2.id].sort117 course3.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id, sub_account3.id].sort118 u.reload119 u.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id, sub_account3.id].sort120 cs.uncrosslist121 cs.nonxlist_course_id.should be_nil122 course1.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id].sort123 course2.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account2.id].sort124 course3.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account3.id].sort125 u.reload126 u.associated_accounts.map(&:id).sort.should == [root_account.id, sub_account1.id]127 end128 129 it "should crosslist and uncrosslist" do130 account1 = Account.create!(:name => "1")131 account2 = Account.create!(:name => "2")132 account3 = Account.create!(:name => "3")133 course1 = account1.courses.create!134 course2 = account2.courses.create!135 course3 = account3.courses.create!136 course2.assert_section137 course3.assert_section138 cs = course1.course_sections.create!139 u = User.create!140 u.register!141 e = course2.enroll_user(u, 'StudentEnrollment')142 e.workflow_state = 'active'143 e.save!144 e = course1.enroll_user(u, 'StudentEnrollment', :section => cs)145 e.workflow_state = 'active'146 e.save!147 course1.reload148 course2.reload149 course3.workflow_state = 'active'150 course3.save151 e.reload152 153 course1.course_sections.find_by_id(cs.id).should_not be_nil154 course2.course_sections.find_by_id(cs.id).should be_nil155 course3.course_sections.find_by_id(cs.id).should be_nil156 cs.account.should be_nil157 cs.nonxlist_course.should be_nil158 e.root_account.should eql(account1)159 cs.crosslisted?.should be_false160 course1.workflow_state.should == 'created'161 course2.workflow_state.should == 'created'162 course3.workflow_state.should == 'created'163 164 cs.crosslist_to_course(course2)165 course1.reload166 course2.reload167 cs.reload168 e.reload169 170 course1.course_sections.find_by_id(cs.id).should be_nil171 course2.course_sections.find_by_id(cs.id).should_not be_nil172 course3.course_sections.find_by_id(cs.id).should be_nil173 cs.account.should be_nil174 cs.nonxlist_course.should eql(course1)175 e.root_account.should eql(account2)176 cs.crosslisted?.should be_true177 course1.workflow_state.should == 'created'178 course2.workflow_state.should == 'created'179 course3.workflow_state.should == 'created'180 181 cs.crosslist_to_course(course3)182 course1.reload183 course2.reload184 course3.reload185 cs.reload186 e.reload187 188 course1.course_sections.find_by_id(cs.id).should be_nil189 course2.course_sections.find_by_id(cs.id).should be_nil190 course3.course_sections.find_by_id(cs.id).should_not be_nil191 cs.account.should be_nil192 cs.nonxlist_course.should eql(course1)193 e.root_account.should eql(account3)194 cs.crosslisted?.should be_true195 course1.workflow_state.should == 'created'196 course2.workflow_state.should == 'created'197 course3.workflow_state.should == 'created'198 199 cs.uncrosslist200 course1.reload201 course2.reload202 course3.reload203 cs.reload204 e.reload205 206 course1.course_sections.find_by_id(cs.id).should_not be_nil207 course2.course_sections.find_by_id(cs.id).should be_nil208 course3.course_sections.find_by_id(cs.id).should be_nil209 cs.account.should be_nil210 cs.nonxlist_course.should be_nil211 e.root_account.should eql(account1)212 cs.crosslisted?.should be_false213 course1.workflow_state.should == 'created'214 course2.workflow_state.should == 'created'215 course3.workflow_state.should == 'created'216 end217 218 it 'should update course account associations on save' do219 account1 = Account.create!(:name => "1")220 account2 = Account.create!(:name => "2")221 course1 = account1.courses.create!222 course2 = account2.courses.create!223 cs1 = course1.course_sections.create!224 CourseAccountAssociation.find_all_by_course_id(course1.id).map(&:account_id).uniq.should == [account1.id]225 CourseAccountAssociation.find_all_by_course_id(course2.id).map(&:account_id).uniq.should == [account2.id]226 cs1.account = account2227 cs1.course.course_sections.reset228 cs1.save229 CourseAccountAssociation.find_all_by_course_id(course1.id).map(&:account_id).uniq.sort.should == [account1.id, account2.id].sort230 CourseAccountAssociation.find_all_by_course_id(course2.id).map(&:account_id).uniq.should == [account2.id]231 cs1.account = nil232 cs1.course.course_sections.reset233 cs1.save234 CourseAccountAssociation.find_all_by_course_id(course1.id).map(&:account_id).uniq.should == [account1.id]235 CourseAccountAssociation.find_all_by_course_id(course2.id).map(&:account_id).uniq.should == [account2.id]236 cs1.crosslist_to_course(course2)237 CourseAccountAssociation.find_all_by_course_id(course1.id).map(&:account_id).uniq.should == [account1.id]238 CourseAccountAssociation.find_all_by_course_id(course2.id).map(&:account_id).uniq.sort.should == [account1.id, account2.id].sort239 end240end...

Full Screen

Full Screen

xlist_importer_spec.rb

Source:xlist_importer_spec.rb Github

copy

Full Screen

...44 process_csv_data_cleanly(45 "xlist_course_id,section_id,status",46 "X001,S001,active"47 )48 Course.find_by_sis_source_id("X001").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A001').id, Account.find_by_sis_source_id('A004').id, @account.id].sort49 process_csv_data_cleanly(50 "xlist_course_id,section_id,status",51 "X001,S001,deleted"52 )53 Course.find_by_sis_source_id("X001").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A001').id, @account.id].sort54 end55 it 'should have proper account associations when being undeleted' do56 process_csv_data_cleanly(57 "section_id,course_id,name,start_date,end_date,status,account_id",58 "S001,C002,Sec1,2011-1-05 00:00:00,2011-4-14 00:00:00,active,A004",59 "S002,C002,Sec2,2011-1-05 00:00:00,2011-4-14 00:00:00,active,A004"60 )61 process_csv_data_cleanly(62 "xlist_course_id,section_id,status",63 "X001,S001,active"64 )65 Course.find_by_sis_source_id("X001").deleted?.should be_false66 process_csv_data_cleanly(67 "course_id,short_name,long_name,account_id,term_id,status",68 "X001,TC 101,Test Course 101,,,deleted"69 )70 Course.find_by_sis_source_id("X001").deleted?.should be_true71 process_csv_data_cleanly(72 "xlist_course_id,section_id,status",73 "X001,S002,active"74 )75 Course.find_by_sis_source_id("X001").deleted?.should be_false76 Course.find_by_sis_source_id("X001").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A001').id, Account.find_by_sis_source_id('A004').id, @account.id].sort77 end78 it 'should have proper account associations when a section is added and then removed' do79 process_csv_data_cleanly(80 "section_id,course_id,name,start_date,end_date,status,account_id",81 "S001,C001,Sec1,2011-1-05 00:00:00,2011-4-14 00:00:00,active,A004"82 )83 Course.find_by_sis_source_id("C001").associated_accounts.map(&:id).sort.should == [@account.id, Account.find_by_sis_source_id('A004').id].sort84 Course.find_by_sis_source_id("C002").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A001').id, @account.id].sort85 process_csv_data_cleanly(86 "xlist_course_id,section_id,status",87 "C002,S001,active"88 )89 Course.find_by_sis_source_id("C001").associated_accounts.map(&:id).should == [@account.id]90 Course.find_by_sis_source_id("C002").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A001').id, Account.find_by_sis_source_id('A004').id, @account.id].sort91 process_csv_data_cleanly(92 "xlist_course_id,section_id,status",93 "C002,S001,deleted"94 )95 Course.find_by_sis_source_id("C001").associated_accounts.map(&:id).sort.should == [@account.id, Account.find_by_sis_source_id('A004').id].sort96 Course.find_by_sis_source_id("C002").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A001').id, @account.id].sort97 end98 it 'should get account associations updated when the template course is updated' do99 process_csv_data_cleanly(100 "section_id,course_id,name,start_date,end_date,status,account_id",101 "S001,C001,Sec1,2011-1-05 00:00:00,2011-4-14 00:00:00,active"102 )103 process_csv_data_cleanly(104 "xlist_course_id,section_id,status",105 "X001,S001,active"106 )107 Course.find_by_sis_source_id("C001").associated_accounts.map(&:id).should == [@account.id]108 Course.find_by_sis_source_id("X001").associated_accounts.map(&:id).should == [@account.id]109 process_csv_data_cleanly(110 "course_id,short_name,long_name,account_id,term_id,status",111 "C001,TC 101,Test Course 101,A004,,active"112 )113 Course.find_by_sis_source_id("C001").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A004').id, @account.id].sort114 Course.find_by_sis_source_id("X001").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A004').id, @account.id].sort115 process_csv_data_cleanly(116 "course_id,short_name,long_name,account_id,term_id,status",117 "C001,TC 101,Test Course 101,A001,,active"118 )119 Course.find_by_sis_source_id("C001").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A001').id, @account.id].sort120 Course.find_by_sis_source_id("X001").associated_accounts.map(&:id).sort.should == [Account.find_by_sis_source_id('A001').id, @account.id].sort121 end122 it 'should import active enrollments with states based on enrollment date restrictions' do123 process_csv_data_cleanly(124 "term_id,name,status,start_date,end_date",125 "T001,Winter13,active,#{2.days.from_now.strftime("%Y-%m-%d 00:00:00")},#{4.days.from_now.strftime("%Y-%m-%d 00:00:00")}"126 )127 process_csv_data_cleanly(128 "course_id,short_name,long_name,account_id,term_id,status",129 "C001,TC 101,Test Course 101,,T001,active"130 )131 process_csv_data_cleanly(132 "user_id,login_id,first_name,last_name,email,status",133 "user_1,user1,User,Uno,user@example.com,active"134 )135 process_csv_data_cleanly(136 "course_id,user_id,role,section_id,status,associated_user_id",137 "C001,user_1,student,,active,"138 )139 course = Course.find_by_sis_source_id("C001")140 course.enrollments.length.should == 1141 course.enrollments.first.state_based_on_date.should == :inactive142 end143 it "should allow enrollments on crosslisted sections' original course" do144 process_csv_data_cleanly(145 "user_id,login_id,first_name,last_name,email,status",146 "user_1,user1,User,Uno,user@example.com,active"147 )148 process_csv_data_cleanly(149 "section_id,course_id,name,status,start_date,end_date",150 "S001,C001,Sec1,active,,"151 )152 process_csv_data_cleanly(153 "course_id,user_id,role,section_id,status,associated_user_id",154 "C001,user_1,student,S001,active,"155 )156 @account.courses.find_by_sis_source_id("C001").students.first.name.should == "User Uno"157 @account.courses.find_by_sis_source_id("X001").should be_nil158 process_csv_data_cleanly(159 "xlist_course_id,section_id,status",160 "X001,S001,active"161 )162 process_csv_data_cleanly(163 "course_id,user_id,role,section_id,status,associated_user_id",164 "C001,user_1,student,S001,active,"165 )166 @account.courses.find_by_sis_source_id("C001").students.size.should == 0167 @account.courses.find_by_sis_source_id("X001").students.first.name.should == "User Uno"168 end169 end170end...

Full Screen

Full Screen

find

Using AI Code Generation

copy

Full Screen

1s.find(3)2 def find(x)3s.find(3)4 def find(x)5s.find(3)6 def find(x)

Full Screen

Full Screen

find

Using AI Code Generation

copy

Full Screen

1Sort.find(a, 3)2Sort.find(a, 0)3Sort.find(a, 10)4def self.find(a, i)5 def self.find(a, i)6Sort.find(a, 3)7Sort.find(a, 0)8Sort.find(a, 10)

Full Screen

Full Screen

find

Using AI Code Generation

copy

Full Screen

1sorted_array = Sort.find(array)2sorted_array = Sort.find(array)3array = [{:name => 'one'}, {:name => 'two'}, {:name => 'three'}, {:name => 'four'}, {:name => 'five'}]4sorted_array = Sort.find(array)5sorted_array = Sort.find(array)6 def initialize(name)7array = [Person.new('one'), Person.new('two'), Person.new('three'), Person.new('four'), Person.new('five')]8sorted_array = Sort.find(array)9array = [1, 'two', {:name => 'three'}, ['four'], Person.new('five')]10sorted_array = Sort.find(array)11array = [1, 'two', {:name => 'three'}, ['four'], Person.new('five')]12sorted_array = Sort.find(array)13array = [1, 'two', {:name => 'three'}, ['four'], Person.new('five')]14sorted_array = Sort.find(array)15array = [1, 'two', {:name => 'three'}, ['four'], Person.new('five')]16sorted_array = Sort.find(array)17array = [1, 'two', {:name => 'three'}, ['four'], Person.new('five')]

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful