forked from publify/publify
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Merge Feature #34
Open
jbuechs
wants to merge
38
commits into
Ada-C4:master
Choose a base branch
from
jbuechs:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
ea8b763
complete setup
jbuechs 22db627
add better errors
jbuechs 87a2f98
add pry
jbuechs 4ebdd0c
create stubs for adding and editing category features
jbuechs 96056fa
check for id in params to determine whether new or editing category
jbuechs f58f517
bugfix for empty category name
jbuechs e8c3f91
update dbs
jbuechs 75a3724
add tests for new category
jbuechs 6261cd6
create cucumber tests for creating a category
jbuechs 77c2ebb
create feature tests for category
jbuechs 657c1a4
create tests for valid and invalid updating of category
jbuechs 42e9c93
spec/controllers/accounts_controller_spec.rb
jbuechs b28f533
add update category tests to cucumber
jbuechs 93c5397
add update category tests to cucumber
jbuechs 09f2a3c
update dbs
jbuechs c9adfa0
remove db files from commit
jbuechs e37d605
remove pry
jbuechs 8018e78
change test description for clarity
jbuechs 79615d1
create test for adding merge to new article form
jbuechs abf1587
add test that contributor does not see merge form
jbuechs e0229ec
showing merge form for admin
jbuechs 4517eb7
create test for merging text
jbuechs 1edbaaa
format tables
jbuechs 08dec6a
separate article_merge tests into admin and not admin
jbuechs 8c73be9
update admin features to not show merge on new page
jbuechs 310076a
complete tests for merging text of two articles
jbuechs 0f506a4
implement feature for merging text of two articles
jbuechs 11791a6
create test for merging comments
jbuechs 9a8c0a0
merge comments
jbuechs d659aa6
create test for deleting merged article
jbuechs 4a26383
delete merged article
jbuechs 0f6e8e5
delete merged article
jbuechs 95942e1
Merge branch 'master' of github.com:jbuechs/typo
jbuechs 38b7ee5
remove pry and rename variable to be more meaningful
jbuechs 85b115d
move merge function to model and create transaction
jbuechs b5d8a96
add db file to gitignore
jbuechs c0acb92
only query all articles when admin and editing
jbuechs 89ecebe
refactor merging comments
jbuechs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Feature: Article Merge | ||
|
||
As a blog administrator | ||
In order to keep my blog organized | ||
I want to be able to merge similar articles on my blog | ||
|
||
Background: | ||
Given the blog is set up | ||
Given I am logged into the admin panel | ||
Given the following article records | ||
| title | author | body | user_id | published | | ||
| Hello! | Ada Lovelace | Hello, world! | 2 | true | | ||
| Goodbye! | Admin | Goodbye, waterfalls! | 1 | true | | ||
Given the following comment records | ||
| author | body | article_id | published | | ||
| Ada Lovelace | Hello, article! | 3 | true | | ||
| Charles Babbage | Goodbye, article. | 4 | true | | ||
|
||
Scenario: Display Merge Articles Button to Admin on Edit Page | ||
Given I am on the edit article page for "Hello!" | ||
Then I should see "Merge Articles" | ||
And I should see "Merge" button | ||
|
||
Scenario: Do not Display Merge Articles Button to Admin on New Page | ||
And I am on the new article page | ||
Then I should not see "Merge Articles" | ||
And I should not see "Merge" button | ||
|
||
Scenario: Merge text of two articles | ||
Given I am on the edit article page for "Hello!" | ||
And I select "Goodbye!" from the dropdown | ||
And I press "Merge" | ||
Then I should be on the edit article page for "Hello!" | ||
When I go to the article page for "Hello!" | ||
Then I should see "Goodbye, waterfalls!" | ||
And I should see "Hello, world!" | ||
|
||
Scenario: Merge the comments of two articles | ||
Given I am on the article page for "Hello!" | ||
And the "Hello!" article should have 1 comment | ||
When I go to the edit article page for "Hello!" | ||
And I select "Goodbye!" from the dropdown | ||
And I press "Merge" | ||
Then the "Hello!" article should have 2 comments | ||
|
||
Scenario: Delete the merged article | ||
Given I am on the home page | ||
Then I should see "Goodbye!" | ||
When I go to the edit article page for "Hello!" | ||
And I select "Goodbye!" from the dropdown | ||
And I press "Merge" | ||
When I go to the homepage | ||
Then I should not see "Goodbye!" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Feature: Article Merge | ||
|
||
As a blog contributor | ||
In order to keep my blog organized | ||
I want to be able to merge similar articles on my blog | ||
|
||
Background: | ||
Given the blog is set up | ||
Given I am logged in as contributor to the admin panel | ||
Given the following article records | ||
| title | author | body | user_id | | ||
| Hello, world! | Ada Lovelace | Hello, world! | 2 | | ||
| Goodbye! | Admin | Goodbye, waterfalls! | 1 | | ||
|
||
Scenario: Do not Display Merge Articles Button on Edit Page | ||
Given I am on the edit article page for "Hello, world!" | ||
Then I should not see "Merge Articles" | ||
And I should not see "Merge" button | ||
|
||
Scenario: Do not Display Merge Articles Button on New Page | ||
Given I am on the new article page | ||
Then I should not see "Merge Articles" | ||
And I should not see "Merge" button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Feature: Categories | ||
As a blog administrator | ||
In order to share my thoughts with the world | ||
I want to be able to create and manage categories to my blog | ||
|
||
Background: | ||
Given the blog is set up | ||
And I am logged into the admin panel | ||
|
||
Scenario: Successfully add new category | ||
Given I am on the new category page | ||
When I fill in "category_name" with "Foobar" | ||
And I press "Save" | ||
Then I should be on the new category page | ||
And I should see "Foobar" | ||
And page should have success message "Category was successfully saved." | ||
|
||
Scenario: Error message with blank new category | ||
Given I am on the new category page | ||
And I press "Save" | ||
Then I should be on the new category page | ||
And page should have error message "Category could not be saved." | ||
|
||
Scenario: Update a category | ||
Given the following category records | ||
| name | | ||
| Foobar | | ||
And I am on the edit page for "Foobar" | ||
When I fill in "category_name" with "Foobaz" | ||
And I press "Save" | ||
Then I should be on the new category page | ||
And I should see "Foobaz" | ||
And page should have success message "Category was successfully saved." | ||
|
||
Scenario: Error message with blank update category | ||
Given the following category records | ||
| name | | ||
| Foobar | | ||
And I am on the edit page for "Foobar" | ||
When I fill in "category_name" with "" | ||
And I press "Save" | ||
Then I should be on the new category page | ||
And I should see "Foobar" | ||
And page should have error message "Category could not be saved." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,12 @@ def with_scope(locator) | |
:profile_id => 1, | ||
:name => 'admin', | ||
:state => 'active'}) | ||
User.create!({:login => 'ada', | ||
:password => 'lovelace', | ||
:email => '[email protected]', | ||
:profile_id => 2, | ||
:name => 'ada', | ||
:state => 'active'}) | ||
end | ||
|
||
And /^I am logged into the admin panel$/ do | ||
|
@@ -55,6 +61,18 @@ def with_scope(locator) | |
end | ||
end | ||
|
||
Given /^I am logged in as contributor to the admin panel$/ do | ||
visit '/accounts/login' | ||
fill_in 'user_login', :with => 'ada' | ||
fill_in 'user_password', :with => 'lovelace' | ||
click_button 'Login' | ||
if page.respond_to? :should | ||
page.should have_content('Login successful') | ||
else | ||
assert page.has_content?('Login successful') | ||
end | ||
end | ||
|
||
# Single-line step scoper | ||
When /^(.*) within (.*[^:])$/ do |step, parent| | ||
with_scope(parent) { When step } | ||
|
@@ -276,3 +294,30 @@ def with_scope(locator) | |
Then /^show me the page$/ do | ||
save_and_open_page | ||
end | ||
|
||
Then /^page should have (.+) message "([^\"]*)"$/ do |type, text| | ||
page.has_css?("div.#{type}", :text => text, :visible => true) | ||
end | ||
|
||
Given /^the following (.+) records$/ do |factory, table| | ||
table.hashes.each do |hash| | ||
Factory(factory, hash) | ||
end | ||
end | ||
|
||
Then /^I should see "([^"]*)" button/ do |name| | ||
should have_button name | ||
end | ||
|
||
Then /^I should not see "(.*?)" button$/ do |name| | ||
should have_no_button name | ||
end | ||
|
||
Given /^I select "(.*?)" from the dropdown$/ do |title| | ||
select title, from: "merge_with" | ||
end | ||
|
||
Given /^the "(.*?)" article should have (\d+) comments*$/ do |title, num| | ||
article = Article.where(title: title).first | ||
article.comments.count.should == num.to_i | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These scenarios look great