scaffold models

This commit is contained in:
Min Zeya Phyo
2017-04-20 17:01:14 +06:30
parent 0a97947259
commit 0af7d78c3c
145 changed files with 4127 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
require 'rails_helper'
RSpec.describe "settings/zones/edit", type: :view do
before(:each) do
@settings_zone = assign(:settings_zone, Settings::Zone.create!(
:name => "MyString",
:is_active => false,
:created_by => "MyString"
))
end
it "renders the edit settings_zone form" do
render
assert_select "form[action=?][method=?]", settings_zone_path(@settings_zone), "post" do
assert_select "input#settings_zone_name[name=?]", "settings_zone[name]"
assert_select "input#settings_zone_is_active[name=?]", "settings_zone[is_active]"
assert_select "input#settings_zone_created_by[name=?]", "settings_zone[created_by]"
end
end
end

View File

@@ -0,0 +1,25 @@
require 'rails_helper'
RSpec.describe "settings/zones/index", type: :view do
before(:each) do
assign(:settings_zones, [
Settings::Zone.create!(
:name => "Name",
:is_active => false,
:created_by => "Created By"
),
Settings::Zone.create!(
:name => "Name",
:is_active => false,
:created_by => "Created By"
)
])
end
it "renders a list of settings/zones" do
render
assert_select "tr>td", :text => "Name".to_s, :count => 2
assert_select "tr>td", :text => false.to_s, :count => 2
assert_select "tr>td", :text => "Created By".to_s, :count => 2
end
end

View File

@@ -0,0 +1,24 @@
require 'rails_helper'
RSpec.describe "settings/zones/new", type: :view do
before(:each) do
assign(:settings_zone, Settings::Zone.new(
:name => "MyString",
:is_active => false,
:created_by => "MyString"
))
end
it "renders new settings_zone form" do
render
assert_select "form[action=?][method=?]", settings_zones_path, "post" do
assert_select "input#settings_zone_name[name=?]", "settings_zone[name]"
assert_select "input#settings_zone_is_active[name=?]", "settings_zone[is_active]"
assert_select "input#settings_zone_created_by[name=?]", "settings_zone[created_by]"
end
end
end

View File

@@ -0,0 +1,18 @@
require 'rails_helper'
RSpec.describe "settings/zones/show", type: :view do
before(:each) do
@settings_zone = assign(:settings_zone, Settings::Zone.create!(
:name => "Name",
:is_active => false,
:created_by => "Created By"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Name/)
expect(rendered).to match(/false/)
expect(rendered).to match(/Created By/)
end
end