Skip to content

Commit

Permalink
building the layouts controller
Browse files Browse the repository at this point in the history
  • Loading branch information
tooky committed Mar 20, 2009
1 parent 57ac7b1 commit e9051dd
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.sqlite3
config/database.yml
.DS_Store
.#*
6 changes: 6 additions & 0 deletions app/controllers/layouts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ def new

def create
@layout = Layout.new(params[:layout])
if @layout.save
redirect_to layout_path(@layout)
end
end

def show
render :text => 'ok'
end
end
4 changes: 2 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller accessible via GET requests. You should
# consider removing the them or commenting them out if you're using named routes and resources.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
# map.connect ':controller/:action/:id'
# map.connect ':controller/:action/:id.:format'
end
2 changes: 1 addition & 1 deletion features/create_layout.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Scenario: Sucessful Submission

When I add a new layout

Then I should see the page for my newly created layout
Then I should be redirected to the "main" layout page
And I should see "Layout created successfully"
4 changes: 1 addition & 3 deletions features/step_definitions/layout_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@
click_button('Create Layout')
end

Then /^I should see the page for my newly created layout$/ do
pending
end

13 changes: 13 additions & 0 deletions features/step_definitions/webrat_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,16 @@
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
field_labeled(label).should be_checked
end


Then /^I should be on (.+?)$/ do |page_name|
request.request_uri.should == path_to(page_name)
response.should be_success
end

Then /^I should be redirected to (.+?)$/ do |page_name|
request.headers['HTTP_REFERER'].should_not be_nil
request.headers['HTTP_REFERER'].should_not == request.request_uri

Then "I should be on #{page_name}"
end
3 changes: 2 additions & 1 deletion features/support/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ def path_to(page_name)
root_path
when /the layout creation page/
new_layout_path

when /the "(.+)" layout page/
layout_path($1)

# Add more page name => path mappings here

Expand Down

0 comments on commit e9051dd

Please sign in to comment.