Skip to content

Commit

Permalink
adding basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
weavenet committed Feb 15, 2013
1 parent 089af3b commit 365b77b
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
require "bundler/gem_tasks"

require 'rspec/core/rake_task'

desc 'Run specs'
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = %w(--color)
end
File renamed without changes.
1 change: 1 addition & 0 deletions lib/ruby-trello-cli/cli.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'optparse'

require 'ruby-trello-cli/cli/shared'

require 'ruby-trello-cli/cli/card'
require 'ruby-trello-cli/cli/list'
require 'ruby-trello-cli/cli/run'
18 changes: 12 additions & 6 deletions lib/ruby-trello-cli/cli/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ def initialize
end

def create
puts create_card
card = create_card
name = card.attributes[:name]
description = card.attributes[:description]

puts "Card Created."
puts "Name : #{name}"
puts "Description : #{description}"
end

private

def create_card
card = Trello::Board.new 'name' => @options[:name],
'description' => @options[:description],
'idBoard' => @options[:board_id],
'idList' => @options[:list_id]
card = Trello::Card.new 'name' => @options[:name],
'desc' => @options[:description],
'idBoard' => @options[:board_id],
'idList' => @options[:list_id]
card.save
end

Expand All @@ -43,7 +49,7 @@ def parse_options
end

opts.on("-l", "--list [LIST]", "List Of Card") do |l|
@options[:list] = l
@options[:list_id] = l
end

opts.on("-n", "--name [NAME]", "Name Of Card") do |n|
Expand Down
2 changes: 0 additions & 2 deletions lib/ruby-trello-cli/cli/shared.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'ruby-trello-cli/cli/card'

module RubyTrelloCli
module CLI
module Shared
Expand Down
18 changes: 18 additions & 0 deletions spec/cli/shared_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'spec_helper'

describe RubyTrelloCli::CLI::Shared do

before do
@object = Object.new
@object.extend RubyTrelloCli::CLI::Shared
end

it "should connect to trello" do
@object.stub :key => 'dakey',
:token => 'datoken'

Trello.should_receive(:configure)

@object.connect_to_trello
end
end
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'rubygems'
require 'bundler/setup'

require 'ruby-trello-cli'

0 comments on commit 365b77b

Please sign in to comment.