Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[#9] Use verb-noun naming convention for features

* Do not use 'copy' in features
* Use correct 'localization' or 'blurb' terms.
commit 1137a9f1d4db158ec3c8aa8f1ee9e545f49e36a9 1 parent eac08df
@croaky croaky authored
View
2  app/controllers/api/v2/base_controller.rb
@@ -18,6 +18,6 @@ def current_project
def missing_project
render :json => {
'error' => 'No project was found with the given API key.'
- }, :status => 404
+ }, :status => :not_found
end
end
View
12 features/add_locale.feature
@@ -1,12 +0,0 @@
-@javascript
-Feature: See help for adding a new locale
-
- Scenario: view blurbs in a particular locale
- Given a project exists with a name of "Project 1"
- And the following copy exists:
- | project | draft content | key | locale |
- | Project 1 | hello | one | en |
- When I go to the dashboard page
- And I follow "Project 1"
- And I follow "Add a new locale..."
- Then I should see "Adding new locales to Copycopter"
View
23 features/api_v2_deploy.feature
@@ -1,25 +1,26 @@
-Feature: trigger a deploy using the v2 api
+Feature: Deploy project through API
- Scenario: trigger a deploy for a known project
+ Scenario: Deploy a known project
Given a project exists with a name of "Breakfast"
And a project exists with a name of "Other"
- And the following copy exists:
- | project | draft content | published content | key |
- | Breakfast | draft one | published one | test.one |
- | Breakfast | draft two | published two | test.two |
- | Other | other draft | other published | test.other |
+ And the following localizations exist in the "Breakfast" project:
+ | draft_content | published_content | key |
+ | draft one | published one | test.one |
+ | draft two | published two | test.two |
+ And the following localizations exist in the "Other" project:
+ | draft_content | published_content | key |
+ | other draft | other published | test.other |
When I POST the v2 API URI for "Breakfast" deploys
Then I should receive a HTTP 201
- And the following copy should exist in the "Breakfast" project:
+ And the following blurb should exist in the "Breakfast" project:
| draft_content | published_content | key |
| draft one | draft one | test.one |
| draft two | draft two | test.two |
- And the following copy should exist in the "Other" project:
+ And the following blurb should exist in the "Other" project:
| draft_content | published_content | key |
| other draft | other published | test.other |
- @allow-rescue
- Scenario: attempt to trigger a deploy for an unknown project
+ Scenario: Deploy an unknown project
When I POST the v2 API URI for an unknown project's deploys
Then I should receive a HTTP 404
And I should receive the following as a JSON object:
View
4 features/api_v2_download.feature
@@ -1,4 +1,4 @@
-Feature: download blurbs using the v2 api
+Feature: Download blurbs for a project through API
Scenario: download draft blurbs for a known project
Given a project exists with a name of "Breakfast"
@@ -26,14 +26,12 @@ Feature: download blurbs using the v2 api
| en.test.one | expected one |
| en.test.two | expected two |
- @allow-rescue
Scenario: attempt to download draft blurbs for an unknown project
When I GET the v2 API URL for an unknown project's draft blurbs
Then I should receive a HTTP 404
And I should receive the following as a JSON object:
| error | No project was found with the given API key. |
- @allow-rescue
Scenario: attempt to download published blurbs for an unknown project
When I GET the v2 API URL for an unknown project's published blurbs
Then I should receive a HTTP 404
View
25 features/api_v2_upload.feature
@@ -1,40 +1,39 @@
-Feature: upload default copy using the v2 api
+Feature: Upload default blurb for a project through API
- Scenario: upload default copy for a known project
+ Scenario: Upload default blurb for a known project
Given a project exists with a name of "Breakfast"
- And the following copy exists:
- | project | draft content | published content | key |
- | Breakfast | draft one | published one | test.one |
- | Breakfast | draft two | published two | test.two |
+ And the following localizations exist in the "Breakfast" project:
+ | draft_content | published_content | key |
+ | draft one | published one | test.one |
+ | draft two | published two | test.two |
When I POST the v2 API URI for "Breakfast" draft blurbs:
| en.test.one | new one |
| en.test.three | new three |
Then I should receive a HTTP 201
- And the following copy should exist in the "Breakfast" project:
+ And the following blurb should exist in the "Breakfast" project:
| draft_content | published_content | key |
| draft one | published one | test.one |
| draft two | published two | test.two |
| new three | | test.three |
- @allow-rescue
- Scenario: attempt to upload default copy for an unknown project
+ Scenario: Try to upload default blurb for an unknown project
When I POST the v2 API URI for an unknown project's draft blurbs
Then I should receive a HTTP 404
And I should receive the following as a JSON object:
| error | No project was found with the given API key. |
- Scenario: attempt to upload default copy for a blank key
+ Scenario: Try to upload default blurb for a blank key
Given a project exists with a name of "Breakfast"
When I POST the v2 API URI for "Breakfast" draft blurbs:
| en.test.one | not blank |
| | blank |
Then I should receive a HTTP 201
- And the following copy should exist in the "Breakfast" project:
+ And the following blurb should exist in the "Breakfast" project:
| draft_content | published_content | key |
| not blank | | test.one |
- And no blank copy without a key should exist
+ And no blank blurb without a key should exist
- Scenario: upload and redownload default copy for several locales
+ Scenario: Download default blurb for several locales
Given a project exists with a name of "Breakfast"
When I POST the v2 API URI for "Breakfast" draft blurbs:
| en.test.one | one |
View
65 features/blurb_editing.feature → features/edit_blurb.feature
@@ -8,30 +8,30 @@ Feature: Blurb Editing
Given a project exists with a name of "Project 1"
Scenario: Editing Blurb in a Project
- Given the following copy exists:
- | project | draft content | key |
- | Project 1 | blah la | test.key |
+ Given the following localizations exist in the "Project 1" project:
+ | draft_content | key |
+ | blah la | test.key |
When I go to the edit blurb page for "test.key" on "Project 1"
Then I should see "blah la"
- When I fill in "Content" with "new copy"
+ When I fill in "Content" with "new blurb"
And I press "Save Blurb"
Then I should see "Draft saved."
- And the "Content" field should contain "new copy"
+ And the "Content" field should contain "new blurb"
When I go to the edit blurb page for "test.key" on "Project 1"
- Then I should see "new copy"
+ Then I should see "new blurb"
Scenario: Edit a blurb and navigate back to the project
- Given the following copy exists:
- | project | key |
- | Project 1 | test.key |
+ Given the following localizations exist in the "Project 1" project:
+ | key |
+ | test.key |
When I go to the edit blurb page for "test.key" on "Project 1"
And I follow "Project 1"
Then I should see "Project 1"
Scenario: Deleting Blurb in a Project
- Given the following copy exists:
- | project | draft content | key |
- | Project 1 | blah la | test.key |
+ Given the following localizations exist in the "Project 1" project:
+ | draft_content | key |
+ | blah la | test.key |
When I go to the edit blurb page for "test.key" on "Project 1"
And I follow "Remove blurb"
Then I should not see "test.key"
@@ -43,19 +43,16 @@ Feature: Blurb Editing
And I should see "Adding blurbs to your app"
But I should not see "Search blurbs"
- Scenario: View a project with blurbs
- Given the following copy exists:
- | project |
- | Project 1 |
+ Scenario: View a project with no blurbs
When I go to the dashboard page
Then I should not see "Setting up your Rails app"
And I should not see "Adding blurbs to your app"
@javascript
Scenario: Apply formatting to blurbs
- Given the following copy exists:
- | project | key | draft content |
- | Project 1 | test.key | <p>hello</p> |
+ Given the following localizations exist in the "Project 1" project:
+ | key | draft_content |
+ | test.key | <p>hello</p> |
When I go to the edit blurb page for "test.key" on "Project 1"
And I apply the "bold" editor function to "ell"
And I apply the "italic" editor function to "el"
@@ -65,9 +62,9 @@ Feature: Blurb Editing
@javascript
Scenario: Edit blurbs using HTML
- Given the following copy exists:
- | project | key | draft content |
- | Project 1 | test.key | <p>hello</p> |
+ Given the following localizations exist in the "Project 1" project:
+ | key | draft_content |
+ | test.key | <p>hello</p> |
When I go to the edit blurb page for "test.key" on "Project 1"
And I apply the "bold" editor function to "ell"
And I follow "Edit as HTML"
@@ -81,9 +78,9 @@ Feature: Blurb Editing
@javascript
Scenario: Switch between HTML and simple editing
- Given the following copy exists:
- | project | key | draft content |
- | Project 1 | test.key | <p>hello</p> |
+ Given the following localizations exist in the "Project 1" project:
+ | key | draft_content |
+ | test.key | <p>hello</p> |
When I go to the edit blurb page for "test.key" on "Project 1"
And I apply the "bold" editor function to "ell"
And I follow "Edit as HTML"
@@ -98,9 +95,9 @@ Feature: Blurb Editing
@javascript
Scenario: Strip extra paragraph tags in simple editing
- Given the following copy exists:
- | project | key | draft content |
- | Project 1 | test.key | hello |
+ Given the following localizations exist in the "Project 1" project:
+ | key | draft_content |
+ | test.key | hello |
When I go to the edit blurb page for "test.key" on "Project 1"
And I apply the "bold" editor function to "ell"
And I press "Save Blurb"
@@ -110,9 +107,9 @@ Feature: Blurb Editing
@javascript
Scenario: Insert newlines into an inline segment
- Given the following copy exists:
- | project | key | draft content |
- | Project 1 | test.key | hello |
+ Given the following localizations exist in the "Project 1" project:
+ | key | draft_content |
+ | test.key | hello |
When I go to the edit blurb page for "test.key" on "Project 1"
And I add a newline after "ell" in the editor
And I press "Save Blurb"
@@ -121,9 +118,9 @@ Feature: Blurb Editing
@javascript
Scenario: Remember editor mode
- Given the following copy exists:
- | project | key |
- | Project 1 | test.key |
+ Given the following localizations exist in the "Project 1" project:
+ | key |
+ | test.key |
When I go to the edit blurb page for "test.key" on "Project 1"
And I follow "Edit as HTML"
And I press "Save Blurb"
View
22 features/blurb_publishing.feature → features/publish_blurb.feature
@@ -4,21 +4,21 @@ Feature: publish a blurb
Given a project exists with a name of "Testo"
Scenario: create and publish a draft
- Given the following copy exists:
- | project | key |
- | Testo | test.key |
+ Given the following localizations exist in the "Testo" project:
+ | key |
+ | test.key |
When I go to the edit blurb page for "test.key" on "Testo"
- And I fill in "Content" with "Final copy"
+ And I fill in "Content" with "Final blurb"
And I choose "Publish"
And I press "Save Blurb"
Then I should see "Content published. It takes up to 5 minutes for new content to appear on the live site."
When I go to the edit blurb page for "test.key" on "Testo"
- Then I should see "Final copy"
+ Then I should see "Final blurb"
And the "Publish" checkbox should be checked
@javascript
Scenario: edit a published version
- Given the following copy is published:
+ Given the following blurb is published:
| project | key | content |
| Testo | test.key | This is published |
When I go to the edit blurb page for "test.key" on "Testo"
@@ -26,7 +26,7 @@ Feature: publish a blurb
And a visible element should contain "Published"
And no visible elements should contain "Draft"
And a visible element should contain "This text will be displayed in all environments"
- When I change the editor's content to "New copy"
+ When I change the editor's content to "New blurb"
Then the "Draft" checkbox should be checked
And no visible elements should contain "Published"
And a visible element should contain "Draft"
@@ -43,7 +43,7 @@ Feature: publish a blurb
Then a visible element should contain "This text will be displayed in development"
And no visible elements should contain "Published"
And a visible element should contain "Draft"
- And I should see "New copy" in the editor
+ And I should see "New blurb" in the editor
And the "Draft" checkbox should be checked
And no visible elements should contain "This is published"
When I follow "latest published version"
@@ -51,9 +51,9 @@ Feature: publish a blurb
@javascript
Scenario: edit a version that has never been published
- Given the following copy exists:
- | project | key |
- | Testo | test.key |
+ Given the following localizations exist in the "Testo" project:
+ | key |
+ | test.key |
When I go to the edit blurb page for "test.key" on "Testo"
Then a visible element should contain "The default text will be displayed in production"
But no visible elements should contain "latest published version"
View
16 features/blurb_search.feature → features/search_blurbs.feature
@@ -5,11 +5,11 @@ Feature: Blurb Search
@javascript
Scenario: Filter blurbs by key
- Given the following copy exists:
- | project | key |
- | Project 1 | test.find.this |
- | Project 1 | test.Find.that |
- | Project 1 | test.miss.that |
+ Given the following localizations exist in the "Project 1" project:
+ | key |
+ | test.find.this |
+ | test.Find.that |
+ | test.miss.that |
When I go to the blurbs index for the "Project 1" project
Then no visible elements should contain "find"
And a visible element should contain "Type the first"
@@ -31,9 +31,9 @@ Feature: Blurb Search
@javascript
Scenario: Perform a search with no results
- Given the following copy exists:
- | project | key |
- | Project 1 | test.key |
+ Given the following localizations exist in the "Project 1" project:
+ | key |
+ | test.key |
When I go to the blurbs index for the "Project 1" project
Then no visible elements should contain "No results"
When I type "find" into "Search"
View
3  features/step_definitions/blurb_steps.rb
@@ -0,0 +1,3 @@
+Then /^no blank blurb without a key should exist$/ do
+ Blurb.where(:key => '').count.should == 0
+end
View
26 features/step_definitions/copy_steps.rb → features/step_definitions/localization_steps.rb
@@ -8,23 +8,17 @@
end
end
-Then /^no blank copy without a key should exist$/ do
- Blurb.where(:key => '').count.should == 0
-end
+Given /^the following localizations exist in the "([^"]+)" project:$/ do |project_name, table|
+ project = Project.find_by_name!(project_name)
-Given /^the following copy exists:$/ do |table|
table.hashes.each do |hash|
- project = Project.find_by_name!(hash['project'])
- draft_content = hash['draft content'] || ''
- published_content = hash['published content'] || ''
+ blurb = project.blurbs.find_or_create_by_key(hash.delete('key'))
locale = project.locales.find_or_create_by_key(hash['locale'] || 'en')
- blurb = project.blurbs.find_or_create_by_key(hash['key'] || Factory.next(:key))
- Factory :localization, :blurb => blurb, :locale => locale,
- :draft_content => draft_content, :published_content => published_content
+ Factory :localization, hash.merge(:blurb => blurb, :locale => locale)
end
end
-Given /^the following copy is published:$/ do |table|
+Given /^the following blurb is published:$/ do |table|
table.hashes.each do |hash|
project = Project.find_by_name!(hash['project'])
published_content = hash['content'] || ''
@@ -35,15 +29,15 @@
end
end
-Then /^the following copy should exist in the "([^"]+)" project:$/ do |project_name, table|
+Then /^the following blurb should exist in the "([^"]+)" project:$/ do |project_name, table|
project = Project.find_by_name!(project_name)
- table.hashes.each do |copy_data|
- blurb = project.blurbs.find_by_key!(copy_data.delete('key'))
- locale = project.locales.find_by_key!(copy_data.delete('locale') || 'en')
+ table.hashes.each do |blurb_data|
+ blurb = project.blurbs.find_by_key!(blurb_data.delete('key'))
+ locale = project.locales.find_by_key!(blurb_data.delete('locale') || 'en')
localization = blurb.localizations.find_by_locale_id!(locale.id)
- copy_data.each do |key, value|
+ blurb_data.each do |key, value|
localization[key].should == value
end
end
View
12 features/blurb_translating.feature → features/translate_blurb.feature
@@ -3,12 +3,12 @@ Feature: translate blurbs
Background:
Given a project exists with a name of "Project 1"
- And the following copy exists:
- | project | draft content | key | locale |
- | Project 1 | hello | one | en |
- | Project 1 | hola | one | es |
- | Project 1 | goodbye | two | en |
- | Project 1 | adios | two | es |
+ And the following localizations exist in the "Project 1" project:
+ | draft_content | key | locale |
+ | hello | one | en |
+ | hola | one | es |
+ | goodbye | two | en |
+ | adios | two | es |
When I go to the dashboard page
And I follow "Project 1"
View
16 features/blurb_browsing.feature → features/view_blurbs.feature
@@ -1,14 +1,14 @@
-Feature: Blurb Browsing
+Feature: View blurbs
@javascript
- Scenario: Listing Blurbs in a Project
+ Scenario: View blurbs for a project
Given a project exists with a name of "Project 1"
- And the following copy exists:
- | project | draft content | key |
- | Project 1 | blah la | test.key |
- | Project 1 | blah ha | awesome! |
- | Project 1 | this is a very long bunch of words | more.key |
- | Project 1 | Some simple text | another |
+ And the following localizations exist in the "Project 1" project:
+ | draft_content | key |
+ | blah la | test.key |
+ | blah ha | awesome! |
+ | this is a very long bunch of words | more.key |
+ | Some simple text | another |
When I go to the dashboard page
And I follow "Project 1"
Then no visible elements should contain "test"
View
12 features/view_instructions_for_new_locale.feature
@@ -0,0 +1,12 @@
+@javascript
+Feature: View instructions for new locale
+
+ Scenario: View instructions for new locale
+ Given a project exists with a name of "Project 1"
+ And the following localizations exist in the "Project 1" project:
+ | draft_content | key | locale |
+ | hello | one | en |
+ When I go to the dashboard page
+ And I follow "Project 1"
+ And I follow "Add a new locale..."
+ Then I should see "Adding new locales to Copycopter"
View
6 spec/factories.rb
@@ -2,12 +2,12 @@
sequence(:key) { |n| "key#{n}" }
sequence(:name) { |n| "name#{n}" }
- factory :locale do
- key
+ factory :blurb do
project
end
- factory :blurb do
+ factory :locale do
+ key
project
end
Please sign in to comment.
Something went wrong with that request. Please try again.