-
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 and Edit Category Bug Fix #21
base: master
Are you sure you want to change the base?
Changes from 8 commits
426ded5
0f82c45
4ea7427
9758489
aeea9ca
498fcc2
a0cac85
e60682e
1b81836
6638ff4
86af143
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
class CategoriesController < GroupingController | ||
# index - inherited | ||
# show - inherited | ||
def new | ||
render 'new' | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add a New Category |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Feature: Create category | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this file duplicate to the features you have in the manage_categories file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checked my git status and didn't commit this file deletion. Thanks! |
||
As a user | ||
In order to categorize my blogs | ||
I want to create a category | ||
|
||
Background: | ||
Given the blog is set up | ||
And I am logged into the admin panel | ||
|
||
Scenario: Create category | ||
Given I am a user | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need this step given the "as a user" step at the beginning? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file was also deleted, just had to commit the change. Thanks! |
||
When I am on the homepage | ||
Then I should be able to click "Categories" | ||
And I should be able add a new category |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Feature: Create Catogory | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question, this is an edit_category file, but it seems like this stuff is in the manage_categories feature file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checked my git status and didn't commit this file deletion. Thanks! |
||
As a blog administrator | ||
In order to categorize my blogs | ||
I want to create a category | ||
|
||
Background: | ||
Given the blog is set up | ||
And I am logged into the admin panel | ||
|
||
Scenario: Create category | ||
Given I am a user | ||
When I am on the homepage | ||
Then I should be able to click "Categories" | ||
And I should be able add a new category | ||
Then I should see that the category I created exists |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Feature: Create category | ||
As an admin | ||
In order to categorize my blogs | ||
I want create and manage blog categories | ||
|
||
Background: | ||
Given the blog is set up | ||
And I am logged into the admin panel | ||
|
||
Scenario: Create category | ||
Given I am a user | ||
When I am on the homepage | ||
Then I should be able to click "Categories" | ||
And I should be able add a new category | ||
|
||
Scenario: Successfully visit categories page | ||
Given there are no categories | ||
When I follow "Categories" | ||
When I fill in "Name" with "dogs" | ||
Then I should be able to click "Categories" | ||
And I should have 1 category | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might also be good to add a "I should see 'dogs'" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added, thanks! |
||
|
||
Scenario: Create a Category | ||
When I follow "Categories" | ||
And I fill in "Name" with "dogs" | ||
And I fill in "Keywords" with "dogs" | ||
And I fill in "Permalink" with "www.test.com" | ||
And I fill in "Description" with "fun" | ||
And I press "Save" | ||
Then I should see "Category was successfully saved." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment re: seeing the newly created category There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added, thanks! |
||
|
||
Scenario: Edit a Category | ||
When I go to the edit page for "dogs" | ||
And I fill in "Description" with "playful" | ||
And I press "Save" | ||
Then I should see "Category was successfully saved." | ||
|
||
Scenario: Cancel editing | ||
When I got to the edit page for "dogs" | ||
And I press "Cancel" | ||
Then I should go to "Categories" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,12 +55,51 @@ def with_scope(locator) | |
end | ||
end | ||
|
||
Given /^I am logged in as a user$/ do | ||
User.create!({:login => 'joesmith', | ||
:password => 'password', | ||
:email => '[email protected]', | ||
:profile_id => 3, | ||
:name => 'Joe', | ||
:state => 'active'}) | ||
visit '/accounts/logout' | ||
visit '/accounts/login' | ||
fill_in 'user_login', :with => 'joesmith' | ||
fill_in 'user_password', :with => 'password' | ||
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 } | ||
end | ||
|
||
# Multi-line step scoper | ||
When /^I create a new category named $category/ do |category| | ||
visits new_category_path | ||
fills_in 'Category', :with => Category | ||
clicks_button 'Create' | ||
end | ||
|
||
Then /^I should see that a category named category$ exists/ do |category| | ||
response.body.should =~ Regexp.new(category) | ||
end | ||
|
||
When /^I edit a new category named category$/ do |category| | ||
visits edit_category_path | ||
fills_in 'Category', :with => Category | ||
clicks_button 'Create' | ||
end | ||
|
||
Then /^I should see that a category named category$ exists/ do |category| | ||
response.body.should =~ Regexp.new(category) | ||
end | ||
|
||
When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string| | ||
with_scope(parent) { When "#{step}:", table_or_string } | ||
end | ||
|
@@ -250,7 +289,7 @@ def with_scope(locator) | |
end | ||
end | ||
end | ||
|
||
Then /^(?:|I )should be on (.+)$/ do |page_name| | ||
current_path = URI.parse(current_url).path | ||
if current_path.respond_to? :should | ||
|
@@ -264,8 +303,8 @@ def with_scope(locator) | |
query = URI.parse(current_url).query | ||
actual_params = query ? CGI.parse(query) : {} | ||
expected_params = {} | ||
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} | ||
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} | ||
|
||
if actual_params.respond_to? :should | ||
actual_params.should == expected_params | ||
else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,16 @@ | |
request.session = { :user => henri.id } | ||
end | ||
|
||
it "renders the 'new' template" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these tests are good! |
||
get :new | ||
expect(response).to render_template :new | ||
end | ||
|
||
it "successfully loads 'new' page" do | ||
get :new | ||
expect(response.status).to eq 200 | ||
end | ||
|
||
it "test_index" do | ||
get :index | ||
assert_response :redirect, :action => 'index' | ||
|
@@ -48,7 +58,7 @@ | |
|
||
it 'should render destroy template' do | ||
assert_response :success | ||
assert_template 'destroy' | ||
assert_template 'destroy' | ||
end | ||
end | ||
|
||
|
@@ -62,5 +72,4 @@ | |
|
||
assert_raise(ActiveRecord::RecordNotFound) { Category.find(test_id) } | ||
end | ||
|
||
end |
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.
Do you need this since the bulk of the work is in the admin?
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.
Just checked my git status and didn't commit this deletion. Thanks!
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.
This is still in here - maybe missing another commit?