social_snippet 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +11 -4
  3. data/README.md +6 -6
  4. data/Rakefile +19 -1
  5. data/lib/social_snippet.rb +11 -0
  6. data/lib/social_snippet/api/install_repository_api.rb +23 -82
  7. data/lib/social_snippet/api/manifest_api.rb +3 -3
  8. data/lib/social_snippet/api/update_repository_api.rb +34 -35
  9. data/lib/social_snippet/command_line/sspm/sub_commands/install_command.rb +7 -7
  10. data/lib/social_snippet/config.rb +18 -8
  11. data/lib/social_snippet/core.rb +13 -0
  12. data/lib/social_snippet/document.rb +2 -0
  13. data/lib/social_snippet/document_backend.rb +2 -0
  14. data/lib/social_snippet/document_backend/yaml_document.rb +252 -0
  15. data/lib/social_snippet/document_backend/yaml_document/query.rb +45 -0
  16. data/lib/social_snippet/repository.rb +2 -2
  17. data/lib/social_snippet/repository/driver_factory.rb +42 -0
  18. data/lib/social_snippet/repository/drivers.rb +3 -2
  19. data/lib/social_snippet/repository/drivers/driver_base.rb +100 -0
  20. data/lib/social_snippet/repository/drivers/entry.rb +11 -0
  21. data/lib/social_snippet/repository/drivers/git_driver.rb +100 -0
  22. data/lib/social_snippet/repository/models.rb +15 -0
  23. data/lib/social_snippet/repository/models/package.rb +97 -0
  24. data/lib/social_snippet/repository/models/repository.rb +94 -0
  25. data/lib/social_snippet/repository/repository_manager.rb +79 -67
  26. data/lib/social_snippet/resolvers/base_resolver.rb +13 -17
  27. data/lib/social_snippet/rspec/test_document.rb +305 -0
  28. data/lib/social_snippet/rspec/test_driver.rb +76 -0
  29. data/lib/social_snippet/rspec/test_storage.rb +459 -0
  30. data/lib/social_snippet/storage.rb +1 -0
  31. data/lib/social_snippet/storage_backend.rb +3 -0
  32. data/lib/social_snippet/storage_backend/file_system_storage.rb +71 -0
  33. data/lib/social_snippet/storage_backend/storage_base.rb +35 -0
  34. data/lib/social_snippet/version.rb +8 -3
  35. data/spec/helpers/codeclimate_helper.rb +1 -1
  36. data/spec/helpers/fakefs_helper.rb +10 -0
  37. data/spec/helpers/social_snippet_helper.rb +117 -0
  38. data/spec/lib/api/insert_snippet_spec.rb +95 -2
  39. data/spec/lib/api/update_repository_spec.rb +196 -0
  40. data/spec/lib/command_line/sspm_install_spec.rb +169 -180
  41. data/spec/lib/command_line/sspm_update_spec.rb +56 -0
  42. data/spec/lib/config_spec.rb +6 -8
  43. data/spec/lib/core_spec.rb +21 -38
  44. data/spec/lib/file_system_storage_spec.rb +170 -0
  45. data/spec/lib/insert_resolver_spec.rb +15 -2
  46. data/spec/lib/registry_client_spec.rb +6 -9
  47. data/spec/lib/repository/driver_base_spec.rb +89 -0
  48. data/spec/lib/repository/git_driver_spec.rb +10 -0
  49. data/spec/lib/repository/package_spec.rb +172 -0
  50. data/spec/lib/repository/repository_factory_spec.rb +67 -22
  51. data/spec/lib/repository/repository_manager_spec.rb +71 -114
  52. data/spec/lib/repository/repository_spec.rb +191 -0
  53. data/spec/lib/yaml_document_spec.rb +14 -0
  54. data/spec/spec_helper.rb +8 -93
  55. data/test/config_test.rb +6 -7
  56. data/test/driver_base_test.rb +201 -0
  57. data/test/git_driver_test.rb +51 -0
  58. data/test/insert_snippet_test.rb +256 -349
  59. data/test/repository_manager_test.rb +7 -16
  60. data/test/yaml_document_test.rb +97 -0
  61. metadata +44 -16
  62. data/lib/social_snippet/repository/drivers/base_repository.rb +0 -189
  63. data/lib/social_snippet/repository/drivers/git_repository.rb +0 -74
  64. data/lib/social_snippet/repository/repository_factory.rb +0 -59
  65. data/lib/social_snippet/repository/repository_installer.rb +0 -85
  66. data/spec/lib/repository/base_repository_spec.rb +0 -104
  67. data/spec/lib/repository/git_repository_spec.rb +0 -83
  68. data/spec/lib/repository/repository_installer_spec.rb +0 -63
  69. data/test/base_repository_test.rb +0 -375
  70. data/test/git_repository_test.rb +0 -114
@@ -11,46 +11,29 @@ module SocialSnippet
11
11
 
12
12
  describe "#insert_snippet" do
13
13
 
14
- context "create files" do
14
+ context "prepare repository" do
15
15
 
16
16
  before do
17
- repo_name = "my-repo"
18
-
19
- ::FileUtils.mkdir_p "#{repo_path}"
20
- ::FileUtils.mkdir_p "#{repo_path}/my-repo"
21
- ::FileUtils.mkdir_p "#{repo_path}/my-repo/.git"
22
- ::FileUtils.mkdir_p "#{repo_path}/my-repo/src"
23
- ::FileUtils.touch "#{repo_path}/my-repo/snippet.json"
24
- ::FileUtils.touch "#{repo_path}/my-repo/src/get_42.cpp"
25
-
26
- # snippet.json
27
- ::File.write "#{repo_path}/my-repo/snippet.json", [
28
- '{',
29
- ' "name": "my-repo",',
30
- ' "language": "C++",',
31
- ' "main": "src/"',
32
- '}',
17
+ repo = ::SocialSnippet::Repository::Models::Repository.create(
18
+ :name => "my-repo",
19
+ :current_ref => "master",
20
+ )
21
+ repo.add_ref "master", "rev-master"
22
+ package = ::SocialSnippet::Repository::Models::Package.create(
23
+ :repo_name => "my-repo",
24
+ :rev_hash => "rev-master",
25
+ )
26
+ package.add_file "snippet.json", {
27
+ :name => "my-repo",
28
+ :main => "src",
29
+ }.to_json
30
+ package.add_directory "src"
31
+ package.add_file "src/get_42.cpp", [
32
+ "int get_42() {",
33
+ " return 42;",
34
+ "}",
33
35
  ].join($/)
34
-
35
- # src/get_42.cpp
36
- ::File.write "#{repo_path}/my-repo/src/get_42.cpp", [
37
- 'int get_42() {',
38
- ' return 42;',
39
- '}',
40
- ].join($/)
41
-
42
- repo_config = Proc.new do |path|
43
- repo = ::SocialSnippet::Repository::Drivers::BaseRepository.new("#{repo_path}/my-repo")
44
- allow(repo).to receive(:commit_id).and_return commit_id
45
- allow(repo).to receive(:refs).and_return []
46
- repo.load_snippet_json
47
- repo.create_cache repo_cache_path
48
- repo
49
- end
50
-
51
- allow(fake_core.repo_manager).to receive(:find_repository).with("my-repo") { repo_config.call }
52
- allow(fake_core.repo_manager).to receive(:find_repository).with("my-repo", short_commit_id) { repo_config.call }
53
- end # prepare for my-repo
36
+ end
54
37
 
55
38
  context "there are no @snip tags" do
56
39
 
@@ -100,7 +83,7 @@ module SocialSnippet
100
83
  [
101
84
  '#include <iostream>',
102
85
  '',
103
- '// @snippet <my-repo#dummycom:get_42.cpp>',
86
+ '// @snippet <my-repo#master:get_42.cpp>',
104
87
  'int get_42() {',
105
88
  ' return 42;',
106
89
  '}',
@@ -0,0 +1,170 @@
1
+ require "spec_helper"
2
+
3
+ describe ::SocialSnippet::StorageBackend::FileSystemStorage do
4
+
5
+ let(:storage) { ::SocialSnippet::StorageBackend::FileSystemStorage.new }
6
+
7
+ include_context :TestStorage
8
+
9
+ context "test storage class" do
10
+
11
+ describe "#read" do
12
+
13
+ context "read path/to/file" do
14
+
15
+ example do
16
+ expect { storage.read "path/to/file" }.to raise_error ::Errno::ENOENT
17
+ end
18
+ context "prepare path/to/file" do
19
+
20
+ before do
21
+ ::FileUtils.mkdir_p "path/to"
22
+ ::FileUtils.touch "path/to/file"
23
+ end
24
+
25
+ context "read path/to/file" do
26
+ example do
27
+ expect { storage.read "path/to/file" }.to_not raise_error
28
+ end
29
+ end
30
+
31
+ end # prepare path/to/file
32
+
33
+ end # read path/to/file
34
+
35
+ end #read
36
+
37
+ describe "#write" do
38
+
39
+ context "write path/to/file" do
40
+ before do
41
+ ::FileUtils.mkdir_p "path/to"
42
+ storage.write "path/to/file", "data-123"
43
+ end
44
+ context "::File.read path/to/file" do
45
+ subject { ::File.read "path/to/file" }
46
+ it { should eq "data-123" }
47
+ end
48
+ end
49
+
50
+ end #write
51
+
52
+ describe "#glob" do
53
+
54
+ context "glob path/to/*" do
55
+ subject { storage.glob "path/to/*" }
56
+ it { should be_empty }
57
+
58
+ context "prepare files" do
59
+
60
+ before do
61
+ ::FileUtils.mkdir_p "path/to"
62
+ ::FileUtils.touch "path/to/file1"
63
+ ::FileUtils.touch "path/to/file2"
64
+ ::FileUtils.touch "path/to/file3"
65
+ ::FileUtils.mkdir_p "path/to/directory"
66
+ end
67
+
68
+ context "glob path/to/*" do
69
+ subject { storage.glob "path/to/*" }
70
+ it { should_not be_empty }
71
+ it { should include /path\/to\/file1$/ }
72
+ it { should include /path\/to\/directory$/ }
73
+ end
74
+
75
+ context "glob path/to/f*" do
76
+ subject { storage.glob "path/to/f*" }
77
+ it { should_not be_empty }
78
+ it { should include /path\/to\/file1$/ }
79
+ it { should_not include /path\/to\/directory$/ }
80
+ end
81
+
82
+ context "glob path/to/not_found*" do
83
+ subject { storage.glob "path/to/not_found*" }
84
+ it { should be_empty }
85
+ it { should_not include /path\/to\/file1$/ }
86
+ it { should_not include /path\/to\/directory$/ }
87
+ end
88
+
89
+ context "glob path/to/file1" do
90
+ subject { storage.glob "path/to/file1" }
91
+ it { should_not be_empty }
92
+ it { should include /path\/to\/file1$/ }
93
+ it { should_not include /path\/to\/file2$/ }
94
+ it { should_not include /path\/to\/file3$/ }
95
+ it { should_not include /path\/to\/directory$/ }
96
+ end
97
+
98
+ end
99
+
100
+ end
101
+
102
+ end #glob
103
+
104
+ describe "#exists?" do
105
+
106
+ context "prepare files" do
107
+
108
+ before do
109
+ ::FileUtils.mkdir_p "path/to"
110
+ ::FileUtils.touch "path/to/file1"
111
+ ::FileUtils.touch "path/to/file2"
112
+ ::FileUtils.touch "path/to/file3"
113
+ ::FileUtils.mkdir_p "path/to/dir"
114
+ end
115
+
116
+ it { expect(storage.exists? "path/to/file1").to be_truthy }
117
+ it { expect(storage.exists? "path/to/file2").to be_truthy }
118
+ it { expect(storage.exists? "path/to/file3").to be_truthy }
119
+ it { expect(storage.exists? "path/to/dir").to be_truthy }
120
+
121
+ end
122
+
123
+ end #exists?
124
+
125
+ describe "#file?" do
126
+
127
+ context "prepare files" do
128
+
129
+ before do
130
+ ::FileUtils.mkdir_p "path/to"
131
+ ::FileUtils.touch "path/to/file1"
132
+ ::FileUtils.touch "path/to/file2"
133
+ ::FileUtils.touch "path/to/file3"
134
+ ::FileUtils.mkdir_p "path/to/dir"
135
+ end
136
+
137
+ it { expect(storage.file? "path/to/file1").to be_truthy }
138
+ it { expect(storage.file? "path/to/file2").to be_truthy }
139
+ it { expect(storage.file? "path/to/file3").to be_truthy }
140
+ it { expect(storage.file? "path/to/dir").to be_falsey }
141
+
142
+ end
143
+
144
+ end #file?
145
+
146
+ describe "#directory?" do
147
+
148
+ context "prepare files" do
149
+
150
+ before do
151
+ ::FileUtils.mkdir_p "path/to"
152
+ ::FileUtils.touch "path/to/file1"
153
+ ::FileUtils.touch "path/to/file2"
154
+ ::FileUtils.touch "path/to/file3"
155
+ ::FileUtils.mkdir_p "path/to/dir"
156
+ end
157
+
158
+ it { expect(storage.directory? "path/to/file1").to be_falsey }
159
+ it { expect(storage.directory? "path/to/file2").to be_falsey }
160
+ it { expect(storage.directory? "path/to/file3").to be_falsey }
161
+ it { expect(storage.directory? "path/to/dir").to be_truthy }
162
+
163
+ end
164
+
165
+ end #directory?
166
+
167
+ end # test storage class
168
+
169
+ end # ::SocialSnippet::StorageBackend::FileSystemStorage
170
+
@@ -5,8 +5,21 @@ describe SocialSnippet::Resolvers::InsertResolver do
5
5
  context "prepare stubs" do
6
6
 
7
7
  before do
8
- allow(fake_core.repo_manager).to receive(:resolve_snippet_path) do |c, t|
9
- t.repo
8
+ allow(fake_core.repo_manager).to receive(:find_repository) do |name|
9
+ repo = ::SocialSnippet::Repository::Models::Repository.new(
10
+ :repo_name => name,
11
+ )
12
+ repo
13
+ end
14
+ allow(fake_core.repo_manager).to receive(:find_package) do |name|
15
+ pkg = ::SocialSnippet::Repository::Models::Package.new(
16
+ :repo_name => name,
17
+ :rev_hash => "rev-#{name}",
18
+ )
19
+ pkg.add_file "snippet.json", {
20
+ :name => name,
21
+ }.to_json
22
+ pkg
10
23
  end
11
24
  allow(fake_core.repo_manager).to receive(:get_snippet) do |c, t|
12
25
  ::SocialSnippet::Snippet.new_text(t.repo)
@@ -21,22 +21,19 @@ module SocialSnippet
21
21
  Config.new social_snippet
22
22
  end
23
23
 
24
- before { allow(config).to receive(:sspm_url).and_return "http://api.server/api/v0" }
25
-
26
- def logger
27
- ::Logger.new(::StringIO.new)
24
+ before do
25
+ allow(social_snippet).to receive(:storage).and_return fake_storage
26
+ allow(social_snippet).to receive(:logger).and_return fake_logger
27
+ allow(social_snippet).to receive(:config).and_return config
28
28
  end
29
29
 
30
+ before { allow(config).to receive(:sspm_url).and_return "http://api.server/api/v0" }
31
+
30
32
  let(:social_snippet) do
31
33
  class Fake; end
32
34
  Fake.new
33
35
  end
34
36
 
35
- before do
36
- allow(social_snippet).to receive(:config).and_return config
37
- allow(social_snippet).to receive(:logger).and_return logger
38
- end
39
-
40
37
  before do
41
38
  WebMock
42
39
  .stub_request(
@@ -0,0 +1,89 @@
1
+ require "spec_helper"
2
+
3
+ describe ::SocialSnippet::Repository::Drivers::DriverBase do
4
+
5
+ let(:repo_url) { "git://github.com/user/repo" }
6
+ let(:repo_name) { "my-repo" }
7
+ let(:driver) do
8
+ ::SocialSnippet::Repository::Drivers::DriverBase.new repo_url
9
+ end
10
+
11
+ before do
12
+ allow(driver).to receive(:fetch).and_return true
13
+ end
14
+
15
+ before do
16
+ allow(driver).to receive(:snippet_json) do
17
+ {
18
+ "name" => "my-repo",
19
+ }
20
+ end
21
+ end
22
+
23
+ before do
24
+ allow(driver).to receive(:current_ref) do
25
+ "master"
26
+ end
27
+ end
28
+
29
+ before do
30
+ allow(driver).to receive(:refs).and_return [
31
+ "0.0.0",
32
+ "0.0.1",
33
+ "0.0.2",
34
+ ]
35
+ end
36
+
37
+ before do
38
+ allow(driver).to receive(:rev_hash) do |ref|
39
+ case ref
40
+ when "master"
41
+ "rev-master"
42
+ when "develop"
43
+ "rev-develop"
44
+ when "feature/abc"
45
+ "rev-feature-abc"
46
+ when "0.0.0"
47
+ "rev-0.0.0"
48
+ when "0.0.1"
49
+ "rev-0.0.1"
50
+ when "0.0.2"
51
+ "rev-0.0.2"
52
+ else
53
+ raise "error"
54
+ end
55
+ end
56
+ end
57
+
58
+ before do
59
+ allow(driver).to(
60
+ receive(:each_directory)
61
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir1")
62
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir1/subdir1")
63
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir1/subdir2")
64
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir1/subdir3")
65
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir2")
66
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir3")
67
+ )
68
+ end
69
+
70
+ before do
71
+ allow(driver).to(
72
+ receive(:each_file)
73
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "file1", "")
74
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir1/file2", "")
75
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir1/subdir1/file3", "")
76
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir1/subdir2/file4", "")
77
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir1/subdir3/file5", "")
78
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir2/file6", "")
79
+ .and_yield(::SocialSnippet::Repository::Drivers::Entry.new "dir3/file7", "")
80
+ )
81
+ end
82
+
83
+ context "driver.latest_version" do
84
+ subject { driver.latest_version }
85
+ it { should eq "0.0.2" }
86
+ end
87
+
88
+ end # ::SocialSnippet::Repository::Drivers::DriverBase
89
+
@@ -0,0 +1,10 @@
1
+ require "spec_helper"
2
+
3
+ describe ::SocialSnippet::Repository::Drivers::GitDriver do
4
+
5
+ let(:driver_class) { ::SocialSnippet::Repository::Drivers::GitDriver }
6
+
7
+ include_context :TestDriver
8
+
9
+ end # GitDriver
10
+
@@ -0,0 +1,172 @@
1
+ require "spec_helper"
2
+
3
+ describe ::SocialSnippet::Repository::Models::Package do
4
+
5
+ let(:repo_name) { "my-repo" }
6
+ let(:rev_hash) { "commit-id" }
7
+ let(:package) do
8
+ ::SocialSnippet::Repository::Models::Package.new(
9
+ :repo_name => repo_name,
10
+ :rev_hash => rev_hash,
11
+ )
12
+ end
13
+
14
+ before { ::SocialSnippet::Repository::Models::Package.core = fake_core }
15
+
16
+ describe "#display_name" do
17
+ context "package.display_name" do
18
+ subject { package.display_name }
19
+ it { should eq "#{repo_name}@#{rev_hash}" }
20
+ end
21
+ end
22
+
23
+ context "add snippet.json" do
24
+
25
+ before do
26
+ package.add_file "snippet.json", {
27
+ :name => "package-name",
28
+ :desc => "package-desc",
29
+ :main => "package-main"
30
+ }.to_json
31
+ end
32
+
33
+ context "check snippet.json" do
34
+ it { expect(package.snippet_json["name"]).to eq "package-name" }
35
+ it { expect(package.snippet_json["desc"]).to eq "package-desc" }
36
+ it { expect(package.snippet_json["main"]).to eq "package-main" }
37
+ end
38
+
39
+ describe "#paths" do
40
+
41
+ context "add file" do
42
+ before { package.add_file "file", "file-data" }
43
+ subject { package.paths }
44
+ it { should include "file" }
45
+ context "check filesystem" do
46
+ subject { ::FileTest.file? fake_core.config.package_path(repo_name, rev_hash, "file") }
47
+ it { should be_truthy }
48
+ end
49
+ end
50
+
51
+ context "add dir" do
52
+ before { package.add_directory "dir" }
53
+ subject { package.paths }
54
+ it { should include "dir/" }
55
+ context "check filesystem" do
56
+ subject { ::FileTest.directory? fake_core.config.package_path(repo_name, rev_hash, "dir") }
57
+ it { should be_truthy }
58
+ end
59
+ context "add dir/file" do
60
+ before { package.add_file "dir/file", "dir/file-data" }
61
+ subject { package.paths }
62
+ it { should include "dir/file" }
63
+ context "check filesystem" do
64
+ subject { ::FileTest.file? fake_core.config.package_path(repo_name, rev_hash, "dir/file") }
65
+ it { should be_truthy }
66
+ end
67
+ end
68
+ end
69
+
70
+ context "add dir/" do
71
+ before { package.add_directory "dir/" }
72
+ subject { package.paths }
73
+ it { should include "dir/" }
74
+ context "check filesystem" do
75
+ subject { ::FileTest.directory? fake_core.config.package_path(repo_name, rev_hash, "dir") }
76
+ it { should be_truthy }
77
+ end
78
+ end
79
+
80
+ end # files
81
+
82
+ describe "#glob" do
83
+
84
+ context "prepare files" do
85
+
86
+ before do
87
+ package.add_file "file1.cpp", ""
88
+ package.add_file "file2.rb", ""
89
+ package.add_file "file3.cpp", ""
90
+ package.add_directory "subdir"
91
+ package.add_file "subdir/file4.cpp", ""
92
+ package.add_file "subdir/file5.rb", ""
93
+ end
94
+
95
+ context "glob *.cpp" do
96
+ subject { package.glob "*.cpp" }
97
+ it { should include "file1.cpp" }
98
+ it { should_not include "file2.rb" }
99
+ it { should include "file3.cpp" }
100
+ it { should_not include "subdir/file4.cpp" }
101
+ it { should_not include "subdir/file5.rb" }
102
+ end
103
+
104
+ context "glob subdir/*.rb" do
105
+ subject { package.glob "subdir/*.rb" }
106
+ it { should_not include "file1.cpp" }
107
+ it { should_not include "file2.rb" }
108
+ it { should_not include "file3.cpp" }
109
+ it { should_not include "subdir/file4.cpp" }
110
+ it { should include "subdir/file5.rb" }
111
+ end
112
+
113
+ end
114
+
115
+ end #glob
116
+
117
+ describe "serialization" do
118
+
119
+ context "prepare files" do
120
+
121
+ before do
122
+ package.add_file "file1.cpp", ""
123
+ package.add_file "file2.rb", ""
124
+ package.add_file "file3.cpp", ""
125
+ package.add_directory "subdir"
126
+ package.add_file "subdir/file4.cpp", ""
127
+ package.add_file "subdir/file5.rb", ""
128
+ end
129
+
130
+ context "save package" do
131
+
132
+ before { package.save! }
133
+
134
+ context "load package" do
135
+ let(:loaded_package) do
136
+ ::SocialSnippet::Repository::Models::Package.find_by(
137
+ :repo_name => "my-repo",
138
+ :rev_hash => "commit-id",
139
+ )
140
+ end
141
+
142
+ context "glob *.cpp" do
143
+ subject { loaded_package.glob "*.cpp" }
144
+ it { should include "file1.cpp" }
145
+ it { should_not include "file2.rb" }
146
+ it { should include "file3.cpp" }
147
+ it { should_not include "subdir/file4.cpp" }
148
+ it { should_not include "subdir/file5.rb" }
149
+ end
150
+
151
+ context "glob subdir/*.rb" do
152
+ subject { loaded_package.glob "subdir/*.rb" }
153
+ it { should_not include "file1.cpp" }
154
+ it { should_not include "file2.rb" }
155
+ it { should_not include "file3.cpp" }
156
+ it { should_not include "subdir/file4.cpp" }
157
+ it { should include "subdir/file5.rb" }
158
+ end
159
+
160
+ end
161
+
162
+ end
163
+
164
+ end # save package
165
+
166
+ end # serialization
167
+
168
+ end # add snippet.json
169
+
170
+ end # ::SocialSnippet::Repository::Models::Package
171
+
172
+