Skip to content

Commit

Permalink
Add basic fixtures, and one basic test
Browse files Browse the repository at this point in the history
- Fixtures for creating 10 alumni, studmems and coords
- One basic test for checking if the alumni were created or not.
  • Loading branch information
icyflame committed Apr 23, 2015
1 parent de3c5e3 commit 6fb5bb0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 35 deletions.
10 changes: 5 additions & 5 deletions test/fixtures/admin_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
# one: {}
# # column: value
# #
# two: {}
# # column: value
17 changes: 7 additions & 10 deletions test/fixtures/alumnis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
name: MyString
year: MyString
hall: MyString

two:
name: MyString
year: MyString
hall: MyString
<% 10.times do |n| %>
alumni_<%= n %>:
id: <%= "#{n}" %>
name: <%= "alumni#{n}" %>
year: <%= "#{n}" %>
hall: SH
<% end %>
18 changes: 8 additions & 10 deletions test/fixtures/coordinators.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
name: MyString
rollnum: MyString
portfolio: MyString

two:
name: MyString
rollnum: MyString
portfolio: MyString
<% 10.times do |n| %>
coordinator_<%= n %>:
id: <%= "#{n}" %>
name: <%= "coordinator#{n}" %>
rollnum: <%= "coordinator#{n}" %>
portfolio: Some portfolio
email: <%= "coordintor#{n}@g.com" %>
<% end %>
18 changes: 8 additions & 10 deletions test/fixtures/student_members.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
name: MyString
rollnum: MyString
portfolio: MyString

two:
name: MyString
rollnum: MyString
portfolio: MyString
<% 10.times do |n| %>
student_<%= n %>:
id: <%= "#{n}" %>
name: <%= "student#{n}" %>
rollnum: <%= "student#{n}" %>
portfolio: Some portfolio
email: <%= "coordintor#{n}@g.com" %>
<% end %>
16 changes: 16 additions & 0 deletions test/models/alumni_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
require 'test_helper'

class AlumniTest < ActiveSupport::TestCase

test "number_of_records_being_created" do
a = Alumni.count
assert_equal a, 10, "The ten alumni were not created"
end

test "records_being_created" do
a = Alumni.where({ :name => "alumni1" })
assert_equal a, 10, "The ID is not equal"
end

# test "validations_of_columns" do
# alumni = Alumni.new
# alumni.name = "Something"
# assert_not alumni.save, "The alumni was saved even though there was no hall or department given."
# end
# test "the truth" do
# assert true
# end
Expand Down

0 comments on commit 6fb5bb0

Please sign in to comment.