Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Commit

Permalink
Setup MiniTest. Let unknown attributes be ignored during initializati…
Browse files Browse the repository at this point in the history
…on in RunKeeper::Activity
  • Loading branch information
tatey committed Sep 7, 2011
1 parent b1ecc5c commit 705f06f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
25 changes: 24 additions & 1 deletion Rakefile
@@ -1 +1,24 @@
require 'bundler/gem_tasks'
begin
require 'rubygems'
require 'bundler'
rescue LoadError
raise 'Could not load the bundler gem. Install it with `gem install bundler`.'
end

begin
Bundler.setup
rescue Bundler::GemNotFound
raise RuntimeError, "Bundler couldn't find some gems." +
"Did you run `bundle install`?"
end

Bundler::GemHelper.install_tasks

require 'rake/testtask'

Rake::TestTask.new(:test) do |test|
test.libs << 'test'
test.pattern = 'test/**/*_test.rb'
end

task :default => :test
2 changes: 1 addition & 1 deletion lib/run_keeper/activity.rb
Expand Up @@ -5,7 +5,7 @@ class Activity

def initialize attributes = {}
attributes.each do |attribute, value|
send :"#{attribute}=", value
send :"#{attribute}=", value if respond_to? :"#{attribute}="
end
end

Expand Down
1 change: 1 addition & 0 deletions run_keeper.gemspec
Expand Up @@ -16,6 +16,7 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_development_dependency 'rake', '~> 0.9.2'
s.add_dependency 'activesupport', '~> 3.1.0'
s.add_dependency 'oauth2', '~> 0.5.0'
end
7 changes: 7 additions & 0 deletions test/activity_test.rb
@@ -0,0 +1,7 @@
require 'helper'

class ActivityTest < MiniTest::Unit::TestCase
def test_initailization_ignores_unknown_attributes
refute_match Activity.new(:foo => 'bar').instance_variables, /foo/
end
end
4 changes: 4 additions & 0 deletions test/helper.rb
@@ -0,0 +1,4 @@
require 'minitest/autorun'
require 'run_keeper'

include RunKeeper

0 comments on commit 705f06f

Please sign in to comment.