Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase binder-app test coverage #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions app/models/checkout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@
class Checkout < ActiveRecord::Base
include Messenger

# For lookups
def card_number=( card_number )
@card_number = card_number
end

def card_number
@card_number
end

validates_presence_of :tool, :organization
validates_associated :tool, :organization, :participant

Expand Down
8 changes: 0 additions & 8 deletions app/models/participant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ def booth_chair_organizations
def is_scc?
!organizations.find_by(name: "Spring Carnival Committee").blank?
end

def card_number=( card_number )
@card_number = card_number
end

def card_number
@card_number
end

def name
cached_name
Expand Down
9 changes: 0 additions & 9 deletions app/models/shift_participant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,4 @@ class ShiftParticipant < ActiveRecord::Base

scope :checked_in_late, lambda{ joins(:shift).where('starts_at < ? AND clocked_in_at > starts_at', Time.zone.now)}

# For lookups
def card_number=( card_number )
@card_number = card_number
end

def card_number
@card_number
end

end
8 changes: 7 additions & 1 deletion test/unit/participant_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ParticipantTest < ActiveSupport::TestCase
context "With a proper context, " do
setup do
@participant = FactoryGirl.create(:participant, :phone_number => 1234567890, :andrewid => "saclark", :cached_name => "Stephen Clark", :waiver_start => DateTime.now - 10.minutes)
@organization_category = FactoryGirl.create(:organization_category)
@organization_category = FactoryGirl.create(:organization_category, :is_building => true)
@organization = FactoryGirl.create(:organization, :name => "Spring Carnival Committee", :organization_category => @organization_category)
@temp_participant = FactoryGirl.create(:participant)
@membership = FactoryGirl.create(:membership, :is_booth_chair => true, :participant => @participant, :organization => @organization)
Expand Down Expand Up @@ -111,6 +111,12 @@ class ParticipantTest < ActiveSupport::TestCase

assert_equal true, @temp_participant.is_waiver_cheater?
end

should "show that booth_chair_organizations method works correctly" do
assert_equal [@organization], @participant.booth_chair_organizations

assert_equal [], @temp_participant.booth_chair_organizations
end

should "show that is_booth_chair method works correctly" do
assert_equal true, @participant.is_booth_chair?
Expand Down
3 changes: 2 additions & 1 deletion test/unit/tool_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ToolTest < ActiveSupport::TestCase
@shannon_participant = FactoryGirl.create(:participant)

# Create 6 tools
@hammer = FactoryGirl.create(:tool, :barcode => 12811)
@hammer = FactoryGirl.create(:tool, :barcode => 12811, :description => "")

@saw_type = FactoryGirl.create(:tool_type, name: 'Saw')
@saw = FactoryGirl.create(:tool, :barcode => 12390, :description => "SAW", tool_type: @saw_type)
Expand Down Expand Up @@ -151,6 +151,7 @@ class ToolTest < ActiveSupport::TestCase
should "show that that the method formatted name works" do
assert_equal '12810: Radio - RADIO', @radio.formatted_name
assert_equal '12012: Ladder - LADDER', @ladder.formatted_name
assert_equal '12811: Hammer', @hammer.formatted_name
end

end
Expand Down