summaryrefslogtreecommitdiff
path: root/spec/views/alerts
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/alerts')
-rw-r--r--spec/views/alerts/edit.html.erb_spec.rb20
-rw-r--r--spec/views/alerts/index.html.erb_spec.rb23
-rw-r--r--spec/views/alerts/new.html.erb_spec.rb20
-rw-r--r--spec/views/alerts/show.html.erb_spec.rb17
4 files changed, 80 insertions, 0 deletions
diff --git a/spec/views/alerts/edit.html.erb_spec.rb b/spec/views/alerts/edit.html.erb_spec.rb
new file mode 100644
index 0000000..d837f26
--- /dev/null
+++ b/spec/views/alerts/edit.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "alerts/edit" do
+ before(:each) do
+ @alert = assign(:alert, stub_model(Alert,
+ :author => nil,
+ :message => "MyText"
+ ))
+ end
+
+ it "renders the edit alert form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", alert_path(@alert), "post" do
+ assert_select "input#alert_author[name=?]", "alert[author]"
+ assert_select "textarea#alert_message[name=?]", "alert[message]"
+ end
+ end
+end
diff --git a/spec/views/alerts/index.html.erb_spec.rb b/spec/views/alerts/index.html.erb_spec.rb
new file mode 100644
index 0000000..a5b4f3c
--- /dev/null
+++ b/spec/views/alerts/index.html.erb_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe "alerts/index" do
+ before(:each) do
+ assign(:alerts, [
+ stub_model(Alert,
+ :author => nil,
+ :message => "MyText"
+ ),
+ stub_model(Alert,
+ :author => nil,
+ :message => "MyText"
+ )
+ ])
+ end
+
+ it "renders a list of alerts" 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 => "MyText".to_s, :count => 2
+ end
+end
diff --git a/spec/views/alerts/new.html.erb_spec.rb b/spec/views/alerts/new.html.erb_spec.rb
new file mode 100644
index 0000000..e38cbd3
--- /dev/null
+++ b/spec/views/alerts/new.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "alerts/new" do
+ before(:each) do
+ assign(:alert, stub_model(Alert,
+ :author => nil,
+ :message => "MyText"
+ ).as_new_record)
+ end
+
+ it "renders new alert form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", alerts_path, "post" do
+ assert_select "input#alert_author[name=?]", "alert[author]"
+ assert_select "textarea#alert_message[name=?]", "alert[message]"
+ end
+ end
+end
diff --git a/spec/views/alerts/show.html.erb_spec.rb b/spec/views/alerts/show.html.erb_spec.rb
new file mode 100644
index 0000000..267c9f1
--- /dev/null
+++ b/spec/views/alerts/show.html.erb_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe "alerts/show" do
+ before(:each) do
+ @alert = assign(:alert, stub_model(Alert,
+ :author => nil,
+ :message => "MyText"
+ ))
+ end
+
+ it "renders attributes in <p>" do
+ render
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ rendered.should match(//)
+ rendered.should match(/MyText/)
+ end
+end