society 1.0.0 → 1.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.
@@ -29,42 +29,51 @@ describe Society::Formatter::Report::Json do
29
29
 
30
30
  context "with no output path specified" do
31
31
 
32
- let(:default_output_directory) { File.join(%w[doc society TIMESTAMP]) }
33
32
  let(:report) do
34
33
  Society::Formatter::Report::Json.new(
35
34
  json_data: json_data
36
35
  )
37
36
  end
38
37
 
39
- it "creates the default directory" do
40
- private_timestamp = report.send(:timestamp)
41
- output_directory = default_output_directory.gsub('TIMESTAMP', private_timestamp)
42
- default_directory_matcher = Regexp.new(output_directory)
43
-
44
- expect(FileUtils).to receive(:mkpath).with(default_directory_matcher)
45
- report.send(:prepare_output_directory)
38
+ it "raises an error since no output was specified" do
39
+ expect{report.send(:prepare_output_directory)}.to raise_error(/No output/)
46
40
  end
47
41
  end
48
42
  end
49
43
 
50
44
  describe "#write" do
51
45
 
52
- let(:output_path) { File.join(%w[blah mah_data.json]) }
53
- let(:report) do
54
- Society::Formatter::Report::Json.new(
55
- json_data: json_data,
56
- output_path: output_path
57
- )
46
+ context "with output path specified" do
47
+ let(:output_path) { File.join(%w[blah mah_data.json]) }
48
+ let(:report) do
49
+ Society::Formatter::Report::Json.new(
50
+ json_data: json_data,
51
+ output_path: output_path
52
+ )
53
+ end
54
+
55
+
56
+ let(:open_file) { double }
57
+
58
+ it "writes the json data" do
59
+ expect(File).to receive(:open).with(output_path, 'w') do |path, mode, &block|
60
+ block.yield open_file
61
+ end
62
+ expect(open_file).to receive(:write).with(json_data)
63
+ report.write
64
+ end
58
65
  end
66
+ context "with no output path specified" do
59
67
 
60
- let(:open_file) { double }
68
+ let(:report) do
69
+ Society::Formatter::Report::Json.new(
70
+ json_data: json_data
71
+ )
72
+ end
61
73
 
62
- it "writes the json data" do
63
- expect(File).to receive(:open).with(output_path, 'w') do |path, mode, &block|
64
- block.yield open_file
74
+ it "write json to stdout" do
75
+ expect{report.write}.to output("{\"foo\":\"bar\"}\n").to_stdout
65
76
  end
66
- expect(open_file).to receive(:write).with(json_data)
67
- report.write
68
77
  end
69
78
  end
70
79
  end
@@ -5,11 +5,11 @@ describe Society::Parser do
5
5
  describe "::for_files" do
6
6
 
7
7
  it "returns a parser object" do
8
- expect(Society::Parser.for_files('./spec/fixtures').class.name).to eq("Society::Parser")
8
+ expect(Society::Parser.for_files('./spec/fixtures/for_parser_spec').class.name).to eq("Society::Parser")
9
9
  end
10
10
 
11
11
  it "initializes the parser with an Analyzer object" do
12
- expect(Society::Parser.for_files('./spec/fixtures').analyzer.class.name).to eq("Analyst::Parser")
12
+ expect(Society::Parser.for_files('./spec/fixtures/for_parser_spec').analyzer.class.name).to eq("Analyst::Parser")
13
13
  end
14
14
 
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: society
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coraline Ada Ehmke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-26 00:00:00.000000000 Z
12
+ date: 2014-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -206,6 +206,7 @@ files:
206
206
  - ".gitignore"
207
207
  - ".rspec"
208
208
  - CODE_OF_CONDUCT.md
209
+ - COPYING.txt
209
210
  - Gemfile
210
211
  - LICENSE.txt
211
212
  - README.md
@@ -215,6 +216,7 @@ files:
215
216
  - lib/society.rb
216
217
  - lib/society/association_processor.rb
217
218
  - lib/society/cli.rb
219
+ - lib/society/clusterer.rb
218
220
  - lib/society/edge.rb
219
221
  - lib/society/formatter/graph/json.rb
220
222
  - lib/society/formatter/report/html.rb
@@ -232,7 +234,10 @@ files:
232
234
  - society_graph.json
233
235
  - spec/association_processor_spec.rb
234
236
  - spec/cli_spec.rb
235
- - spec/fixtures/foo.rb
237
+ - spec/clusterer_spec.rb
238
+ - spec/fixtures/clustering/clusterer_fixtures.rb
239
+ - spec/fixtures/clustering/edges_1.txt
240
+ - spec/fixtures/for_parser_spec/whaler.rb
236
241
  - spec/formatter/graph/json_spec.rb
237
242
  - spec/formatter/report/html_spec.rb
238
243
  - spec/formatter/report/json_spec.rb
@@ -267,7 +272,10 @@ summary: Social graph for Ruby objects
267
272
  test_files:
268
273
  - spec/association_processor_spec.rb
269
274
  - spec/cli_spec.rb
270
- - spec/fixtures/foo.rb
275
+ - spec/clusterer_spec.rb
276
+ - spec/fixtures/clustering/clusterer_fixtures.rb
277
+ - spec/fixtures/clustering/edges_1.txt
278
+ - spec/fixtures/for_parser_spec/whaler.rb
271
279
  - spec/formatter/graph/json_spec.rb
272
280
  - spec/formatter/report/html_spec.rb
273
281
  - spec/formatter/report/json_spec.rb