Created
July 8, 2013 19:36
-
-
Save stevenabrooks/5951815 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fis/test' | |
include Fis::Test | |
class Dog | |
attr_accessor :name, :species, :colors, :fur_length | |
def initialize(attributes_hash) | |
attributes_hash.each { |k,v| self.send ("#{k}=").to_sym, v } | |
end | |
end | |
############# | |
# Testbench # | |
############# | |
test 'can mass assign' do | |
d = Dog.new(:name => "Avi") | |
assert_equal d.name, "Avi" | |
end | |
test 'can mass assign more' do | |
d = Dog.new(:name => "Avi", :species => "whatever", :colors => "whatever") | |
assert_equal d.name, "Avi" | |
assert_equal d.species, "whatever" | |
assert_equal d.colors, "whatever" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment