bell 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rvmrc +1 -1
- data/CHANGELOG.org +4 -0
- data/Gemfile.lock +23 -26
- data/README.org +62 -49
- data/Rakefile +4 -8
- data/bell.gemspec +7 -8
- data/features/full_report.feature +2 -2
- data/features/step_definitions/cli_steps.rb +2 -2
- data/features/support/env.rb +6 -8
- data/lib/bell.rb +2 -4
- data/lib/bell/commands.rb +5 -5
- data/lib/bell/commands/contact_command.rb +2 -2
- data/lib/bell/csv_parser.rb +2 -2
- data/lib/bell/full_report.rb +1 -2
- data/lib/bell/handlers.rb +4 -4
- data/lib/bell/version.rb +3 -0
- data/spec/bell/cli_spec.rb +1 -1
- data/spec/bell/commands/command_spec.rb +1 -1
- data/spec/bell/commands/contact_command_spec.rb +1 -1
- data/spec/bell/commands/implosion_command_spec.rb +1 -1
- data/spec/bell/commands/report_command_spec.rb +1 -1
- data/spec/bell/commands/user_command_spec.rb +1 -1
- data/spec/bell/csv_parser_spec.rb +3 -3
- data/spec/bell/dispatcher_spec.rb +1 -1
- data/spec/bell/full_report_spec.rb +1 -1
- data/spec/bell/handlers/contacts_handler_spec.rb +2 -4
- data/spec/bell/handlers/implosions_handler_spec.rb +1 -1
- data/spec/bell/handlers/reports_handler_spec.rb +1 -1
- data/spec/bell/handlers/users_handler_spec.rb +3 -2
- data/spec/bell/user_contact_spec.rb +1 -1
- data/spec/bell/user_report_spec.rb +1 -1
- data/spec/bell/user_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -16
- metadata +70 -87
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm 1.9.2@bell --create
|
1
|
+
rvm 1.9.2-p290@bell --create
|
data/CHANGELOG.org
ADDED
data/Gemfile.lock
CHANGED
@@ -1,47 +1,44 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bell (0.0
|
4
|
+
bell (0.1.0)
|
5
5
|
embratel (= 1.1.2)
|
6
|
-
sequel (= 3.
|
7
|
-
sqlite3
|
6
|
+
sequel (= 3.27.0)
|
7
|
+
sqlite3 (= 1.3.4)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
11
11
|
specs:
|
12
12
|
builder (3.0.0)
|
13
|
-
cucumber (
|
13
|
+
cucumber (1.1.0)
|
14
14
|
builder (>= 2.1.2)
|
15
15
|
diff-lcs (>= 1.1.2)
|
16
|
-
gherkin (
|
16
|
+
gherkin (~> 2.5.0)
|
17
17
|
json (>= 1.4.6)
|
18
|
-
term-ansicolor (>= 1.0.
|
19
|
-
diff-lcs (1.1.
|
18
|
+
term-ansicolor (>= 1.0.6)
|
19
|
+
diff-lcs (1.1.3)
|
20
20
|
embratel (1.1.2)
|
21
|
-
gherkin (2.
|
21
|
+
gherkin (2.5.1)
|
22
22
|
json (>= 1.4.6)
|
23
|
-
json (1.
|
24
|
-
rake (0.
|
25
|
-
rspec (2.
|
26
|
-
rspec-core (~> 2.
|
27
|
-
rspec-expectations (~> 2.
|
28
|
-
rspec-mocks (~> 2.
|
29
|
-
rspec-core (2.
|
30
|
-
rspec-expectations (2.
|
23
|
+
json (1.6.1)
|
24
|
+
rake (0.9.2)
|
25
|
+
rspec (2.6.0)
|
26
|
+
rspec-core (~> 2.6.0)
|
27
|
+
rspec-expectations (~> 2.6.0)
|
28
|
+
rspec-mocks (~> 2.6.0)
|
29
|
+
rspec-core (2.6.4)
|
30
|
+
rspec-expectations (2.6.0)
|
31
31
|
diff-lcs (~> 1.1.2)
|
32
|
-
rspec-mocks (2.
|
33
|
-
sequel (3.
|
34
|
-
sqlite3 (1.3.
|
35
|
-
|
36
|
-
sqlite3 (>= 1.3.3)
|
37
|
-
term-ansicolor (1.0.5)
|
32
|
+
rspec-mocks (2.6.0)
|
33
|
+
sequel (3.27.0)
|
34
|
+
sqlite3 (1.3.4)
|
35
|
+
term-ansicolor (1.0.6)
|
38
36
|
|
39
37
|
PLATFORMS
|
40
38
|
ruby
|
41
39
|
|
42
40
|
DEPENDENCIES
|
43
41
|
bell!
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
rspec (= 2.5.0)
|
42
|
+
cucumber (= 1.1.0)
|
43
|
+
rake (= 0.9.2)
|
44
|
+
rspec (= 2.6.0)
|
data/README.org
CHANGED
@@ -1,51 +1,45 @@
|
|
1
1
|
* bell
|
2
2
|
Tenha controle sobre as suas faturas de telefone da Embratel.
|
3
3
|
|
4
|
-
** Instalando
|
4
|
+
** Instalando
|
5
5
|
#+BEGIN_SRC
|
6
|
-
gem install bell
|
6
|
+
$ gem install bell
|
7
7
|
#+END_SRC
|
8
8
|
Você precisa ter o ruby e o rubygems instalados.
|
9
9
|
|
10
|
-
** Como
|
11
|
-
|
12
|
-
Estes dados combinados com
|
13
|
-
obter
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
usuário)
|
24
|
-
- o valor total, e todas as ligações desconhecidas (não presentes em
|
25
|
-
nenhuma lista de contatos)
|
26
|
-
|
27
|
-
** Como Usar
|
28
|
-
*** Criando Usuários
|
10
|
+
** Como isso pode me ajudar?
|
11
|
+
bell permite que você crie e mantenha usuários e suas listas de contatos.
|
12
|
+
Estes dados combinados com arquivos de fatura da embratel lhe permitem
|
13
|
+
obter informações como:
|
14
|
+
|
15
|
+
- o total e o valor de ligações feita por usuários, assim como quais os
|
16
|
+
contatos ligados
|
17
|
+
- totais e valores de ligações conhecidas, desconhecidas e públicas
|
18
|
+
- quanto foi gasto em ligações para um determinado número e quanto
|
19
|
+
foi gasto em cada uma das ligações para esse número
|
20
|
+
|
21
|
+
** Como usar
|
22
|
+
*** Criando usuários
|
29
23
|
#+BEGIN_SRC
|
30
24
|
$ bell user create joão
|
31
25
|
Usuário 'joão' criado.
|
32
26
|
#+END_SRC
|
33
27
|
|
34
|
-
|
28
|
+
Você agora pode ver o joão na lista de usuários
|
35
29
|
#+BEGIN_SRC
|
36
30
|
$ bell user list
|
37
31
|
joão
|
38
32
|
#+END_SRC
|
39
33
|
|
40
|
-
*** Importando
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
34
|
+
*** Importando contatos
|
35
|
+
Com o usuário 'joão' criado você pode importar a lista de contatos dele.
|
36
|
+
A lista de contatos deve ser um arquivo CSV, onde cada linha deste arquivo
|
37
|
+
representa um contato, sendo a primeira coluna o nome e a segunda o número
|
38
|
+
de telefone.
|
45
39
|
|
46
40
|
Exemplo:
|
47
|
-
#+CAPTION: Lista de contatos
|
48
|
-
[[http://
|
41
|
+
#+CAPTION: Lista de contatos do 'joão'
|
42
|
+
[[http://dl.dropbox.com/u/14256545/contact_list.png]]
|
49
43
|
|
50
44
|
Repare que o formato do número de telefone deve ser uma sequência de 10
|
51
45
|
dígitos, sendo os dois primeiros o DDD e os oito últimos o número em si.
|
@@ -54,28 +48,47 @@ joão
|
|
54
48
|
um usuário
|
55
49
|
#+BEGIN_SRC
|
56
50
|
$ bell contact import /path/para/lista/de/contatos.csv -u joão
|
51
|
+
'Mãe (1192341234)' adicionado à lista de contatos do usuário 'joão'.
|
52
|
+
'Pai (1192344321)' adicionado à lista de contatos do usuário 'joão'.
|
53
|
+
'Cecília Meireles (2183219978)' adicionado à lista de contatos do usuário 'joão'.
|
54
|
+
'José de Alencar (8581235432)' adicionado à lista de contatos do usuário 'joão'.
|
55
|
+
'Clarice Lispector (2183215768)' adicionado à lista de contatos do usuário 'joão'.
|
56
|
+
'Euclides da Cunha (1992564132)' adicionado à lista de contatos do usuário 'joão'.
|
57
|
+
'Augusto dos Anjos (8382445678)' adicionado à lista de contatos do usuário 'joão'.
|
58
|
+
'Graciette Salmon (4191826645)' adicionado à lista de contatos do usuário 'joão'.
|
59
|
+
'Machado de Assis (2183218765)' adicionado à lista de contatos do usuário 'joão'.
|
57
60
|
#+END_SRC
|
58
61
|
|
59
|
-
Agora ao listar os contatos do joão você pode ver os contatos que acabou
|
62
|
+
Agora ao listar os contatos do 'joão' você pode ver os contatos que acabou
|
60
63
|
de importar
|
61
64
|
#+BEGIN_SRC
|
62
65
|
$ bell contact list -u joão
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
Mãe (1192341234)
|
67
|
+
Pai (1192344321)
|
68
|
+
Cecília Meireles (2183219978)
|
69
|
+
José de Alencar (8581235432)
|
70
|
+
Clarice Lispector (2183215768)
|
71
|
+
Euclides da Cunha (1992564132)
|
72
|
+
Augusto dos Anjos (8382445678)
|
73
|
+
Graciette Salmon (4191826645)
|
74
|
+
Machado de Assis (2183218765)
|
69
75
|
#+END_SRC
|
70
76
|
|
71
|
-
Com um usuário e sua lista de contatos você pode
|
72
|
-
|
77
|
+
Com um usuário e sua lista de contatos você já pode visualizar
|
78
|
+
relatórios, usando os arquivos de fatura da Embratel.
|
79
|
+
|
80
|
+
Para importar a lista de contatos divididos entre todos os usuários
|
81
|
+
#+BEGIN_SRC
|
82
|
+
$ bell contact import /path/para/lista/de/contatos.csv -p
|
83
|
+
#+END_SRC
|
84
|
+
#
|
85
|
+
#+BEGIN_SRC
|
73
86
|
|
74
87
|
*** Fatura da Embratel
|
75
88
|
A Embratel fornece faturas de conta de telefone em seu
|
76
89
|
[[http://fatura.embratel.net.br/embratel/index.html][serviço online]].
|
77
90
|
Para extrair informações sobre uma fatura, você precisará do arquivo
|
78
|
-
|
91
|
+
CSV de um dado mês.
|
79
92
|
**** Como obter o arquivo da fatura?
|
80
93
|
- [[http://fatura.embratel.net.br/embratel/jsp/selectClientRegister.jsp][cadastre-se]] se você não possui uma conta
|
81
94
|
- logue no site
|
@@ -86,18 +99,18 @@ Francisco Côco (6666666666)
|
|
86
99
|
Com usuários e suas respectivas listas de contatos criados você pode
|
87
100
|
visualizar diversos tipos de relatórios para a fatura de um dado mês.
|
88
101
|
|
89
|
-
***
|
90
|
-
|
102
|
+
*** Relatórios
|
103
|
+
**** Completo
|
91
104
|
#+BEGIN_SRC
|
92
105
|
$ bell report /path/para/fatura.csv
|
93
106
|
#+END_SRC
|
94
107
|
|
95
|
-
|
108
|
+
**** De usuário
|
96
109
|
#+BEGIN_SRC
|
97
110
|
$ bell report /path/para/fatura.csv -u joão
|
98
111
|
#+END_SRC
|
99
112
|
|
100
|
-
|
113
|
+
**** De ligação
|
101
114
|
#+BEGIN_SRC
|
102
115
|
$ bell report /path/para/fatura.csv -n 1111111111
|
103
116
|
#+END_SRC
|
@@ -105,19 +118,19 @@ $ bell report /path/para/fatura.csv -n 1111111111
|
|
105
118
|
** Para rodar os testes
|
106
119
|
*** Pegue o código
|
107
120
|
#+BEGIN_SRC
|
108
|
-
git clone git://github.com/
|
109
|
-
cd bell
|
121
|
+
$ git clone git://github.com/mpereira/bell.git
|
122
|
+
$ cd bell
|
110
123
|
#+END_SRC
|
111
124
|
|
112
125
|
*** Instale o bundler e as dependências (se já não estiverem instaladas)
|
113
126
|
#+BEGIN_SRC
|
114
|
-
gem install bundler
|
115
|
-
bundle install
|
127
|
+
$ gem install bundler
|
128
|
+
$ bundle install
|
116
129
|
#+END_SRC
|
117
130
|
|
118
131
|
*** Rode os testes
|
119
132
|
#+BEGIN_SRC
|
120
|
-
rake
|
133
|
+
$ rake
|
121
134
|
#+END_SRC
|
122
135
|
|
123
136
|
** Autor
|
@@ -125,4 +138,4 @@ rake
|
|
125
138
|
|
126
139
|
** Licença
|
127
140
|
Distribuído sob a
|
128
|
-
[[http://github.com/
|
141
|
+
[[http://github.com/mpereira/embratel/blob/master/MIT-LICENSE][licença MIT]].
|
data/Rakefile
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup(:default, :development)
|
3
3
|
|
4
|
-
require '
|
5
|
-
|
6
|
-
Spec::Rake::SpecTask.new('spec') do |t|
|
7
|
-
t.spec_opts = %w[--backtrace --colour]
|
8
|
-
t.spec_files = FileList['spec/**/*.rb']
|
9
|
-
end
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
6
|
|
11
7
|
require 'cucumber/rake/task'
|
12
8
|
Cucumber::Rake::Task.new(:features) do |features|
|
data/bell.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require File.expand_path('../lib/bell', __FILE__)
|
3
|
+
require File.expand_path('../lib/bell/version', __FILE__)
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'bell'
|
@@ -8,20 +8,19 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.author = 'Murilo Pereira'
|
10
10
|
s.email = 'murilo@murilopereira.com'
|
11
|
-
s.homepage = 'https://github.com/
|
11
|
+
s.homepage = 'https://github.com/mpereira/bell'
|
12
12
|
s.summary = 'Tenha controle sobre as suas faturas de telefone da Embratel.'
|
13
13
|
|
14
14
|
s.required_rubygems_version = '>= 1.3.6'
|
15
15
|
|
16
|
-
s.add_development_dependency('
|
17
|
-
s.add_development_dependency('
|
18
|
-
s.add_development_dependency('
|
19
|
-
s.add_development_dependency('rspec', '2.5.0')
|
16
|
+
s.add_development_dependency('cucumber', '1.1.0')
|
17
|
+
s.add_development_dependency('rake', '0.9.2')
|
18
|
+
s.add_development_dependency('rspec', '2.6.0')
|
20
19
|
|
21
20
|
s.add_dependency('embratel', '1.1.2')
|
22
21
|
s.add_dependency('fastercsv', '1.5.4') if RUBY_VERSION < '1.9'
|
23
|
-
s.add_dependency('sequel', '3.
|
24
|
-
s.add_dependency('sqlite3
|
22
|
+
s.add_dependency('sequel', '3.27.0')
|
23
|
+
s.add_dependency('sqlite3', '1.3.4')
|
25
24
|
|
26
25
|
s.files = `git ls-files`.split("\n")
|
27
26
|
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Given /^a directory named "([^"]*)"$/ do |name|
|
2
|
-
|
2
|
+
inside_tmp_directory do
|
3
3
|
FileUtils.mkdir(name)
|
4
4
|
end
|
5
5
|
end
|
6
6
|
|
7
7
|
Given /^a file named "([^"]*)" with:$/ do |file, content|
|
8
|
-
|
8
|
+
inside_tmp_directory do
|
9
9
|
file = File.new(file, 'w+') << content
|
10
10
|
file.flush
|
11
11
|
end
|
data/features/support/env.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
require 'bell'
|
1
|
+
require File.expand_path('../../../lib/bell', __FILE__)
|
3
2
|
|
4
|
-
TMP_PATH = File.
|
3
|
+
TMP_PATH = File.path('/tmp/bell')
|
4
|
+
FIXTURES_PATH = File.expand_path('../../../spec/fixtures', __FILE__)
|
5
5
|
|
6
6
|
After('@no-txn') do
|
7
7
|
Given 'a clean slate'
|
@@ -18,9 +18,7 @@ at_exit do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
module Bell::StepDefinitionHelper
|
21
|
-
|
22
|
-
|
23
|
-
def inside_the_tmp_directory(&block)
|
21
|
+
def inside_tmp_directory(&block)
|
24
22
|
FileUtils.chdir(TMP_PATH, &block)
|
25
23
|
end
|
26
24
|
|
@@ -53,12 +51,12 @@ module Bell::StepDefinitionHelper
|
|
53
51
|
end
|
54
52
|
|
55
53
|
def random_name
|
56
|
-
(0...8).map{65
|
54
|
+
(0...8).map { (65 + (rand(25))).chr }.join
|
57
55
|
end
|
58
56
|
|
59
57
|
def random_number
|
60
58
|
charset = %w[0 1 2 3 4 5 6 7 9]
|
61
|
-
(0...10).map{ charset.to_a[rand(charset.size)] }.join
|
59
|
+
(0...10).map { charset.to_a[rand(charset.size)] }.join
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
data/lib/bell.rb
CHANGED
@@ -12,8 +12,6 @@ require 'fileutils'
|
|
12
12
|
module Bell
|
13
13
|
extend self
|
14
14
|
|
15
|
-
VERSION = '0.0.1'
|
16
|
-
|
17
15
|
class InvalidContacts < StandardError; end
|
18
16
|
|
19
17
|
def testing?
|
@@ -72,7 +70,7 @@ module Bell
|
|
72
70
|
extend self
|
73
71
|
|
74
72
|
def path
|
75
|
-
File.
|
73
|
+
File.path("#{ENV['HOME']}/.bell")
|
76
74
|
end
|
77
75
|
|
78
76
|
def created?
|
@@ -90,7 +88,7 @@ module Bell
|
|
90
88
|
end
|
91
89
|
|
92
90
|
def path
|
93
|
-
File.
|
91
|
+
File.path("#{Directory.path}/bell_#{@environment}.db")
|
94
92
|
end
|
95
93
|
|
96
94
|
def created?
|
data/lib/bell/commands.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require File.
|
3
|
-
require File.
|
4
|
-
require File.
|
5
|
-
require File.
|
1
|
+
require File.expand_path('../commands/command', __FILE__)
|
2
|
+
require File.expand_path('../commands/user_command', __FILE__)
|
3
|
+
require File.expand_path('../commands/contact_command', __FILE__)
|
4
|
+
require File.expand_path('../commands/report_command', __FILE__)
|
5
|
+
require File.expand_path('../commands/implosion_command', __FILE__)
|
@@ -7,7 +7,7 @@ module Bell::Commands
|
|
7
7
|
|
8
8
|
Ações:
|
9
9
|
list [--csv] [-u|--user <usuário>]
|
10
|
-
import [-f|--force] /path/para/lista/de/contatos.csv -u|--user <usuário>
|
10
|
+
import [-f|--force] /path/para/lista/de/contatos.csv [(-u|--user <usuário>)|(-p|--public)]
|
11
11
|
USAGE
|
12
12
|
|
13
13
|
LIST_USAGE = <<-LIST_USAGE.gsub(/^ /, '')
|
@@ -19,7 +19,7 @@ module Bell::Commands
|
|
19
19
|
LIST_USAGE
|
20
20
|
|
21
21
|
IMPORT_USAGE = <<-IMPORT_USAGE.gsub(/^ /, '')
|
22
|
-
uso: bell contact import /path/contatos.csv -u|--user <usuário> [<argumentos>]
|
22
|
+
uso: bell contact import /path/contatos.csv [(-u|--user <usuário>)|(-p|--public)] [<argumentos>]
|
23
23
|
|
24
24
|
Argumentos:
|
25
25
|
-f|--force Ignora a lista de contatos e faz uma importação forçada
|
data/lib/bell/csv_parser.rb
CHANGED
@@ -22,8 +22,8 @@ module Bell
|
|
22
22
|
else
|
23
23
|
contact = if options[:user]
|
24
24
|
UserContact.new(:name => sanitize(row.first),
|
25
|
-
|
26
|
-
|
25
|
+
:number => row.last,
|
26
|
+
:user_id => user.id)
|
27
27
|
elsif options[:public]
|
28
28
|
PublicContact.new(:name => sanitize(row.first), :number => row.last)
|
29
29
|
end
|
data/lib/bell/full_report.rb
CHANGED
@@ -126,14 +126,13 @@ module Bell
|
|
126
126
|
|
127
127
|
def user_total(user_name)
|
128
128
|
user = User.find(:name => user_name)
|
129
|
-
|
129
|
+
calls.inject(0) do |total, call|
|
130
130
|
if UserContact.find(:number => call.number_called, :user_id => user.id)
|
131
131
|
total += call.cost.to_f
|
132
132
|
else
|
133
133
|
total
|
134
134
|
end
|
135
135
|
end
|
136
|
-
subtotal + (unknown_total + fees_total) / User.all.size
|
137
136
|
end
|
138
137
|
|
139
138
|
def users
|
data/lib/bell/handlers.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
2
|
-
require File.
|
3
|
-
require File.
|
4
|
-
require File.
|
1
|
+
require File.expand_path('../handlers/users_handler', __FILE__)
|
2
|
+
require File.expand_path('../handlers/contacts_handler', __FILE__)
|
3
|
+
require File.expand_path('../handlers/reports_handler', __FILE__)
|
4
|
+
require File.expand_path('../handlers/implosions_handler', __FILE__)
|
data/lib/bell/version.rb
ADDED
data/spec/bell/cli_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
2
|
|
3
3
|
describe Bell::CSVParser do
|
4
4
|
describe ".parse_contacts" do
|
@@ -49,7 +49,7 @@ describe Bell::CSVParser do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
context "when given a csv file with invalid rows" do
|
52
|
-
let(:user) { mock(Bell::User
|
52
|
+
let(:user) { mock(Bell::User).as_null_object }
|
53
53
|
|
54
54
|
before do
|
55
55
|
described_module.stub!(:raise).with(Bell::InvalidContacts)
|
@@ -91,7 +91,7 @@ describe Bell::CSVParser do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
context "when given a valid csv file" do
|
94
|
-
let(:user) { mock(Bell::User
|
94
|
+
let(:user) { mock(Bell::User).as_null_object }
|
95
95
|
|
96
96
|
before do
|
97
97
|
described_module.stub!(:raise).with(Bell::InvalidContacts)
|
@@ -1,12 +1,10 @@
|
|
1
|
-
require File.expand_path(
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
2
|
|
3
3
|
describe Bell::Handlers::ContactsHandler do
|
4
4
|
let(:params) { mock("params").as_null_object }
|
5
5
|
let(:formatted_contact_list) { mock("formatted_contact_list") }
|
6
6
|
let(:user) do
|
7
|
-
mock(Bell::User, :id => 1,
|
8
|
-
:null_object => true,
|
9
|
-
:contacts => mock("contacts"))
|
7
|
+
mock(Bell::User, :id => 1, :contacts => mock("contacts"))
|
10
8
|
end
|
11
9
|
let(:contact) { mock(Bell::UserContact).as_null_object }
|
12
10
|
let(:contacts_handler) { described_class }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
2
|
|
3
3
|
describe Bell::Handlers::UsersHandler do
|
4
4
|
let(:users_handler) { described_class }
|
@@ -21,12 +21,13 @@ describe Bell::Handlers::UsersHandler do
|
|
21
21
|
|
22
22
|
context "when there are no users with the given name" do
|
23
23
|
it "creates the user" do
|
24
|
-
Bell::User.stub!(:find).and_return(
|
24
|
+
Bell::User.stub!(:find).and_return(nil)
|
25
25
|
Bell::User.should_receive(:create).with(:name => params[:user][:name])
|
26
26
|
users_handler.create(params)
|
27
27
|
end
|
28
28
|
|
29
29
|
it "shows the 'user created' message" do
|
30
|
+
Bell::User.stub!(:find).and_return(nil)
|
30
31
|
users_handler.should_receive(:display).with(user_created_message)
|
31
32
|
users_handler.create(params)
|
32
33
|
end
|
data/spec/bell/user_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,21 +1,10 @@
|
|
1
|
-
|
2
|
-
require 'bell'
|
3
|
-
require 'spec'
|
1
|
+
require File.expand_path('../../lib/bell', __FILE__)
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Spec::Runner.configure do |config|
|
10
|
-
config.suppress_deprecation_warnings!
|
11
|
-
end
|
12
|
-
|
13
|
-
class Spec::Example::ExampleGroup
|
14
|
-
def execute(*args, &block)
|
15
|
-
DB.transaction do
|
16
|
-
super(*args, &block)
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.around(:each) do |example|
|
5
|
+
Sequel::DATABASES.first.transaction do
|
6
|
+
example.run
|
17
7
|
raise Sequel::Error::Rollback
|
18
8
|
end
|
19
|
-
true
|
20
9
|
end
|
21
10
|
end
|
metadata
CHANGED
@@ -1,106 +1,92 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bell
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Murilo Pereira
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
17
|
-
name: bundler
|
18
|
-
prerelease: false
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
-
none: false
|
21
|
-
requirements:
|
22
|
-
- - ">="
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 1.0.0
|
25
|
-
type: :development
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-24 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
28
15
|
name: cucumber
|
29
|
-
|
30
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &22149640 !ruby/object:Gem::Requirement
|
31
17
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - =
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.1.0
|
36
22
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rake
|
40
23
|
prerelease: false
|
41
|
-
|
24
|
+
version_requirements: *22149640
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &22149180 !ruby/object:Gem::Requirement
|
42
28
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
29
|
+
requirements:
|
30
|
+
- - =
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.2
|
47
33
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rspec
|
51
34
|
prerelease: false
|
52
|
-
|
35
|
+
version_requirements: *22149180
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &22148720 !ruby/object:Gem::Requirement
|
53
39
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 2.
|
40
|
+
requirements:
|
41
|
+
- - =
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.6.0
|
58
44
|
type: :development
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: embratel
|
62
45
|
prerelease: false
|
63
|
-
|
46
|
+
version_requirements: *22148720
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: embratel
|
49
|
+
requirement: &22196120 !ruby/object:Gem::Requirement
|
64
50
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
51
|
+
requirements:
|
52
|
+
- - =
|
53
|
+
- !ruby/object:Gem::Version
|
68
54
|
version: 1.1.2
|
69
55
|
type: :runtime
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: sequel
|
73
56
|
prerelease: false
|
74
|
-
|
57
|
+
version_requirements: *22196120
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: sequel
|
60
|
+
requirement: &22195640 !ruby/object:Gem::Requirement
|
75
61
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 3.
|
62
|
+
requirements:
|
63
|
+
- - =
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 3.27.0
|
80
66
|
type: :runtime
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: sqlite3-ruby
|
84
67
|
prerelease: false
|
85
|
-
|
68
|
+
version_requirements: *22195640
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: &22195180 !ruby/object:Gem::Requirement
|
86
72
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 1.3.
|
73
|
+
requirements:
|
74
|
+
- - =
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.3.4
|
91
77
|
type: :runtime
|
92
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *22195180
|
93
80
|
description:
|
94
81
|
email: murilo@murilopereira.com
|
95
|
-
executables:
|
82
|
+
executables:
|
96
83
|
- bell
|
97
84
|
extensions: []
|
98
|
-
|
99
85
|
extra_rdoc_files: []
|
100
|
-
|
101
|
-
files:
|
86
|
+
files:
|
102
87
|
- .gitignore
|
103
88
|
- .rvmrc
|
89
|
+
- CHANGELOG.org
|
104
90
|
- Gemfile
|
105
91
|
- Gemfile.lock
|
106
92
|
- MIT-LICENSE
|
@@ -147,6 +133,7 @@ files:
|
|
147
133
|
- lib/bell/user_contact.rb
|
148
134
|
- lib/bell/user_report.rb
|
149
135
|
- lib/bell/util.rb
|
136
|
+
- lib/bell/version.rb
|
150
137
|
- spec/bell/cli_spec.rb
|
151
138
|
- spec/bell/commands/command_spec.rb
|
152
139
|
- spec/bell/commands/contact_command_spec.rb
|
@@ -165,35 +152,31 @@ files:
|
|
165
152
|
- spec/bell/user_report_spec.rb
|
166
153
|
- spec/bell/user_spec.rb
|
167
154
|
- spec/spec_helper.rb
|
168
|
-
|
169
|
-
homepage: https://github.com/murilasso/bell
|
155
|
+
homepage: https://github.com/mpereira/bell
|
170
156
|
licenses: []
|
171
|
-
|
172
157
|
post_install_message:
|
173
158
|
rdoc_options: []
|
174
|
-
|
175
|
-
require_paths:
|
159
|
+
require_paths:
|
176
160
|
- lib
|
177
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
178
162
|
none: false
|
179
|
-
requirements:
|
180
|
-
- -
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
version:
|
183
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
168
|
none: false
|
185
|
-
requirements:
|
186
|
-
- -
|
187
|
-
- !ruby/object:Gem::Version
|
169
|
+
requirements:
|
170
|
+
- - ! '>='
|
171
|
+
- !ruby/object:Gem::Version
|
188
172
|
version: 1.3.6
|
189
173
|
requirements: []
|
190
|
-
|
191
174
|
rubyforge_project:
|
192
|
-
rubygems_version: 1.6
|
175
|
+
rubygems_version: 1.8.6
|
193
176
|
signing_key:
|
194
177
|
specification_version: 3
|
195
178
|
summary: Tenha controle sobre as suas faturas de telefone da Embratel.
|
196
|
-
test_files:
|
179
|
+
test_files:
|
197
180
|
- features/create_user.feature
|
198
181
|
- features/full_report.feature
|
199
182
|
- features/import_public_contacts.feature
|