Skip to content

Commit

Permalink
Merge pull request #2 from pawanghising67/cucumbertest
Browse files Browse the repository at this point in the history
Cucumbertest
  • Loading branch information
pawanghising67 committed Apr 29, 2019
2 parents f9adea7 + abfeec0 commit 06960c0
Show file tree
Hide file tree
Showing 25 changed files with 289 additions and 35 deletions.
9 changes: 8 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,11 @@ group :development, :test do
end

# devise
gem 'devise'
gem 'devise'

#Cucumber test gem file
group :test do
gem 'cucumber-rails', require: false
# database_cleaner is not required, but highly recommended
gem 'database_cleaner'
end
46 changes: 46 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,23 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
arel (6.0.4)
backports (3.14.0)
bcrypt (3.1.12)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
builder (3.2.3)
byebug (11.0.1)
capybara (3.18.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
Expand All @@ -51,6 +62,29 @@ GEM
columnize (0.9.0)
concurrent-ruby (1.1.5)
crass (1.0.4)
cucumber (3.1.2)
builder (>= 2.1.2)
cucumber-core (~> 3.2.0)
cucumber-expressions (~> 6.0.1)
cucumber-wire (~> 0.0.1)
diff-lcs (~> 1.3)
gherkin (~> 5.1.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
cucumber-core (3.2.1)
backports (>= 3.8.0)
cucumber-tag_expressions (~> 1.1.0)
gherkin (~> 5.0)
cucumber-expressions (6.0.1)
cucumber-rails (1.7.0)
capybara (>= 2.3.0, < 4)
cucumber (>= 3.0.2, < 4)
mime-types (>= 1.17, < 4)
nokogiri (~> 1.8)
railties (>= 4.2, < 7)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
database_cleaner (1.7.0)
debug_inspector (0.0.3)
debugger-linecache (1.2.0)
debugger2 (1.0.0.beta2)
Expand All @@ -62,9 +96,11 @@ GEM
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
diff-lcs (1.3)
erubis (2.7.0)
execjs (2.7.0)
ffi (1.10.0)
gherkin (5.1.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
haml (5.0.4)
Expand All @@ -85,13 +121,18 @@ GEM
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
multi_json (1.13.1)
multi_test (0.1.2)
nokogiri (1.10.2)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
public_suffix (3.0.3)
rack (1.6.11)
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -124,6 +165,7 @@ GEM
rb-inotify (0.10.0)
ffi (~> 1.0)
rdoc (4.3.0)
regexp_parser (1.4.0)
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
Expand Down Expand Up @@ -169,13 +211,17 @@ GEM
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
xpath (3.2.0)
nokogiri (~> 1.8)

PLATFORMS
ruby

DEPENDENCIES
byebug
coffee-rails (~> 4.1.0)
cucumber-rails
database_cleaner
debugger2
devise
haml
Expand Down
9 changes: 9 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ To Set Up in Cloud9, run:

gem install rails -v 4.2.11

git init
# Use http:// before link
git clone http://github.com/housing484/Xplor

Expand All @@ -20,3 +21,11 @@ bundle install \-\-without production
# to run server

rails s -p $PORT -b $IP


#to run the cucumber test for home page
cucumber features/homepage.features

#to run the cucumber test for login page
cucumber features/login.feature

9 changes: 7 additions & 2 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
class PagesController < ApplicationController
def about
@title = 'About Us'
@content = 'Our mission is to help student get cheap and better housing preferably any time of year '

end

def listfindapt

end


end
18 changes: 8 additions & 10 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,25 @@ def homepage

end

def listfindapt

end


def AptPosts
def index
@posts = Post.all
end




def show
@post = Post.find(params[:id])

@post=Post.find(params[:id])
end


#form
def new

end

def create
#render plain: params[:post].inspect
@post = Post.new(post_params)
@post=Post.new(params[:post].permit(:title,:body))

@post.save
redirect_to @post
Expand All @@ -34,4 +30,6 @@ def create
private def post_params
params.require(:Post).permit(:title, :body)
end


end
5 changes: 2 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
<!--nav bar with home, rent sign in sign up and other buttons-->
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<img class="mb-4" src="http://www.voicemailtel.com/wp-content/uploads/2013/08/x-lite.png" alt="" width="40" height="40">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault">
</button>

<!--home button-->
Expand All @@ -27,7 +26,7 @@
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href = 'https://xplor3-pawanghising67.c9users.io/about'>About Us </a>
<a class="nav-link" <%= link_to "About", about_path %></a>
</li>


Expand Down
Empty file added app/views/pages/Untitled
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1 class="jumbotron-heading">Xplor - Housing at MNSU</h1>
<p class="lead text-muted">We are here to give you a better living experience. Sign Up today and explore hundreds and thousands of options for your time at MNSU.</p>
<p>
<a href="#" class="btn btn-primary my-2">List Apartment</a>
<a href="https://xplor3-pawanghising67.c9users.io/posts/new" class="btn btn-primary my-2">List Apartment</a>
<a href="#" class="btn btn-secondary my-2">Find Apartment</a>

</p>
Expand Down
6 changes: 4 additions & 2 deletions app/views/posts/homepage.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
<h1 class="jumbotron-heading">Xplor - Housing at MNSU</h1>
<p class="lead text-muted">We are here to give you a better living experience. Sign Up today and explore hundreds and thousands of options for your time at MNSU.</p>
<p>
<a href class="btn btn-primary my-2">Rent</a>
<a class="btn btn-secondary my-2" <%= link_to "Rent" , rental2_path %>

</a>

<a href="#" class="btn btn-secondary my-2">Sublease</a>

Expand Down Expand Up @@ -84,7 +86,7 @@
</main>



<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
Expand Down
8 changes: 8 additions & 0 deletions app/views/posts/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

<h1>Apartments Posts</h1>
<% @posts.each do |post| %>
<h3><%= post.title %></h3>
<p><%= post.body %></p>


<% end %>
13 changes: 8 additions & 5 deletions app/views/posts/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
</br>
<h1> Have a place to lease? Post your housing here.</h1>
<%= form_for :post do |f| %>
</br>
<h1> Add Post</h1>
<%= form_for :post, url: posts_path do |f| %>
<p>
<%= f.label :title %><br>
<%= f.text_field :title %>
<%= f.label :location %><br>
<%= f.text_field :text %>

</p>

<p>
<%= f.label :body %><br>
<%= f.label :price %><br>
<%= f.text_area :body %>
</p>


<p>
<%=f.submit %>

</p>

<% end %>
File renamed without changes.
3 changes: 3 additions & 0 deletions app/views/posts/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
</br>
</br>

<h2><%p= @post.title %></h2>
<p><%= @post.body %> </p>
9 changes: 9 additions & 0 deletions config/cucumber.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun = rerun.strip.gsub /\s/, ' '
rerun_opts = rerun.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags 'not @wip'"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip'
5 changes: 4 additions & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ development:
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
test: &test
<<: *default
database: db/test.sqlite3

production:
<<: *default
database: db/production.sqlite3

cucumber:
<<: *test
2 changes: 2 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true


end
16 changes: 6 additions & 10 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@

devise_for :users
devise_scope :user do
get '/users/sign_out' => 'devise/sessions#destroy'
get '/users/sign_out' => 'devise/sessions#destroy'

end
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".

# You can have the root of your site routed with "root"
root 'posts#homepage', as:'home'

# Example of regular route:

get 'about' => 'pages#about', as: 'about'

get 'rental2' => 'pages#listfindapt', as: 'rental2'


# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

# Example resource route (maps HTTP verbs to controller actions automatically):
get 'index' => 'posts#index', as: 'apartment'

resources :posts


# Example resource route with options:
# resources :products do
Expand Down
7 changes: 7 additions & 0 deletions features/homepage.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Feature: Homepage
In order to view the homepage
As a user to the website
I want to view the homepage

Scenario: Visiting the web page
Given I am on the homepage url
7 changes: 7 additions & 0 deletions features/login.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Feature: Login
As a registered user of the website
I want to be able to login

Scenario: Logging in the the web page
Given I am on the login page

Empty file.
3 changes: 3 additions & 0 deletions features/step_definitions/homepage_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Given("I am on the homepage url") do
visit home_path
end
3 changes: 3 additions & 0 deletions features/step_definitions/login_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Given("I am on the login page") do
visit new_user_session_path
end
Loading

0 comments on commit 06960c0

Please sign in to comment.