Skip to content

Commit

Permalink
add minitest and other development dependencies, start testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhsu committed Mar 18, 2013
1 parent 9c2b686 commit 208f7c1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
source :rubygems
gem 'httparty'
source "https://rubygems.org"

gemspec
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'rake/testtask'

Rake::TestTask.new do |t|
t.libs << "test" << "lib"
t.test_files = FileList['test/*_test.rb']
end

task :default => :test
2 changes: 2 additions & 0 deletions ducksboard.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 1.8.7'

s.add_runtime_dependency 'httparty', '~> 0.8', '>= 0.8.1'
s.add_development_dependency 'rake', '~> 10.0'
s.add_development_dependency 'minitest', '~> 4.6.2'

s.post_install_message = <<-DESC
Quack! (in real-time)"
Expand Down
4 changes: 3 additions & 1 deletion lib/ducksboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

module Ducksboard
class << self ; attr_accessor :api_key end
@api_key = ENV['DUCKSBOARD_API_KEY']
def self.api_key
@api_key ||= ENV['DUCKSBOARD_API_KEY']
end
end

require 'ducksboard/widget'
Expand Down
13 changes: 13 additions & 0 deletions test/ducksboard_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'minitest_helper'

describe Ducksboard do
it "should get api key from env" do
ENV['DUCKSBOARD_API_KEY'] = "123"
Ducksboard.api_key.must_equal "123"
end

it "can set api key directly" do
Ducksboard.api_key = "123"
Ducksboard.api_key.must_equal "123"
end
end
4 changes: 4 additions & 0 deletions test/minitest_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'minitest/spec'
require 'minitest/autorun'

require 'ducksboard'

0 comments on commit 208f7c1

Please sign in to comment.