Commit 993ccc23 by Vijay Gawariya

Merge branch 'master' of 35.155.93.82:amansharma/react-rails-rspec

parents aadb6ee8 711137cb
......@@ -54,6 +54,7 @@ end
group :test do
gem 'factory_bot_rails'
gem 'faker'
gem 'capybara'
end
......
......@@ -42,12 +42,22 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
arel (9.0.0)
bindex (0.8.1)
bootsnap (1.4.8)
msgpack (~> 1.0)
builder (3.2.4)
byebug (11.0.1)
capybara (3.15.1)
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)
concurrent-ruby (1.1.7)
crass (1.0.6)
diff-lcs (1.4.4)
......@@ -88,6 +98,7 @@ GEM
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
pg (1.2.3)
public_suffix (4.0.6)
puma (3.12.6)
rack (2.2.3)
rack-proxy (0.6.5)
......@@ -122,6 +133,7 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (1.8.1)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
......@@ -185,6 +197,8 @@ GEM
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
PLATFORMS
ruby
......@@ -192,6 +206,7 @@ PLATFORMS
DEPENDENCIES
bootsnap (>= 1.1.0)
byebug
capybara
factory_bot_rails
faker
jbuilder (~> 2.5)
......
......@@ -14,6 +14,8 @@ export default () => (
to="/recipes"
className="btn btn-lg custom-button"
role="button"
name="View Recipes"
id="View Recipes"
>
View Recipes
</Link>
......
{
"name": "rails_react_recipe",
"private": true,
"scripts": {
"test": "jest",
"test-watch": "jest --watch"
},
"dependencies": {
"@babel/preset-react": "^7.10.4",
"@rails/webpacker": "4.3.0",
......@@ -14,6 +18,12 @@
"react-router-dom": "^5.2.0"
},
"devDependencies": {
"jest": "^26.4.2",
"webpack-dev-server": "^3.11.0"
},
"jest": {
"roots": [
"test/javascript"
]
}
}
FactoryBot.define do
factory :random_recipe, class: Recipe do
name { Faker::Food.dish }
ingredients { Faker::Food.ingredient }
instruction { Faker::Food.description }
end
end
describe "GET '/' - from API", :type => :feature do
it 'checks the application renders or not' do
visit('http://localhost:3000/')
expect(page.title).to eq("RailsReactRecipe")
end
end
\ No newline at end of file
require 'rails_helper'
RSpec.describe Recipe do
RSpec.describe Recipe, type: :model do
describe 'Recipe Model Validation Tests' do
it 'should run the first test case' do
puts 'hello world! test'
expect('result').to eq('result')
end
let(:recipe) { build(:random_recipe) }
it 'should validate the data if name is nil' do
recipe.name = nil
expect(recipe.save).to eq(false)
end
it 'should validate the data if ingredients is nil' do
recipe.ingredients = nil
expect(recipe.save).to eq(false)
end
it 'should validate the data if instruction is nil' do
recipe.instruction = nil
expect(recipe.save).to eq(false)
end
end
end
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment