gitmethere 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49ea805052840c2b1178ac266fd630082582c77b
4
- data.tar.gz: 5d0bbd16dbced3a15fb28cf0ec8fb41e1b49943e
3
+ metadata.gz: 89ec5a3510ee112c442cb62754314ff4b2acd6d6
4
+ data.tar.gz: efa9ee5198c2c25fee3e6229cb59342e5cb27466
5
5
  SHA512:
6
- metadata.gz: 2a4360076415dc645893f5cded03dc668b4ec72530a0dca0d98ec90dfe60a7f4aea9b31956a16349eaa760dbe5c722edf106763f8b647e7495917a0e48d3dfae
7
- data.tar.gz: e59082cb5abaf3dbc267934c69ad4a54412096170a5475db3329a531be35ee914898a30884569401935bfeb1fbd486e24ca2e55c594fe4ca2b9935f60c669acb
6
+ metadata.gz: 1d12cf2d49994d7bc945f461d526836fa86d20fe38138f8420123656b1dece9b50528634767479291e5580c788fe8788f5a89d5ac29e1b201223a7f87a910de4
7
+ data.tar.gz: 021cb3dbefd54c2216e54b28d9ad2f205e65942a9468a0dbac924378bf19e4ee2e27ba7d724bd303b34b4d6e9372f38ac6237d45686d80a59a04c717a48f3201
@@ -56,6 +56,21 @@ module GitMeThere
56
56
  end
57
57
  end
58
58
 
59
+ def replace_in_file(name="my-file.md", content="Adding a bit more content", new_content="Replaced content")
60
+ text = File.read("#{@name}/#{name}")
61
+ File.open("#{@name}/#{name}", 'w') do | f |
62
+ f.puts text.gsub(content, new_content)
63
+ end
64
+ end
65
+
66
+ def rename_file(source="my-file.md", target="my-new-file.md")
67
+ File.rename("#{@name}/#{source}", "#{@name}/#{target}")
68
+ end
69
+
70
+ def delete_file(name="my-file.md")
71
+ File.delete("#{@name}/#{name}")
72
+ end
73
+
59
74
  def commit(message, author = nil)
60
75
  if author.nil?
61
76
  @g.commit(message)
@@ -1,3 +1,3 @@
1
1
  module Gitmethere
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -103,6 +103,65 @@ RSpec.describe GitMeThere::Scenario do
103
103
 
104
104
  end
105
105
 
106
+ describe ".replace_in_file()" do
107
+
108
+ before(:each) do
109
+ @scenario = GitMeThere::Scenario.new()
110
+ @scenario.create_file()
111
+ @scenario.append_to_file()
112
+ end
113
+
114
+ it "without arguments" do
115
+ @scenario.replace_in_file()
116
+ expect(File.read("my-scenario/my-file.md")).to include("Replaced content")
117
+ end
118
+
119
+ it "with arguments" do
120
+ @scenario.replace_in_file(name="my-file.md", content=/.*/, new_content="custom content")
121
+ expect(File.read("my-scenario/my-file.md")).to include("custom content")
122
+ end
123
+
124
+ end
125
+
126
+ describe ".rename_file()" do
127
+
128
+ before(:each) do
129
+ @scenario = GitMeThere::Scenario.new()
130
+ @scenario.create_file(name="my-file.md", content="content")
131
+ end
132
+
133
+ it "without arguments" do
134
+ @scenario.rename_file()
135
+ expect(File.read("my-scenario/my-new-file.md")).to include("content")
136
+ end
137
+
138
+ it "with arguments" do
139
+ @scenario.rename_file(source="my-file.md", target="renamed-file.md")
140
+ expect(File.read("my-scenario/renamed-file.md")).to include("content")
141
+ end
142
+
143
+ end
144
+
145
+ describe ".delete_file()" do
146
+
147
+ before(:each) do
148
+ @scenario = GitMeThere::Scenario.new()
149
+ end
150
+
151
+ it "without arguments" do
152
+ @scenario.create_file()
153
+ @scenario.delete_file()
154
+ expect(File.file?("my-scenario/my-file.md")).to be false
155
+ end
156
+
157
+ it "with arguments" do
158
+ @scenario.create_file(name="file-name")
159
+ @scenario.delete_file(name="file-name")
160
+ expect(File.file?("my-scenario/file-name")).to be false
161
+ end
162
+
163
+ end
164
+
106
165
  describe '.checkout_branch()' do
107
166
  before(:each) do
108
167
  @scenario = GitMeThere::Scenario.new(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitmethere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allen Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-02 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler