From eaf3d3cddf418c560c9619f722ea1dbc5d6cc61a Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 15:59:50 -0500 Subject: currently adding Session controller and view --- spec/views/pms/edit.html.erb_spec.rb | 22 ++++++++++++++++++++++ spec/views/pms/index.html.erb_spec.rb | 26 ++++++++++++++++++++++++++ spec/views/pms/new.html.erb_spec.rb | 22 ++++++++++++++++++++++ spec/views/pms/show.html.erb_spec.rb | 19 +++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 spec/views/pms/edit.html.erb_spec.rb create mode 100644 spec/views/pms/index.html.erb_spec.rb create mode 100644 spec/views/pms/new.html.erb_spec.rb create mode 100644 spec/views/pms/show.html.erb_spec.rb (limited to 'spec/views/pms') diff --git a/spec/views/pms/edit.html.erb_spec.rb b/spec/views/pms/edit.html.erb_spec.rb new file mode 100644 index 0000000..5ec0de5 --- /dev/null +++ b/spec/views/pms/edit.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "pms/edit" do + before(:each) do + @pm = assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + )) + end + + it "renders the edit pm form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", pm_path(@pm), "post" do + assert_select "input#pm_author[name=?]", "pm[author]" + assert_select "input#pm_recipient[name=?]", "pm[recipient]" + assert_select "textarea#pm_message[name=?]", "pm[message]" + end + end +end diff --git a/spec/views/pms/index.html.erb_spec.rb b/spec/views/pms/index.html.erb_spec.rb new file mode 100644 index 0000000..a3bc733 --- /dev/null +++ b/spec/views/pms/index.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "pms/index" do + before(:each) do + assign(:pms, [ + stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ), + stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ) + ]) + end + + it "renders a list of pms" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/pms/new.html.erb_spec.rb b/spec/views/pms/new.html.erb_spec.rb new file mode 100644 index 0000000..342af96 --- /dev/null +++ b/spec/views/pms/new.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "pms/new" do + before(:each) do + assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ).as_new_record) + end + + it "renders new pm form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", pms_path, "post" do + assert_select "input#pm_author[name=?]", "pm[author]" + assert_select "input#pm_recipient[name=?]", "pm[recipient]" + assert_select "textarea#pm_message[name=?]", "pm[message]" + end + end +end diff --git a/spec/views/pms/show.html.erb_spec.rb b/spec/views/pms/show.html.erb_spec.rb new file mode 100644 index 0000000..5802887 --- /dev/null +++ b/spec/views/pms/show.html.erb_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe "pms/show" do + before(:each) do + @pm = assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + rendered.should match(//) + rendered.should match(/MyText/) + end +end -- cgit v1.2.3-2-g168b