rails_assist 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,8 +14,8 @@ def test_routes_file &block
14
14
 
15
15
  File.overwrite CLASS.routes_file do
16
16
  old_content
17
- end
18
- end
17
+ end
18
+ end
19
19
 
20
20
  def test_gem_file &block
21
21
  old_content = AppDir.new.read_gem_file
@@ -24,24 +24,24 @@ def test_gem_file &block
24
24
 
25
25
  File.overwrite CLASS.gem_file do
26
26
  old_content
27
- end
28
- end
27
+ end
28
+ end
29
29
 
30
30
  describe RailsAssist::File::Special do
31
31
  before do
32
- RailsAssist::Directory.rails_root = fixtures_dir
32
+ RailsAssist::Directory.rails_root = fixtures_dir
33
33
  end
34
34
 
35
35
  [:application, :environment, :seed, :routes, :boot].each do |name|
36
36
  eval %{
37
- before :each do
37
+ before :each do
38
38
  file_name = CLASS.#{name}_filepath
39
39
  FileUtils.cp file_name, file_name + '.bak'
40
40
  end
41
41
 
42
- after :each do
43
- file_name = CLASS.#{name}_filepath
44
- FileUtils.mv file_name + '.bak', file_name
42
+ after :each do
43
+ file_name = CLASS.#{name}_filepath
44
+ FileUtils.mv file_name + '.bak', file_name
45
45
  end
46
46
 
47
47
  describe '##{name}_file' do
@@ -56,7 +56,7 @@ describe RailsAssist::File::Special do
56
56
  CLASS.remove_#{name}_file if File.exist?(file_name + '.bak')
57
57
  File.exist?(file_name).should be_false
58
58
  end
59
- end
59
+ end
60
60
 
61
61
  describe '#read_#{name}_file' do
62
62
  it "should read the #{name} file content" do
@@ -76,25 +76,24 @@ describe RailsAssist::File::Special do
76
76
  end
77
77
  }
78
78
  end
79
-
79
+
80
80
  describe '#gem_file' do
81
81
  it 'should return the Gemfile path' do
82
82
  AppDir.new.gem_filepath.should match /Gemfile/
83
83
  end
84
84
  end
85
-
85
+
86
86
  # create test_routes macro
87
-
88
- describe '#insert_into_routes' do
87
+ describe '#insert_into_routes' do
89
88
  it 'should insert into block of Routes file, string statement' do
90
89
  test_routes_file do
91
90
  routes_stmt = 'devise_for :users'
92
91
  CLASS.insert_into_routes routes_stmt
93
92
  puts AppDir.new.read_routes_file
94
93
  AppDir.new.read_routes_file.should match /do\s*#{Regexp.escape(routes_stmt)}\s*/m
95
- end
94
+ end
96
95
  end
97
-
96
+
98
97
  # it 'should insert into block of Routes file, block statement' do
99
98
  # test_routes_file do
100
99
  # routes_stmt = 'devise_for :brugere'
@@ -102,7 +101,7 @@ describe RailsAssist::File::Special do
102
101
  # routes_stmt
103
102
  # end
104
103
  # AppDir.new.read_routes_file.should match /do\s*#{Regexp.escape(routes_stmt)}\s*/m
105
- # end
104
+ # end
106
105
  # end
107
106
  #
108
107
  # it 'should insert into block of Routes file, block statement' do
@@ -112,17 +111,17 @@ describe RailsAssist::File::Special do
112
111
  # routes_stmt
113
112
  # end
114
113
  # AppDir.new.read_routes_file.should match /\s*#{Regexp.escape(routes_stmt)}\s*end\s*$/mi
115
- # end
114
+ # end
116
115
  # end
117
116
  end
118
117
  #
119
- # describe '#read_gem_file' do
118
+ # describe '#read_gem_file' do
120
119
  # it 'should read the Gemfile' do
121
120
  # AppDir.new.read_gem_file.should match /gem 'rails'/
122
121
  # end
123
122
  # end
124
123
  #
125
- # describe '#has_gem?' do
124
+ # describe '#has_gem?' do
126
125
  # it 'should be true that it has the rails gem' do
127
126
  # AppDir.new.has_gem?(:rails).should be_true
128
127
  # end
@@ -132,7 +131,7 @@ describe RailsAssist::File::Special do
132
131
  # end
133
132
  # end
134
133
  #
135
- # describe '#clean_gemfile' do
134
+ # describe '#clean_gemfile' do
136
135
  # it 'should be true that it has cleaned the Gemfile ensuring newlines between each gem' do
137
136
  # test_gem_file do
138
137
  # CLASS.append_to_gem_file do
@@ -158,9 +157,9 @@ describe RailsAssist::File::Special do
158
157
  # end
159
158
  # end
160
159
  #
161
- # describe '#has_gem_version?' do
160
+ # describe '#has_gem_version?' do
162
161
  # it 'should be true that it has the rails gem 3.0.3' do
163
- # # puts AppDir.new.read_gem_file
162
+ # # puts AppDir.new.read_gem_file
164
163
  # AppDir.new.has_gem_version?(:rails, '3.0.3').should be_true
165
164
  # end
166
165
  #
@@ -168,4 +167,4 @@ describe RailsAssist::File::Special do
168
167
  # AppDir.new.has_gem_version?(:rails, '3.0.1').should be_false
169
168
  # end
170
169
  # end
171
- end
170
+ end
@@ -15,20 +15,21 @@ describe RailsAssist::File do
15
15
  end
16
16
 
17
17
  before :each do
18
- CLASS.remove_initializer('my_init')
18
+ CLASS.remove_initializer('my_init')
19
+ CLASS.remove_config_file('my_config')
19
20
  end
20
21
 
21
22
  describe '#initializer_filepath' do
22
23
  it "should return the initializer file 'mime_types' " do
23
24
  AppDir.new.initializer_filepath('mime_types').should match /mime_type/
24
25
  end
25
- end
26
+ end
26
27
 
27
28
  describe '#initializer_file' do
28
29
  it "should return the initializer file 'mime_type' " do
29
30
  AppDir.new.initializer_file('mime_types').path.should match /mime_type/
30
31
  end
31
- end
32
+ end
32
33
 
33
34
  describe '#create_initializer' do
34
35
  it "should create the initializer file 'my_init' " do
@@ -39,38 +40,45 @@ describe RailsAssist::File do
39
40
  CLASS.initializer_file(name).path.should match /#{name}/
40
41
  CLASS.read_initializer(name).should match /hello/
41
42
  end
42
- end
43
+ end
43
44
 
44
45
  describe '#read_initializer' do
45
- it "should create replace initializer content using hash args" do
46
- name = 'my_init'
46
+ it "should create replace initializer content using hash args" do
47
+ name = 'my_init'
47
48
  CLASS.create_initializer(name) do
48
49
  'hello'
49
- end
50
+ end
50
51
  CLASS.read_initializer(name).should match /hello/
51
- CLASS.remove_initializer(name)
52
+ CLASS.remove_initializer(name)
52
53
  end
53
54
  end
54
55
 
55
56
  describe '#read_initializer_file' do
56
- it "should create replace initializer content using hash args" do
57
- name = 'my_init'
57
+ it "should create and read initializer file content" do
58
+ name = 'my_init'
58
59
  CLASS.create_initializer(name) do
59
60
  'hello'
60
- end
61
+ end
61
62
  CLASS.read_initializer_file(name).should match /hello/
62
63
  end
64
+
65
+ it "should create and read config file content" do
66
+ name = 'my_config'
67
+ CLASS.create_config(name) do
68
+ 'hello'
69
+ end
70
+ CLASS.read_config_file(name).should match /hello/
71
+ end
63
72
  end
64
73
 
65
74
 
66
75
  describe '#replace_initializer_content' do
67
- it "should create replace initializer content using hash args" do
68
- name = 'my_init'
76
+ it "should create replace initializer content using hash args" do
77
+ name = 'my_init'
69
78
  CLASS.create_initializer(name) do
70
79
  'hello'
71
80
  end
72
81
  CLASS.replace_initializer_content name, :where => 'hello', :with => 'goodbye'
73
-
74
82
  CLASS.read_initializer(name).should match /goodbye/
75
83
  CLASS.read_initializer(name).should_not match /hello/
76
84
  end
@@ -83,11 +91,10 @@ describe RailsAssist::File do
83
91
  CLASS.replace_initializer_content name, :where => 'hello' do
84
92
  'goodbye'
85
93
  end
86
-
87
94
  CLASS.read_initializer(name).should match /goodbye/
88
95
  CLASS.read_initializer(name).should_not match /hello/
89
96
  end
90
- end
97
+ end
91
98
 
92
99
  describe '#create_javascript' do
93
100
  it "should create the javascript file 'my_init' " do
@@ -97,12 +104,11 @@ describe RailsAssist::File do
97
104
  end
98
105
  CLASS.read_javascript(name).should match /js stuff/
99
106
  end
100
- end
101
-
107
+ end
102
108
 
103
109
  describe '#remove_initializers' do
104
110
  it "should remove the initializer files named 'my_init' " do
105
- name = 'my_init'
111
+ name = 'my_init'
106
112
  CLASS.create_initializer(name) do
107
113
  'hello'
108
114
  end
@@ -112,4 +118,4 @@ describe RailsAssist::File do
112
118
  CLASS.read_initializer(name).should be_empty
113
119
  end
114
120
  end
115
- end
121
+ end
@@ -68,23 +68,22 @@ describe RailsAssist::Files do
68
68
  # end
69
69
  # end
70
70
  # end
71
-
71
+
72
72
  describe '#initializer_files' do
73
- it "should return files for initializer directory" do
73
+ it "should return files for initializer directory" do
74
74
  CLASS.initializer_files.file_names.should include('mime_types.rb', 'secret_token.rb')
75
- end
75
+ end
76
76
  end
77
-
78
-
77
+
79
78
  describe '#locale_files' do
80
- it "should return files for locale directory" do
79
+ it "should return files for locale directory" do
81
80
  CLASS.locale_files.file_names.should include('en.yml')
82
- end
81
+ end
83
82
  end
84
-
83
+
85
84
  describe '#css_files' do
86
- it "should return files for css directory" do
85
+ it "should return files for css directory" do
87
86
  CLASS.css_files.file_names.should include('scaffold.css')
88
- end
87
+ end
89
88
  end
90
- end
89
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_assist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-24 00:00:00.000000000Z
12
+ date: 2011-09-21 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: require_all
16
- requirement: &2153997600 !ruby/object:Gem::Requirement
16
+ requirement: &2157710560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153997600
24
+ version_requirements: *2157710560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sugar-high
27
- requirement: &2153997000 !ruby/object:Gem::Requirement
27
+ requirement: &2157709240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153997000
35
+ version_requirements: *2157709240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: file_mutate
38
- requirement: &2153996400 !ruby/object:Gem::Requirement
38
+ requirement: &2157708240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.1.3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153996400
46
+ version_requirements: *2157708240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
- requirement: &2153995820 !ruby/object:Gem::Requirement
49
+ requirement: &2157707240 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.0.1
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2153995820
57
+ version_requirements: *2157707240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &2153995240 !ruby/object:Gem::Requirement
60
+ requirement: &2157698200 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '2.4'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153995240
68
+ version_requirements: *2157698200
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &2153994660 !ruby/object:Gem::Requirement
71
+ requirement: &2157696260 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.1
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153994660
79
+ version_requirements: *2157696260
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &2153994080 !ruby/object:Gem::Requirement
82
+ requirement: &2157695200 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.6.4
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2153994080
90
+ version_requirements: *2157695200
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rcov
93
- requirement: &2153993500 !ruby/object:Gem::Requirement
93
+ requirement: &2157694140 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2153993500
101
+ version_requirements: *2157694140
102
102
  description: Basic file operation helpers for working with Rails 3 artifacts
103
103
  email: kmandrup@gmail.com
104
104
  executables: []
@@ -235,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  segments:
237
237
  - 0
238
- hash: -4063057361183552736
238
+ hash: -2007381531149917671
239
239
  required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  none: false
241
241
  requirements:
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  version: '0'
245
245
  requirements: []
246
246
  rubyforge_project:
247
- rubygems_version: 1.8.8
247
+ rubygems_version: 1.8.10
248
248
  signing_key:
249
249
  specification_version: 3
250
250
  summary: File operation helpers for Rails 3 artifacts