-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Varsha/Thejas] Added cabpool controller and spec for it
- Loading branch information
thejasbabu
committed
Dec 1, 2015
1 parent
6590491
commit 1a175b4
Showing
13 changed files
with
72 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
class CabpoolsController < ApplicationController | ||
attr_reader :locality | ||
|
||
def new | ||
@cabpool = Cabpool.new | ||
user = User.find_by_email(session[:userid]) | ||
@locality = Locality.find(user.locality_id).name | ||
debugger | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
module CabpoolsHelper | ||
end |
Empty file.
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,28 @@ | ||
<% provide(:title, 'Create a new cabpools') %> | ||
<% if FEATURES.active?('user_feature') %> | ||
<h1>Create a new cabpool to find your soulmate <3</h1> | ||
<div class="row"> | ||
<div class="col-md-4 col-md-offset-4"> | ||
<%= form_for(@cabpool) do |c| %> | ||
|
||
<%= c.label :number_of_people, "Number of people to travel with" %> | ||
<%= c.text_field :number_of_people, class: 'form-control' %> | ||
|
||
<%= c.label :timein, "Pick-up time to office" %> | ||
<%= c.text_field :timein, class: 'form-control' %> | ||
|
||
<%= c.label :timeout, "Pick-up time from office" %> | ||
<%= c.text_field :timeout, class: 'form-control' %> | ||
|
||
<%= c.label :route, "Via" %> | ||
<%= c.text_field :route, class: 'form-control' %> | ||
|
||
<%= c.label :locality, "Locality" %> | ||
<%= @locality %> | ||
|
||
<%= c.submit "Create a pool", class: "btn btn-primary form-control", style: 'align: center' %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% 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
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 was deleted.
Oops, something went wrong.
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,25 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe CabpoolsController, type: :controller do | ||
|
||
before(:each) do | ||
session[:userid] = "thejasb@thoughtworks.com" | ||
stub_user = User.new(:name => "Thejas", :email => "thejasb@thoughtworks.com", :locality_id => 1) | ||
allow(User).to receive(:find_by_email).and_return(stub_user) | ||
allow(stub_user).to receive(:locality_id).and_return(1) | ||
stub_locality = Locality.new(:name =>"Blah") | ||
allow(Locality).to receive(:find).and_return(stub_locality) | ||
allow(stub_locality).to receive(:name).and_return("Blah") | ||
|
||
end | ||
|
||
it 'should render create cabpools page' do | ||
get :new | ||
expect(response).to render_template('new') | ||
end | ||
|
||
it 'should return the locality of user' do | ||
get :new | ||
expect(assigns(:locality)).to eq "Blah" | ||
end | ||
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
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe CabpoolsHelper, type: :helper do | ||
end |