I generated a new rails app then installed rspec and rspec_on_rails from trunk. I then created a sample story: require File.dirname(__FILE__) + "/helper" Story "View Home Page", %{ As a user I want to view my home page So that I can get a birds eye view of the system }, :type => RailsStory do Scenario "Publisher with no videos" do When "visiting", "/" do |page| get page end Then "viewer should see", "companies/show_initial" do |template| response.should have_text(/Welcome/) end end end When I run the story, I get the error: kwigger:~/workspace/rspec-stories alvin$ ruby stories/all.rb Running 1 scenarios: Story: View Home Page As a user I want to view my home page So that I can get a birds eye view of the system Scenario: Publisher with no videos When visiting / Then viewer should see companies/show_initial F 1 scenarios: 0 succeeded, 1 failed, 0 pending FAILURES: 1) View Home Page (Publisher with no videos) FAILED Spec::Expectations::ExpectationNotMetError: expected /Welcome/, got "" /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/expectations.rb:52:in `fail_with'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/expectations/handler.rb:21:in `handle_matcher'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/expectations/extensions/object.rb:34:in `should'' /Users/alvin/workspace/rspec-stories/stories/first_story.rb:16:in `viewer should see'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/simple_step.rb:13:in `__send__'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/simple_step.rb:13:in `perform'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/world.rb:58:in `store_and_call'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/world.rb:78:in `Then'' /Users/alvin/workspace/rspec-stories/stories/first_story.rb:15 /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:14:in `instance_eval'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:14:in `run'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:48:in `run_stories'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:43:in `each'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:43:in `run_stories'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in `each'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in `run_stories'' /Users/alvin/workspace/rspec-stories/config/../vendor/plugins/rspec/lib/spec/story/runner.rb:38:in `register_exit_hook'' stories/all.rb:2 Finished in 0.012466 seconds 0 examples, 0 failures I was expecting to see the default rails index page in the response. Where am I going wrong? Thanks, Alvin.
On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote:> I generated a new rails app then installed rspec and rspec_on_rails from > trunk. > > I then created a sample story: > > require File.dirname(__FILE__) + "/helper" > > Story "View Home Page", %{ > As a user > I want to view my home page > So that I can get a birds eye view of the system > }, :type => RailsStory do > > Scenario "Publisher with no videos" do > > When "visiting", "/" do |page| > get page > end > > Then "viewer should see", "companies/show_initial" do |template| > response.should have_text(/Welcome/) > end > end > > end > > When I run the story, I get the error:<snip ...>> FAILURES: > 1) View Home Page (Publisher with no videos) FAILED > Spec::Expectations::ExpectationNotMetError: expected /Welcome/, got ""<snip ...>> I was expecting to see the default rails index page in the response. > > Where am I going wrong?Do you see the rails index page when you run the app?
> On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote: > >> I generated a new rails app then installed rspec and rspec_on_rails from >> trunk. >> >> I then created a sample story: >> >> require File.dirname(__FILE__) + "/helper" >> >> Story "View Home Page", %{ >> As a user >> I want to view my home page >> So that I can get a birds eye view of the system >> }, :type => RailsStory do >> >> Scenario "Publisher with no videos" do >> >> When "visiting", "/" do |page| >> get page >> end >> >> Then "viewer should see", "companies/show_initial" do |template| >> response.should have_text(/Welcome/) >> end >> end >> >> end >> >> When I run the story, I get the error: >> > <snip ...> > > >> FAILURES: >> 1) View Home Page (Publisher with no videos) FAILED >> Spec::Expectations::ExpectationNotMetError: expected /Welcome/, got "" >> > > <snip ...> > > >> I was expecting to see the default rails index page in the response. >> >> Where am I going wrong? >> > > Do you see the rails index page when you run the app? > >Yes.
Alvin Schur wrote:> >> On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote: >> >>> I generated a new rails app then installed rspec and rspec_on_rails >>> from >>> trunk. >>> >>> I then created a sample story: >>> >>> require File.dirname(__FILE__) + "/helper" >>> >>> Story "View Home Page", %{ >>> As a user >>> I want to view my home page >>> So that I can get a birds eye view of the system >>> }, :type => RailsStory do >>> >>> Scenario "Publisher with no videos" do >>> >>> When "visiting", "/" do |page| >>> get page >>> end >>> >>> Then "viewer should see", "companies/show_initial" do |template| >>> response.should have_text(/Welcome/) >>> end >>> end >>> >>> end >>> >>> When I run the story, I get the error: >>> >> <snip ...> >> >> >>> FAILURES: >>> 1) View Home Page (Publisher with no videos) FAILED >>> Spec::Expectations::ExpectationNotMetError: expected /Welcome/, >>> got "" >>> >> >> <snip ...> >> >> >>> I was expecting to see the default rails index page in the response. >>> >>> Where am I going wrong? >>> >> >> Do you see the rails index page when you run the app? >> >> > > Yes. > > >I created a basic rails integration test for the default welcome page (public/index.html) and this failed as well: no route found for / or page not found errors. I added a basic controller: class WelcomeController < ApplicationController def index render :text => "Welcome alvin" end end The rails integration test works as expected with the welcome controller. The RailsStory works as expected with the welcome controller. Alvin.
On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote:> Alvin Schur wrote: > > > >> On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote: > >> > >>> I generated a new rails app then installed rspec and rspec_on_rails > >>> from > >>> trunk. > >>> > >>> I then created a sample story: > >>> > >>> require File.dirname(__FILE__) + "/helper" > >>> > >>> Story "View Home Page", %{ > >>> As a user > >>> I want to view my home page > >>> So that I can get a birds eye view of the system > >>> }, :type => RailsStory do > >>> > >>> Scenario "Publisher with no videos" do > >>> > >>> When "visiting", "/" do |page| > >>> get page > >>> end > >>> > >>> Then "viewer should see", "companies/show_initial" do |template| > >>> response.should have_text(/Welcome/) > >>> end > >>> end > >>> > >>> end > >>> > >>> When I run the story, I get the error: > >>> > >> <snip ...> > >> > >> > >>> FAILURES: > >>> 1) View Home Page (Publisher with no videos) FAILED > >>> Spec::Expectations::ExpectationNotMetError: expected /Welcome/, > >>> got ""<snip ...>> >>> I was expecting to see the default rails index page in the response. > >>> > >>> Where am I going wrong? > >> > >> Do you see the rails index page when you run the app? > > > > Yes. > > > I created a basic rails integration test for the default welcome page > (public/index.html) and this failed as well: no route found for / or > page not found errors. > > I added a basic controller: > > class WelcomeController < ApplicationController > > def index > render :text => "Welcome alvin" > end > end > > > The rails integration test works as expected with the welcome controller.Does a rails integration test work without the Welcome Controller?> The RailsStory works as expected with the welcome controller.Seems to me that the problem might be that the rails testing support doesn''t handle serving up static pages in the public folder. The Rails Welcome page is /public/index.html. WDYT?
On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote:> Alvin Schur wrote: > > > >> On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote: > >> > >>> I generated a new rails app then installed rspec and rspec_on_rails > >>> from > >>> trunk. > >>> > >>> I then created a sample story: > >>> > >>> require File.dirname(__FILE__) + "/helper" > >>> > >>> Story "View Home Page", %{ > >>> As a user > >>> I want to view my home page > >>> So that I can get a birds eye view of the system > >>> }, :type => RailsStory do > >>> > >>> Scenario "Publisher with no videos" do > >>> > >>> When "visiting", "/" do |page| > >>> get page > >>> end > >>> > >>> Then "viewer should see", "companies/show_initial" do |template| > >>> response.should have_text(/Welcome/) > >>> end > >>> end > >>> > >>> end > >>> > >>> When I run the story, I get the error: > >>> > >> <snip ...> > >> > >> > >>> FAILURES: > >>> 1) View Home Page (Publisher with no videos) FAILED > >>> Spec::Expectations::ExpectationNotMetError: expected /Welcome/, > >>> got "" > >>> > >> > >> <snip ...> > >> > >> > >>> I was expecting to see the default rails index page in the response. > >>> > >>> Where am I going wrong? > >>> > >> > >> Do you see the rails index page when you run the app? > >> > >> > > > > Yes. > > > > > > > I created a basic rails integration test for the default welcome page > (public/index.html) and this failed as well: no route found for / or > page not found errors. > > I added a basic controller: > > class WelcomeController < ApplicationController > > def index > render :text => "Welcome alvin" > end > end > > > The rails integration test works as expected with the welcome controller. > > The RailsStory works as expected with the welcome controller. > > Alvin. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Funky. I guess integration tests are going only through the routing and don''t serve up any plain HTML pages at all. Pat
David Chelimsky wrote:> On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote: > >> Alvin Schur wrote: >> >>>> On 10/16/07, Alvin Schur <a.schur at nucleus.com> wrote: >>>> >>>> >>>>> I generated a new rails app then installed rspec and rspec_on_rails >>>>> from >>>>> trunk. >>>>> >>>>> I then created a sample story: >>>>> >>>>> require File.dirname(__FILE__) + "/helper" >>>>> >>>>> Story "View Home Page", %{ >>>>> As a user >>>>> I want to view my home page >>>>> So that I can get a birds eye view of the system >>>>> }, :type => RailsStory do >>>>> >>>>> Scenario "Publisher with no videos" do >>>>> >>>>> When "visiting", "/" do |page| >>>>> get page >>>>> end >>>>> >>>>> Then "viewer should see", "companies/show_initial" do |template| >>>>> response.should have_text(/Welcome/) >>>>> end >>>>> end >>>>> >>>>> end >>>>> >>>>> When I run the story, I get the error: >>>>> >>>>> >>>> <snip ...> >>>> >>>> >>>> >>>>> FAILURES: >>>>> 1) View Home Page (Publisher with no videos) FAILED >>>>> Spec::Expectations::ExpectationNotMetError: expected /Welcome/, >>>>> got "" >>>>> > > <snip ...> > > >>>>> I was expecting to see the default rails index page in the response. >>>>> >>>>> Where am I going wrong? >>>>> >>>> Do you see the rails index page when you run the app? >>>> >>> Yes. >>> >>> >> I created a basic rails integration test for the default welcome page >> (public/index.html) and this failed as well: no route found for / or >> page not found errors. >> >> I added a basic controller: >> >> class WelcomeController < ApplicationController >> >> def index >> render :text => "Welcome alvin" >> end >> end >> >> >> The rails integration test works as expected with the welcome controller. >> > > Does a rails integration test work without the Welcome Controller? >No.> >> The RailsStory works as expected with the welcome controller. >> > > Seems to me that the problem might be that the rails testing support > doesn''t handle serving up static pages in the public folder. The Rails > Welcome page is /public/index.html. > > WDYT? >Agreed. The rails testing support did not provide access to a static page.