scaffold models
This commit is contained in:
36
spec/views/crm/customers/edit.html.erb_spec.rb
Normal file
36
spec/views/crm/customers/edit.html.erb_spec.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "crm/customers/edit", type: :view do
|
||||
before(:each) do
|
||||
@crm_customer = assign(:crm_customer, Crm::Customer.create!(
|
||||
:name => "MyString",
|
||||
:company => "MyString",
|
||||
:contact_no => "MyString",
|
||||
:email => "MyString",
|
||||
:membership => nil,
|
||||
:membership_type => "MyString",
|
||||
:membership_authentication_code => "MyString"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit crm_customer form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", crm_customer_path(@crm_customer), "post" do
|
||||
|
||||
assert_select "input#crm_customer_name[name=?]", "crm_customer[name]"
|
||||
|
||||
assert_select "input#crm_customer_company[name=?]", "crm_customer[company]"
|
||||
|
||||
assert_select "input#crm_customer_contact_no[name=?]", "crm_customer[contact_no]"
|
||||
|
||||
assert_select "input#crm_customer_email[name=?]", "crm_customer[email]"
|
||||
|
||||
assert_select "input#crm_customer_membership_id[name=?]", "crm_customer[membership_id]"
|
||||
|
||||
assert_select "input#crm_customer_membership_type[name=?]", "crm_customer[membership_type]"
|
||||
|
||||
assert_select "input#crm_customer_membership_authentication_code[name=?]", "crm_customer[membership_authentication_code]"
|
||||
end
|
||||
end
|
||||
end
|
||||
37
spec/views/crm/customers/index.html.erb_spec.rb
Normal file
37
spec/views/crm/customers/index.html.erb_spec.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "crm/customers/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:crm_customers, [
|
||||
Crm::Customer.create!(
|
||||
:name => "Name",
|
||||
:company => "Company",
|
||||
:contact_no => "Contact No",
|
||||
:email => "Email",
|
||||
:membership => nil,
|
||||
:membership_type => "Membership Type",
|
||||
:membership_authentication_code => "Membership Authentication Code"
|
||||
),
|
||||
Crm::Customer.create!(
|
||||
:name => "Name",
|
||||
:company => "Company",
|
||||
:contact_no => "Contact No",
|
||||
:email => "Email",
|
||||
:membership => nil,
|
||||
:membership_type => "Membership Type",
|
||||
:membership_authentication_code => "Membership Authentication Code"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of crm/customers" do
|
||||
render
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Company".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Contact No".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Email".to_s, :count => 2
|
||||
assert_select "tr>td", :text => nil.to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Membership Type".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Membership Authentication Code".to_s, :count => 2
|
||||
end
|
||||
end
|
||||
36
spec/views/crm/customers/new.html.erb_spec.rb
Normal file
36
spec/views/crm/customers/new.html.erb_spec.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "crm/customers/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:crm_customer, Crm::Customer.new(
|
||||
:name => "MyString",
|
||||
:company => "MyString",
|
||||
:contact_no => "MyString",
|
||||
:email => "MyString",
|
||||
:membership => nil,
|
||||
:membership_type => "MyString",
|
||||
:membership_authentication_code => "MyString"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new crm_customer form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", crm_customers_path, "post" do
|
||||
|
||||
assert_select "input#crm_customer_name[name=?]", "crm_customer[name]"
|
||||
|
||||
assert_select "input#crm_customer_company[name=?]", "crm_customer[company]"
|
||||
|
||||
assert_select "input#crm_customer_contact_no[name=?]", "crm_customer[contact_no]"
|
||||
|
||||
assert_select "input#crm_customer_email[name=?]", "crm_customer[email]"
|
||||
|
||||
assert_select "input#crm_customer_membership_id[name=?]", "crm_customer[membership_id]"
|
||||
|
||||
assert_select "input#crm_customer_membership_type[name=?]", "crm_customer[membership_type]"
|
||||
|
||||
assert_select "input#crm_customer_membership_authentication_code[name=?]", "crm_customer[membership_authentication_code]"
|
||||
end
|
||||
end
|
||||
end
|
||||
26
spec/views/crm/customers/show.html.erb_spec.rb
Normal file
26
spec/views/crm/customers/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "crm/customers/show", type: :view do
|
||||
before(:each) do
|
||||
@crm_customer = assign(:crm_customer, Crm::Customer.create!(
|
||||
:name => "Name",
|
||||
:company => "Company",
|
||||
:contact_no => "Contact No",
|
||||
:email => "Email",
|
||||
:membership => nil,
|
||||
:membership_type => "Membership Type",
|
||||
:membership_authentication_code => "Membership Authentication Code"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/Company/)
|
||||
expect(rendered).to match(/Contact No/)
|
||||
expect(rendered).to match(/Email/)
|
||||
expect(rendered).to match(//)
|
||||
expect(rendered).to match(/Membership Type/)
|
||||
expect(rendered).to match(/Membership Authentication Code/)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user