copycat 0.1.1 → 0.2.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/README.md +4 -0
- data/app/controllers/copycat_translations_controller.rb +1 -1
- data/app/models/copycat_translation.rb +1 -0
- data/config/routes.rb +4 -1
- data/lib/copycat/implementation.rb +13 -0
- data/lib/copycat/simple.rb +3 -0
- data/lib/copycat/version.rb +1 -1
- data/lib/copycat.rb +10 -14
- data/lib/tasks/copycat_tasks.rake +6 -3
- data/spec/dummy/config/initializers/copycat.rb +5 -2
- data/spec/dummy/log/development.log +61 -0
- data/spec/dummy/log/test.log +8444 -0
- data/spec/integration/copycat_spec.rb +10 -10
- data/spec/integration/dummy_spec.rb +29 -0
- metadata +6 -4
@@ -7,7 +7,7 @@ feature "copycat index" do
|
|
7
7
|
|
8
8
|
before do
|
9
9
|
Factory(:copycat_translation, :key => "foo", :value => "bar")
|
10
|
-
page.driver.browser.basic_authorize
|
10
|
+
page.driver.browser.basic_authorize Copycat.username, Copycat.password
|
11
11
|
visit copycat_translations_path
|
12
12
|
end
|
13
13
|
|
@@ -100,7 +100,7 @@ feature "copycat index" do
|
|
100
100
|
|
101
101
|
it "nil locale, blank search" do
|
102
102
|
# impossible for user to replicate this case
|
103
|
-
visit
|
103
|
+
visit copycat_translations_path('search' => '', 'commit' => 'Search')
|
104
104
|
page.should have_content 'bar1'
|
105
105
|
page.should_not have_content 'bar2'
|
106
106
|
page.should_not have_content 'bar3'
|
@@ -108,17 +108,17 @@ feature "copycat index" do
|
|
108
108
|
|
109
109
|
it "nil locale, present search" do
|
110
110
|
# impossible for user to replicate this case
|
111
|
-
visit
|
111
|
+
visit copycat_translations_path('search' => 'foo', 'commit' => 'Search')
|
112
112
|
page.should have_content 'bar1'
|
113
113
|
page.should_not have_content 'bar2'
|
114
114
|
page.should_not have_content 'bar3'
|
115
|
-
visit
|
115
|
+
visit copycat_translations_path('search' => 'fuu', 'commit' => 'Search')
|
116
116
|
page.should_not have_content 'foo'
|
117
117
|
end
|
118
118
|
|
119
119
|
it "blank locale, nil search" do
|
120
120
|
# impossible for user to replicate this case
|
121
|
-
visit
|
121
|
+
visit copycat_translations_path('locale' => '', 'commit' => 'Search')
|
122
122
|
page.should_not have_content 'foo'
|
123
123
|
end
|
124
124
|
|
@@ -144,7 +144,7 @@ feature "copycat index" do
|
|
144
144
|
|
145
145
|
it "present locale, nil search" do
|
146
146
|
# impossible for user to replicate this case
|
147
|
-
visit
|
147
|
+
visit copycat_translations_path('locale' => 'en', 'commit' => 'Search')
|
148
148
|
page.should_not have_content 'foo'
|
149
149
|
end
|
150
150
|
|
@@ -198,7 +198,7 @@ end
|
|
198
198
|
feature "copycat edit" do
|
199
199
|
before do
|
200
200
|
Factory(:copycat_translation, :key => "foo", :value => "bar")
|
201
|
-
page.driver.browser.basic_authorize
|
201
|
+
page.driver.browser.basic_authorize Copycat.username, Copycat.password
|
202
202
|
visit copycat_translations_path
|
203
203
|
end
|
204
204
|
|
@@ -213,7 +213,7 @@ end
|
|
213
213
|
feature "copycat update, delete" do
|
214
214
|
before do
|
215
215
|
Factory(:copycat_translation, :key => "foo", :value => "bar")
|
216
|
-
page.driver.browser.basic_authorize
|
216
|
+
page.driver.browser.basic_authorize Copycat.username, Copycat.password
|
217
217
|
visit copycat_translations_path
|
218
218
|
fill_in 'search', :with => 'foo'
|
219
219
|
click_button 'Search'
|
@@ -238,7 +238,7 @@ end
|
|
238
238
|
|
239
239
|
feature "downloading and uploading yaml files" do
|
240
240
|
before do
|
241
|
-
page.driver.browser.basic_authorize
|
241
|
+
page.driver.browser.basic_authorize Copycat.username, Copycat.password
|
242
242
|
end
|
243
243
|
|
244
244
|
it "round-trips the YAML" do
|
@@ -311,7 +311,7 @@ end
|
|
311
311
|
feature "locales" do
|
312
312
|
before do
|
313
313
|
|
314
|
-
page.driver.browser.basic_authorize
|
314
|
+
page.driver.browser.basic_authorize Copycat.username, Copycat.password
|
315
315
|
end
|
316
316
|
|
317
317
|
it "imports yaml containing multiple locales" do
|
@@ -61,3 +61,32 @@ feature "locales" do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
64
|
+
|
65
|
+
feature "yaml" do
|
66
|
+
|
67
|
+
it "round-trips both translations correctly (and doesn't export nils)" do
|
68
|
+
visit root_path
|
69
|
+
CopycatTranslation.find_by_key('site.index.intro').value.should be_nil
|
70
|
+
CopycatTranslation.find_by_key('site.index.header').value.should == 'The Header'
|
71
|
+
CopycatTranslation.count.should == 2
|
72
|
+
|
73
|
+
page.driver.browser.basic_authorize Copycat.username, Copycat.password
|
74
|
+
visit import_export_copycat_translations_path
|
75
|
+
click_link 'Download as YAML'
|
76
|
+
CopycatTranslation.destroy_all
|
77
|
+
CopycatTranslation.count.should == 0
|
78
|
+
yaml = page.text
|
79
|
+
file = Tempfile.new 'copycat'
|
80
|
+
file.write yaml
|
81
|
+
file.close
|
82
|
+
visit import_export_copycat_translations_path
|
83
|
+
attach_file "file", file.path
|
84
|
+
click_button "Upload"
|
85
|
+
file.unlink
|
86
|
+
|
87
|
+
CopycatTranslation.count.should == 1
|
88
|
+
CopycatTranslation.find_by_key('site.index.intro').should be_nil
|
89
|
+
CopycatTranslation.find_by_key('site.index.header').value.should == 'The Header'
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: copycat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-03
|
13
|
+
date: 2012-04-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &2151799180 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: 3.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2151799180
|
26
26
|
description: Edit live website copy.
|
27
27
|
email:
|
28
28
|
- info@vermonster.com
|
@@ -41,6 +41,8 @@ files:
|
|
41
41
|
- config/routes.rb
|
42
42
|
- db/migrate/20120313191745_create_copycat_translations.rb
|
43
43
|
- lib/copycat/engine.rb
|
44
|
+
- lib/copycat/implementation.rb
|
45
|
+
- lib/copycat/simple.rb
|
44
46
|
- lib/copycat/version.rb
|
45
47
|
- lib/copycat.rb
|
46
48
|
- lib/tasks/copycat_tasks.rake
|